Skip to content

[Profiling] Add action and vital metadata to profiles#4148

Draft
MandragoreVR wants to merge 2 commits intomainfrom
teo.chaillou/RUM-14305-browser-add-action-and-vital-metadata-to-profiles
Draft

[Profiling] Add action and vital metadata to profiles#4148
MandragoreVR wants to merge 2 commits intomainfrom
teo.chaillou/RUM-14305-browser-add-action-and-vital-metadata-to-profiles

Conversation

@MandragoreVR
Copy link
Collaborator

@MandragoreVR MandragoreVR commented Feb 6, 2026

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. It relies on this PR from rum-events-format to be merged.

Changes

  • In the action collection, there was already a history mechanism, so I:
    • bumped the timeout delay to SESSION_TIME_OUT_DELAY
    • updated the type of data that is stored inside, to go from a single id to an action context object
    • added action storage in history for instant manual actions, to make sure all actions are included in the profile's metadata
    • updated action collection's unit tests
  • In the vitals collection:
    • Add a history mechanism to store all the vitals that occur during a session
    • update vital collection's unit tests
  • Update the build of a profile's attributes to add actions and vitals
    • update profiler's tests to make sure vitals and actions are collected

Test instructions

  • In the file sandbox/react-app/main.tsx, add:
profilingSampleRate: 100,
  site: 'datadoghq.com',
  service: 'sandbox-react-app',
  env: 'development',
  beforeSend: () => false,

to the SDK configuration, and add

  useEffect(() => {
    datadogRum.startDurationVital('test vital')

    const timeout = setTimeout(() => {
      datadogRum.stopDurationVital('test vital')
    }, 1000)

    return () => {
      clearTimeout(timeout)
    }
  }, [])

before the return of the Layout function to have a vital that will be displayed in the collected ones.

  • Run yarn dev and go to localhost:8080/react-app
  • Wait for a request to https://browser-intake-datadoghq.com/api/v2/profile in the network tab (profiles usually last one minute, so this might not come instantly, but you can also edit the constant collectIntervalMs in profiler.ts to make it faster)
  • Look at the payload, that contains two big objects.
    • The first one should contain the fields "action" and "vital", both with an object of the shape { "id": string[], "label": string[] }
    • The second one should contain the fields "action" and "vitals" with the following shape:
image

Checklist

  • Tested locally
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@MandragoreVR MandragoreVR self-assigned this Feb 6, 2026
@github-actions
Copy link

github-actions bot commented Feb 6, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Feb 6, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 167.98 KiB 168.57 KiB +608 B +0.35%
Rum Profiler 4.31 KiB 4.66 KiB +358 B +8.11%
Rum Recorder 24.54 KiB 24.54 KiB 0 B 0.00%
Logs 56.25 KiB 56.25 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 124.88 KiB 125.47 KiB +613 B +0.48%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance

Pending...

🧠 Memory Performance

Pending...

🔗 RealWorld

@MandragoreVR MandragoreVR force-pushed the teo.chaillou/RUM-14305-browser-add-action-and-vital-metadata-to-profiles branch from ac613af to 59aa5b7 Compare February 6, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant