Skip to content
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

Merged
merged 2 commits into from
Jul 4, 2023
Merged

Conversation

AbhiPrasad
Copy link
Member

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.

@AbhiPrasad AbhiPrasad requested review from a team, mydea and ale-cota and removed request for a team June 29, 2023 17:02
@AbhiPrasad AbhiPrasad self-assigned this Jun 29, 2023
Comment on lines +281 to +284
const sentryTrace =
eventWithHeaders.headers && isString(eventWithHeaders.headers['sentry-trace'])
? eventWithHeaders.headers['sentry-trace']
: undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ;)

Copy link
Member Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;
const sentryTrace = req.headers?.['sentry-trace'] || undefined;

@AbhiPrasad AbhiPrasad merged commit 02e5035 into develop Jul 4, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-twp-serverless branch July 4, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants