DataDog / browser-sdk

Datadog Browser SDK
Apache License 2.0
294 stars 131 forks source link

✨ [RUM-4781] Update Custom Web Vitals API #2801

Closed nulrich closed 2 months ago

nulrich commented 3 months ago

Motivation

We would like to be able to report concurrent vitals with the same name and allowing better visualisations.

Changes

Update custom vital structure:

The custom vital value is now in duration field instead of in custom object.

Update custom vital API:

startDurationVital now returns a vital instance that is used to stop the vital instead of calling stopDurationVital.

Introducing addDurationVital to create a vital with a custom duration and startVital values.

Both methods now have a details attribute that can be used to differentiate vitals using the same name.

Testing


I have gone over the contributing documentation.

cit-pr-commenter[bot] commented 3 months ago

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.65 KiB 160.75 KiB 103 B +0.06%
Logs 57.96 KiB 57.96 KiB 0 B 0.00%
Rum Slim 109.18 KiB 109.28 KiB 103 B +0.09%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%

🚀 CPU Performance | Action Name | Base Average Cpu Time (ms) | Local Average Cpu Time (ms) | 𝚫 | | --- | --- | --- | --- | | addglobalcontext | 0.002 | 0.001 | -0.001 | | addaction | 0.050 | 0.030 | -0.020 | | adderror | 0.050 | 0.030 | -0.020 | | addtiming | 0.001 | 0.001 | -0.001 | | startview | 1.887 | 0.907 | -0.980 | | startstopsessionreplayrecording | 1.513 | 0.874 | -0.640 | | logmessage | 0.028 | 0.019 | -0.009 |
🧠 Memory Performance | Action Name | Base Consumption Memory (bytes) | Local Consumption Memory (bytes) | 𝚫 (bytes) | | --- | --- | --- | --- | | addglobalcontext | 21.12 KiB | 21.72 KiB | 620 B | | addaction | 72.56 KiB | 70.47 KiB | -2138 B | | adderror | 86.77 KiB | 85.66 KiB | -1132 B | | addtiming | 18.82 KiB | 17.23 KiB | -1626 B | | startview | 332.81 KiB | 336.10 KiB | 3.28 KiB | | startstopsessionreplayrecording | 15.32 KiB | 13.25 KiB | -2115 B | | logmessage | 69.98 KiB | 70.18 KiB | 203 B |

🔗 RealWorld

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.33%. Comparing base (fbb4822) to head (105b983).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2801 +/- ## ======================================= Coverage 93.33% 93.33% ======================================= Files 263 263 Lines 7502 7507 +5 Branches 1671 1673 +2 ======================================= + Hits 7002 7007 +5 Misses 500 500 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

amortemousque commented 3 months ago

Looks good! I think we should think about naming convention at some point though. For instance, in the different collections, we have processXXX() method that returns RawRumXXXEvent. However, the input type names follow different conventions: Sometime prefix with Raw, sometimes is suffixed with Event, sometime no prefix or suffix:

nulrich commented 3 months ago

/to-staging

dd-devflow[bot] commented 3 months ago

:steam_locomotive: Branch Integration: starting soon, median merge time is 0s

Commit 2d2287d2f1 will soon be integrated into staging-25.

Use /to-staging -c to cancel this operation!

dd-devflow[bot] commented 3 months ago

:steam_locomotive: Branch Integration: This commit was successfully integrated

Commit 2d2287d2f1 has been merged into staging-25 in merge commit 24604054e7.

Check out the triggered pipeline on Gitlab :fox_face:

nulrich commented 2 months ago

/to-staging

dd-devflow[bot] commented 2 months ago

:steam_locomotive: Branch Integration: starting soon, median merge time is 0s

Commit 105b983568 will soon be integrated into staging-28.

Use /to-staging -c to cancel this operation!

dd-devflow[bot] commented 2 months ago

:steam_locomotive: Branch Integration: This commit was successfully integrated

Commit 105b983568 has been merged into staging-28 in merge commit b26d16995d.

Check out the triggered pipeline on Gitlab :fox_face: