-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nexjs): Sample out low-quality spans on older Next.js versions #11722
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 📦
|
Why the hell is this crashing the server? |
@@ -68,7 +84,10 @@ export class SentrySampler implements Sampler { | |||
// The reason for this is that the data quality of the spans varies, it is different per version of Next, | |||
// and we need to keep our manual instrumentation around for the edge runtime anyhow. | |||
// BUT we only do this if we don't have a parent span with a sampling decision yet (or if the parent is remote) | |||
if (spanAttributes['next.span_type'] && (typeof parentSampled !== 'boolean' || parentContext?.isRemote)) { | |||
if ( | |||
(spanAttributes['next.span_type'] || NEXTJS_SPAN_NAME_PREFIXES.includes(spanName.split('.')[0])) && |
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.
hmm this souns a bit like it could lead to false positives 😬 is there no other attribute type we can check for (e.g. next.xxx
)? 🤔
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 think that's the cost we have to pay if we have this so central in the opentelemetry package. Imo would it be isolated to the nextjs sdk it's probably fine but youre right that here its probably too risky.
Extends the sampling logic for bad Next.js spans ot account for older Next.js versions where we don't have the
next.span_type
attribute.Relates to https://github.com/getsentry/sentry-javascript-examples/pull/21/files#r1574816010