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
feat(tracing): Expose new browserTracingIntegration
#10351
Conversation
@@ -57,6 +57,9 @@ export { | |||
BrowserTracing, | |||
defaultRequestInstrumentationOptions, | |||
instrumentOutgoingRequests, | |||
browserTracingIntegration, | |||
startBrowserTracingNavigationSpan, |
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.
These two APIs would be used by custom instrumentation, e.g. Angular, Ember, Next etc.
} | ||
|
||
// If `browserTracingIntegration()` was added, we need to force-convert it to our custom one | ||
if (isNewBrowserTracingIntegration(browserTracing)) { |
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.
This is all pretty hacky 😬 but the best I could come up with! It should work well enough for 99% of cases.
}, | ||
// TODO v8: Remove this again | ||
// This is private API that we use to fix converted BrowserTracing integrations in Next.js & SvelteKit | ||
options, |
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.
Could not think of a better way to allow us to solve this 😬 I'd say it's OK for now, we can remove it in v8.
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.
We need to refactor how options works in general with BrowserTracing
, there's some duplication around setting defaults that I think we can improve.
size-limit report 📦
|
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.
A little afraid I missed reviewing an export somewhere, but otherwise looks good!
So I added two further utilities:
These can be used by custom instrumentation to ensure we don't trigger the default spans. |
ed19b05
to
af7fc5c
Compare
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromData = context.data && context.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromMetadata = finalContext.metadata && finalContext.metadata.source; |
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: Shouldn't we additionally look for the source in context.attributes[SEMANTIC_ATTRIBUTES_SENTRY_SOURCE]
?
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 just directly copied this over for now, metadata
is a getter that merges that attribute in, so it should still work normally :) in v8 we adjust this then!
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.
ah wait nevermind, my comment is incorrect, I think you're right, let's also check attributes 👍
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.
added a check for this, also in the original browser tracing integration!
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.
Looks good to me!
Also deprecate the routing Instrumentation. This is WIP on top of #10351, to show how that would work. No idea how to get the tests working for this, though...
Extracted this out of #10327.
This PR:
browserTracingIntegration()
new BrowserTracing()
until v8).I copied the browser integration tests we have, which all pass!