Content-Length: 210298 | pFad | http://github.com/getsentry/sentry-javascript/issues/15754

C3 Add possibility to sample subsequent traces based on previous trace sampling decision · Issue #15754 · getsentry/sentry-javascript · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to sample subsequent traces based on previous trace sampling decision #15754

Open
Lms24 opened this issue Mar 20, 2025 · 0 comments
Labels
Package: core Issues related to the Sentry Core SDK

Comments

@Lms24
Copy link
Member

Lms24 commented Mar 20, 2025

Description

We should provide a way for users to make a sampling decision for a trace based on the sampling decision of the previous trace (i.e. the one we link since #14992). Concretely, we propose to add an option to tracesSampler:

Sentry.init({
  dsn: '...',
  tracesSampler(({previousTraceSampled}) => {
    if (previousTraceSampled) {
      return 1.0; // could also just increase the rate, e.g. to 0.5
    } else if (previousTraceSampled === false) {
      return 0;
    }
    return 0.05;
  })
})

where previousTraceSampled is typed as boolean | undefined. The semantics for all values:

  • true - previous trace was positively sampled and sent to Sentry (this makes no guarantees that this trace in fact was stored; it can still be dropped by Relay)
  • false - previous trace was negatively sampled and not Sent to Sentry
  • undefined - multiple implications
    • the current trace is the first one
    • previous trace collection is disabled by users
    • previous trace collection is not available (e.g. server SDK)

This allows users to ensure that a trace chain is longer or in general more complete.

Important notes:

  • By default the SDK will not continue a positive sampling decision based on the previous trace. This must be a concious user decision to opt into.
  • The potential quota increase must be mentioned in JSDoc and docs
@Lms24 Lms24 added the Package: core Issues related to the Sentry Core SDK label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: core Issues related to the Sentry Core SDK
Projects
None yet
Development

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/getsentry/sentry-javascript/issues/15754

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy