-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ref(serverless): Extract propagation context #8429
Conversation
const sentryTrace = | ||
eventWithHeaders.headers && isString(eventWithHeaders.headers['sentry-trace']) | ||
? eventWithHeaders.headers['sentry-trace'] | ||
: undefined; |
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.
const sentryTrace = | |
eventWithHeaders.headers && isString(eventWithHeaders.headers['sentry-trace']) | |
? eventWithHeaders.headers['sentry-trace'] | |
: undefined; | |
const sentryTrace = eventWithHeaders.headers?.['sentry-trace'] || undefined; |
as we are already using optional chaining, might as well use it here as well ;)
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 the isString
check - see #8425 (comment) for more details.
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggageHeader); | ||
|
||
const hub = getCurrentHub(); | ||
const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined; |
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.
const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined; | |
const sentryTrace = req.headers?.['sentry-trace'] || undefined; |
ref #8352
Introduce the
tracingContextFromHeaders
(first used in #8422) to simplify how trace context is generated by serverless tracing handlers. Then set the propagation context accordingly.