-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(tracing): Send sample rate and type in transaction item header in envelope #3068
Conversation
size-limit report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Concerned about piggybacking on tags.
Based on the TODO in the PR description, I believe there's still some ironing out of the protocol in Relay? Is there an accompanying PR there?
ddb7375
to
cec14a5
Compare
const { __sentry_samplingMethod: samplingMethod, __sentry_sampleRate: sampleRate, ...otherTags } = event.tags || {}; | ||
event.tags = otherTags; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import { eventToSentryRequest } from '../../src/request'; | ||
|
||
describe('eventToSentryRequest', () => { | ||
const api = new API('https://dogsarebadatkeepingsecrets@squirrelchasers.ingest.sentry.io/12312012'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how dogs can be bad at keeping secrets? 🤔
29467f2
to
0afb3c7
Compare
In our initial work on Dynamic Sampling (#3068), we added the ability to track transaction sampling method. https://github.com/getsentry/sentry-javascript/pull/3068/files#diff-337facb22f742f05b3326aed66ca6b0d5eb9c782c7c03c88ef0170fd97dc410dR104-R109 ```ts export enum TransactionSamplingMethod { Explicit = 'explicitly_set', Sampler = 'client_sampler', Rate = 'client_rate', Inheritance = 'inheritance', } ``` To use this info, we set the transaction sampling method and sample rate on the transaction event header: ```ts sample_rates: [{ id: samplingMethod, rate: sampleRate }], ``` In Relay this is used here: https://github.com/getsentry/relay/blob/4b16d279ccf21d3c1d975b652ffca01ebd72a500/relay-general/src/protocol/metrics.rs#L7-L16 This is no longer needed for dynamic sampling context with the introduction of Dynamic Sampling Context, so we can remove this code.
Product asked for this data, to get a sense of what kinds of sample rates people are using. It also may help inform future dynamic sampling work in relay.
TODO:
The spec didn't mention what should happen in either the case of sampling inheritance or of an explicitly set sampling decision, so I recorded it, but with no sample rate. Happy to change this to something else if anyone would prefer.EDIT: Agreed with @HazAT that we'll go with the simple version for now: sample rates sent if they come from either
traces_sampler
or -traces_sample_rate
, but not other methods (inheritance and having the sampling decision explicitly set). The rest, listed above, we'll hold on until it's clear we need to do it.