-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(opentelemetry): Expose sampling helper #12674
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
Conversation
size-limit report 📦
|
@mydea do you have any idea when this patch PR might land in the main branch and be published? |
Once this is reviewed and merged, it will go into the next release - probably later this week or early next week it should be out! |
packages/opentelemetry/src/index.ts
Outdated
SentrySampler, | ||
sentrySamplerNoDecision, | ||
sentrySamplerNotSampled, | ||
sentrySamplerSampled, |
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.
m: Couldn't we expose a single method that takes in SamplingDecision
from @opentelemetry/sdk-trace-base
or similar?
sentrySampler({
decision, // SamplingDecision enum
context,
spanAttributes,
})
It feels like a lot of overhead for us to export three different methods, and to me it feels better to expose the underlying enum being used.
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.
that sounds like a good idea to me! 👍 will adjust this.
When users want to use a custom sampler, they can use these new helpers to still have sentry working nicely with whatever they decide to do in there. For e.g. trace propagation etc. to work correctly with Sentry, we need to attach some things to trace state etc. These helpers encapsulate this for the user, while still allowing them to decide however they want if the span should be sampled or not.
Updated this to instead only export return wrapSamplingDecision({ decision: SamplingDecision.NOT_RECORD, context, spanAttributes }); |
When users want to use a custom sampler, they can use these new helpers to still have sentry working nicely with whatever they decide to do in there.
For e.g. trace propagation etc. to work correctly with Sentry, we need to attach some things to trace state etc. These helpers encapsulate this for the user, while still allowing them to decide however they want if the span should be sampled or not.
This was brought up here: #12191 (reply in thread)