[Profiler] Remove sample-count threshold from profiler discard logic#4566
Open
thomasbertet wants to merge 1 commit intomainfrom
Open
[Profiler] Remove sample-count threshold from profiler discard logic#4566thomasbertet wants to merge 1 commit intomainfrom
thomasbertet wants to merge 1 commit intomainfrom
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 24c88f2 | Docs | Datadog PR Page | Give us feedback! |
6742b2f to
b1f8a72
Compare
Profiles were previously discarded when the number of stack-trace samples was below 50 (~500ms of scripting activity), causing short-lived non-SPA navigations with little scripting to be silently dropped. The sample-count check and the minNumberOfSamples configuration field are removed entirely. Profiles are now kept or discarded based solely on duration and long-task presence.
b1f8a72 to
24c88f2
Compare
Collaborator
thomas-lebeau
left a comment
There was a problem hiding this comment.
Can you edit the PR title to follow our convention. This help generate clean changelog and release notes.
other than that, LGTM 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Short-lived non-SPA navigations (full-page loads with moderate scripting) were being silently discarded by the profiler because they accumulated fewer than 50 stack-trace samples (~500ms of scripting activity), even when the page was active long enough to meet the duration threshold. This caused an empty "No profiles" state in the Profiling UI for use cases like shopist.io where users click quickly across pages.
Additionally, filtering on sample count introduced a selection bias in aggregations: only CPU-heavy pages were retained, skewing flame graphs away from scripting-light but potentially slow navigations.
The trade-off here is collecting more profiles for a slightly better coverage of short-lived navigations.
Nonetheless, we keep discarding profiles <5s if they don't have Long Tasks in them.
Changes
minNumberOfSamplescheck from the profile discard logic inprofiler.ts. Profiles are now kept or discarded based solely on duration (minProfileDurationMs) and long-task presence.minNumberOfSamplesfield fromRUMProfilerConfigurationandDEFAULT_RUM_PROFILER_CONFIGURATION.Test instructions
yarn test:unit --spec packages/rum/src/domain/profiling/profiler.spec.ts— 20 tests should pass.Checklist