[Profiling] Add action and vital metadata to profiles#4148
[Profiling] Add action and vital metadata to profiles#4148MandragoreVR wants to merge 4 commits intomainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
59aa5b7 to
f709051
Compare
|
✨ Fix all issues with BitsAI or with Cursor
|
f709051 to
2d17fef
Compare
5059362 to
ac62ddd
Compare
thomasbertet
left a comment
There was a problem hiding this comment.
Looks good to me!
I believe we could have a more generic history combining all of the profiler's tracked events in one place, it would be slightly less code.
| { | ||
| id: vitalStart.id, | ||
| startClocks: vitalStart.startClocks, | ||
| duration: 0 as Duration, |
There was a problem hiding this comment.
I wonder if we should have another value for "non-stopped" events 🤔
Relying on 0 seems like it could be error prone and the BE that process should be aware 0 means "not stopped".
Maybe just undefined would work instead ? WDYT ?
There was a problem hiding this comment.
Good question... could we maybe settle for something like -1, though, to not have to re-do a rum-events-format PR to allow undefined here?
There was a problem hiding this comment.
Yes, but we will need to adjust the logic, I kinda forgot about this when I did the BE logic : https://github.com/DataDog/profiling-backend/pull/7969/changes#diff-fe24f465d52fe19d3a52bfd86ac3eaa5e441e710eca6bb9c26a14cac5ce169e4R339-R346
You can see I'm just using the duration field without taking into account if the duration is 0 or undefined.
Let's have -1 as signal for unfinished events. I'll prepare the BE to support that value.
There was a problem hiding this comment.
Actually maybe that's cleaner if that's undefined, even if we have to do another PR for the format, WDYT ?
There was a problem hiding this comment.
Works for me, I just updated!
Motivation
To enable profiling aggregation on the backend for vitals and actions, we want to add vitals and actions data to the metadata of profiling events.
This PR adds these entries to the profiling events metadata.
Changes
vitalHistorynext to the profiler that catches vital events from the life cycle and stores them in the historyactionHistorystartmethod of the event tracker return the stored dataTest instructions
sandbox/react-app/main.tsx, add:to the SDK configuration, and add
before the
returnof theLayoutfunction to have a vital that will be displayed in the collected ones.yarn devand go tolocalhost:8080/react-apphttps://browser-intake-datadoghq.com/api/v2/profilein the network tab (profiles usually last one minute, so this might not come instantly, but you can also edit the constantcollectIntervalMsinprofiler.tsto make it faster)"action"and"vital", both with an object of the shape{ "id": string[], "label": string[] }"action"and"vitals"with the following shape:Checklist