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(core): Add continueTrace
method
#9164
Conversation
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.
This is really elegant, it means we can use it with startSpan
also.
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.
Do we also export this in the browser SDKs? I believe we should, for meta tags.
(If there's a reason not to, disregard my other comment).
packages/core/src/tracing/trace.ts
Outdated
/** | ||
* Continue a trace from a sentryTrace & baggage header. | ||
* This method takes a sentryTrace, baggage, and an optional request, | ||
* and will continue tracing from the context provided. | ||
* It takes a callback that receives a transactionContext that may be used for `startTransaction` or `startSpan`. | ||
*/ | ||
export function continueTrace<V>( |
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.
l: I'd add meta tags here for the backend->frontend use case.
/** | |
* Continue a trace from a sentryTrace & baggage header. | |
* This method takes a sentryTrace, baggage, and an optional request, | |
* and will continue tracing from the context provided. | |
* It takes a callback that receives a transactionContext that may be used for `startTransaction` or `startSpan`. | |
*/ | |
export function continueTrace<V>( | |
/** | |
* Continue a trace from a `sentry-trace` and `baggage` values. | |
* These values can be obtained from incoming request headers or, in the browser, from `<meta name="sentry-trace">` and `<meta name="baggage">` HTML tags. | |
* | |
* This function takes a `sentry-trace`, `baggage`, and optionally, a `request` object. | |
* It will continue tracing from the context provided. | |
* | |
* It takes a callback that receives a transactionContext that may be used for `startTransaction` or `startSpan`. | |
*/ | |
export function continueTrace<V>( |
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 updated the comment to reflect this 👍
1ff8049
to
43053b7
Compare
Oops, missed that - added it to browser exports as well! |
43053b7
to
0403078
Compare
I am a bit in favor of removing the |
I'll remove the request then. I have no strong feelings and was also not sure. Maybe we can also streamline around just always setting |
0403078
to
a0eb998
Compare
This adds a new
continueTrace
method which can be used to continue a trace from headers.This method has the following signature:
In practice, this can be used like this:
Closes #9011