GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opentelemetry): Expose sampling helper by mydea · Pull Request #12674 · getsentry/sentry-javascript

Conversation

@mydea

@mydea mydea commented Jun 27, 2024

Copy link
Copy Markdown
Member

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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mydea
mydea requested review from AbhiPrasad, chargome and lforst June 27, 2024 11:25
@mydea mydea self-assigned this Jun 27, 2024
@github-actions

github-actions Bot commented Jun 27, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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% 🔺)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AbhiPrasad AbhiPrasad mentioned this pull request Jun 27, 2024
Example of adding sentry to an existing OTEL app getsentry/opentelemetry-js#1
Closed
@tnolet

tnolet commented Jul 2, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mydea

mydea commented Jul 2, 2024

Copy link
Copy Markdown
Member Author

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!

tnolet reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AbhiPrasad
AbhiPrasad reviewed Jul 2, 2024
View reviewed changes
Comment thread packages/opentelemetry/src/index.ts Outdated
SentrySampler,
sentrySamplerNoDecision,
sentrySamplerNotSampled,
sentrySamplerSampled,

@AbhiPrasad AbhiPrasad Jul 2, 2024

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mydea mydea Jul 2, 2024

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mydea added 3 commits July 2, 2024 16:34
@mydea
feat(opentelemetry): Expose sampling helpers
b99c2a3
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.
@mydea
fix prettier
46bb0c7
@mydea
ref: rewrite to wrapSamplingDecision
235620f
@mydea

mydea commented Jul 2, 2024

Copy link
Copy Markdown
Member Author

Updated this to instead only export wrapSamplingDecision:

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mydea
mydea force-pushed the fn/otel-sampler branch from d7c937a to 235620f Compare July 2, 2024 14:43
@mydea mydea changed the title feat(opentelemetry): Expose sampling helpers feat(opentelemetry): Expose sampling helper Jul 2, 2024
AbhiPrasad
AbhiPrasad approved these changes Jul 2, 2024
View reviewed changes
@mydea
mydea merged commit d5bba58 into develop Jul 3, 2024
@mydea
mydea deleted the fn/otel-sampler branch July 3, 2024 09:50
@TheSlimvReal TheSlimvReal mentioned this pull request Jul 25, 2024
[Snyk] Upgrade @sentry/browser from 8.13.0 to 8.14.0 Aam-Digital/ndb-core#2477
Merged
This was referenced Jul 26, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.14.0 https-quantumblockchainai-atlassian-net/ossinsight#781
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.15.0 https-quantumblockchainai-atlassian-net/ossinsight#783
Open
@amykapernick amykapernick mentioned this pull request Jul 27, 2024
[Snyk] Upgrade @sentry/nextjs from 8.14.0 to 8.15.0 amykapernick/wedding#11
Open
@aam-digital-ci aam-digital-ci mentioned this pull request Jul 27, 2024
[Snyk] Upgrade @sentry/browser from 8.13.0 to 8.15.0 Aam-Digital/ndb-core#2482
Closed
This was referenced Jul 30, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.16.0 https-quantumblockchainai-atlassian-net/ossinsight#787
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.17.0 https-quantumblockchainai-atlassian-net/ossinsight#791
Open
@amykapernick amykapernick mentioned this pull request Aug 1, 2024
[Snyk] Upgrade @sentry/nextjs from 8.14.0 to 8.17.0 amykapernick/wedding#12
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lforst lforst Awaiting requested review from lforst
@chargome chargome Awaiting requested review from chargome
1 more reviewer
@AbhiPrasad AbhiPrasad AbhiPrasad approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@mydea mydea

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mydea @tnolet @AbhiPrasad
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.