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

fix(js): Fix hierarchy and examples for sample rate configuration #13153

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 28, 2025

This PR improves the "Tracing > Configure Sampling" page in two main ways:

  1. It introduces proper headings for the two main sections - this way, you can link there, and it makes more sense structurally IMHO.
  2. It fixes the tracesSampler examples - you should always use inheritOrSampleWith for the default sample rate, otherwise you break propagation. We need to make sure to use this consistently in examples!

@mydea mydea requested review from lforst and codyde March 28, 2025 14:31
@mydea mydea self-assigned this Mar 28, 2025
Copy link

vercel bot commented Mar 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 28, 2025 2:46pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Mar 28, 2025 2:46pm
develop-docs ⬜️ Ignored (Inspect) Mar 28, 2025 2:46pm

Copy link

codecov bot commented Mar 28, 2025

Bundle Report

Changes will decrease total bundle size by 15 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.6MB -9 bytes (-0.0%) ⬇️
sentry-docs-client-array-push 9.44MB -6 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.58MB -0.0%
../instrumentation.js -3 bytes 910.48kB -0.0%
9523.js -3 bytes 886.53kB -0.0%
view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 869.55kB -0.0%
static/chunks/4612-*.js -3 bytes 398.04kB -0.0%
static/QFDAQijuVOsf829PkGbiC/_buildManifest.js (New) 578 bytes 578 bytes 100.0% 🚀
static/QFDAQijuVOsf829PkGbiC/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/YSFqs7Z_VFtrtAhNLHlnO/_buildManifest.js (Deleted) -578 bytes 0 bytes -100.0% 🗑️
static/YSFqs7Z_VFtrtAhNLHlnO/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

This option sets a fixed percentage of transactions to be captured:

<PlatformContent includePath="/tracing/sample-rate" />

With `tracesSampleRate` set to `0.25`, approximately 25% of transactions will be recorded and sent to Sentry. This provides an even cross-section of transactions regardless of where in your app they occur.

2. Sampling Function (`tracesSampler`)
### Sampling Function (`tracesSampler`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing im wondering, based on the feedback from the other Python PR, is if we should actually be changing the language of this section to suggest you can configure "A" traceSampler function; instead of implying this is a function we provide.

The way it was written originally def implies that its a function we give - which isnt the case if I understand right - but that might also be an unnecessary detail. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that may make sense 🤔 IMHO we can still merge this PR and tweak the exact language we use in a follow up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup - im good with that.

@mydea mydea merged commit ad782b3 into master Apr 2, 2025
11 checks passed
@mydea mydea deleted the fn/fix-hierarchy branch April 2, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants