feat(nexjs): Sample out low-quality spans on older Next.js versions#11722
Merged
feat(nexjs): Sample out low-quality spans on older Next.js versions#11722
Conversation
Contributor
size-limit report 📦
|
Contributor
Author
|
Why the hell is this crashing the server? |
mydea
reviewed
Apr 22, 2024
| // 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])) && |
Member
There was a problem hiding this comment.
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)? 🤔
Contributor
Author
There was a problem hiding this comment.
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.
mydea
approved these changes
Apr 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extends the sampling logic for bad Next.js spans ot account for older Next.js versions where we don't have the
next.span_typeattribute.Relates to https://github.com/getsentry/sentry-javascript-examples/pull/21/files#r1574816010