sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

feat(opentelemetry): Expose sampling helpers

Open mydea opened this issue 1 year ago • 1 comments

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: https://github.com/getsentry/sentry-javascript/discussions/12191#discussioncomment-9892777

mydea avatar Jun 27 '24 11:06 mydea

size-limit report 📦

Path Size
@sentry/browser 22.22 KB (0%)
@sentry/browser (incl. Tracing) 33.38 KB (0%)
@sentry/browser (incl. Tracing, Replay) 69.12 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.45 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 73.18 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 85.8 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 87.66 KB (0%)
@sentry/browser (incl. metrics) 26.5 KB (0%)
@sentry/browser (incl. Feedback) 38.86 KB (0%)
@sentry/browser (incl. sendFeedback) 26.84 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.45 KB (0%)
@sentry/react 24.97 KB (0%)
@sentry/react (incl. Tracing) 36.43 KB (0%)
@sentry/vue 26.33 KB (0%)
@sentry/vue (incl. Tracing) 35.24 KB (0%)
@sentry/svelte 22.36 KB (0%)
CDN Bundle 23.42 KB (0%)
CDN Bundle (incl. Tracing) 35.12 KB (0%)
CDN Bundle (incl. Tracing, Replay) 69.22 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.41 KB (0%)
CDN Bundle - uncompressed 68.8 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 103.82 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 214.21 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 226.92 KB (0%)
@sentry/nextjs (client) 36.3 KB (0%)
@sentry/sveltekit (client) 34.02 KB (0%)
@sentry/node 130.68 KB (+0.06% 🔺)
@sentry/node - without tracing 91.71 KB (+0.08% 🔺)
@sentry/aws-serverless 116.88 KB (+0.06% 🔺)

github-actions[bot] avatar Jun 27 '24 11:06 github-actions[bot]

@mydea do you have any idea when this patch PR might land in the main branch and be published?

tnolet avatar Jul 02 '24 11:07 tnolet

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!

mydea avatar Jul 02 '24 12:07 mydea

Updated this to instead only export wrapSamplingDecision:

return wrapSamplingDecision({ decision: SamplingDecision.NOT_RECORD, context, spanAttributes });

mydea avatar Jul 02 '24 14:07 mydea