🐛 [Profiler] Fix empty session ID & quota check on renew#4766
Conversation
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 02dc778 | Docs | Datadog PR Page | Give us feedback! |
|
/to-staging |
|
View all feedbacks in Devflow UI.
Commit 3fbc921b4d will soon be integrated into staging-24.
Commit 3fbc921b4d has been merged into staging-24 in merge commit f71db4ddd8. If you need to revert this integration, you can use the following command: |
…ing-24 Integrated commit sha: 3fbc921 Co-authored-by: thomasbertet <thomas.bertet@datadoghq.com>
3fbc921 to
37bdc50
Compare
… profiler The SESSION_RENEWED handler was restarting the profiler without validating whether the new session passes the profiling sampling check, causing profiling to run for sessions that should not be sampled.
findTrackedSession(startTime) was called at collection time to resolve the session ID, but the session history may no longer contain the entry by then, resulting in an empty session ID in the profile payload. The session ID is now captured when the profiler instance starts.
…ce start time The previous test checked that findTrackedSession was called with a start time argument, which matched the old implementation. The test now verifies the actual behavior: the session ID captured when the profiler instance starts is used in the payload even if the session changes before collection.
cd3178c to
02dc778
Compare
|
/code revert-integration -b staging-24 |
|
View all feedbacks in Devflow UI.
Revert commits generated, trying to integrate them into
Commit c0a465e8a3 will soon be integrated into staging-24.
Commit c0a465e8a3 has been merged into staging-24 in merge commit 53bd4cffba. If you need to revert this integration, you can use the following command:
The changes from |
…ing-24 Integrated commit sha: c0a465e Co-authored-by: gh-worker-dd-devflow-36fce6[bot] <244854925+gh-worker-dd-devflow-36fce6[bot]@users.noreply.github.com> Co-authored-by: thomas.bertet <thomas.bertet@datadoghq.com>
Motivation
Profiles were being sent without a session ID:
findTrackedSession(startTime), but the session history may no longer contain the entry by then, resulting in an empty session ID in the profile payload.Quotas were not enforced on renewal:
Relates to PROF-15036.
Changes
RumProfilerRunningInstancewhen the profiler instance starts, and passed directly tohandleProfilerTraceinstead of being looked up by start time at collection.SESSION_RENEWEDhandler now validates the new session againstisSampled(newSession.id, correctedChildSampleRate(...))before restarting the profiler.Test instructions
Unit test added:
should not restart profiling on session renewal when new session is not sampled for profilinginprofiler.spec.ts.Checklist