Skip to content

fix(otel): Always set baggage regardless of active transaction #6819

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

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

AbhiPrasad
Copy link
Member

fixes #6807

Set baggage even when there is no active transaction. We do this because we are responsible for propagating baggage via the W3CBaggagePropagator which the SentryPropagator inherits from.

@AbhiPrasad AbhiPrasad requested review from mydea and lforst January 17, 2023 10:58
@@ -23,7 +23,7 @@ export const SENTRY_SPAN_PROCESSOR_MAP: Map<SentrySpan['spanId'], SentrySpan> =
export class SentrySpanProcessor implements OtelSpanProcessor {
public constructor() {
addGlobalEventProcessor(event => {
const otelSpan = trace.getActiveSpan() as OtelSpan;
const otelSpan = trace && trace.getActiveSpan && (trace.getActiveSpan() as OtelSpan | undefined);
Copy link
Member Author

Choose a reason for hiding this comment

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

Snuck this change in as it seems that getActiveSpan is not defined for some versions - will investigate more but at least this unhandled errors in production.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.5 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.22 KB (0%)
@sentry/browser - Webpack (minified) 66.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.51 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.73 KB (-0.02% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.02 KB (+0.02% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (-0.82% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.45 KB (-0.99% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.35 KB (-0.6% 🔽)

@AbhiPrasad AbhiPrasad merged commit 952d866 into master Jan 17, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-redefine-baggage branch January 17, 2023 11:40
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.

[OTEL] Make sure we propagate baggage correctly
2 participants