Skip to content

fix(profiling-node): Respect profileSessionSampleRate in trace profile lifecycle - #22928

Merged
Lms24 merged 2 commits into
getsentry:developfrom
Jxxunnn:fix/profiling-node-trace-session-sample-rate
Aug 3, 2026
Merged

fix(profiling-node): Respect profileSessionSampleRate in trace profile lifecycle#22928
Lms24 merged 2 commits into
getsentry:developfrom
Jxxunnn:fix/profiling-node-trace-session-sample-rate

Conversation

@Jxxunnn

@Jxxunnn Jxxunnn commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #22927

When using the trace profile lifecycle in @sentry/profiling-node, trace lifecycle profiling was set up without checking the session sampling decision. As a result, chunk profiling would start on span start even when profileSessionSampleRate resulted in an unsampled session.

This change skips trace lifecycle profiling setup when the session is not sampled, ensuring that profileSessionSampleRate is respected in the trace lifecycle as well.

A regression test was added for profileSessionSampleRate: 0 with the trace profile lifecycle.

@Jxxunnn
Jxxunnn requested a review from a team as a code owner August 1, 2026 09:14
@Jxxunnn
Jxxunnn requested review from andreiborza and mydea and removed request for a team August 1, 2026 09:14
@Lms24
Lms24 requested a review from s1gr1d August 3, 2026 07:22
@Lms24 Lms24 self-assigned this Aug 3, 2026
@Lms24
Lms24 force-pushed the fix/profiling-node-trace-session-sample-rate branch from c770749 to be8ca07 Compare August 3, 2026 07:44

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Jxxunnn thanks for reporting and fixing this! You're right this looks like a bug. I formatted and rebased your PR to get CI passing. Will merge soon and also take care of releasing the fix in the next v10 version.

@Lms24
Lms24 merged commit 93bb15e into getsentry:develop Aug 3, 2026
42 checks passed
nicohrubec pushed a commit that referenced this pull request Aug 3, 2026
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See #22928

Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
@Lms24

Lms24 commented Aug 3, 2026

Copy link
Copy Markdown
Member

One thing to note: this change now requires that profileSessionSampleRate is set to enable profiling (as we saw in the test adjustments). This is how we intended it. Just might break some people who set up profiling incorrectly. I think this is fine/acceptable, given we fixed incorrect behaviour.

Lms24 added a commit that referenced this pull request Aug 3, 2026
…ofile lifecycle (#22940)

Backport of: #22928

Also adds credits in the next v10 changelog to @Jxxunnn who contributed
the fix to `develop`

---------

Co-authored-by: 이준근 <86228307+Jxxunnn@users.noreply.github.com>
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.

profileSessionSampleRate is ignored when profileLifecycle is 'trace' (Node continuous profiling)

2 participants