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

fix(otel): Add trace info to error events #6364

Merged
merged 2 commits into from
Dec 1, 2022
Merged

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Dec 1, 2022

Follows spec as is outlined here: https://develop.sentry.dev/sdk/performance/opentelemetry/#step-1-implement-the-sentryspanprocessor-on-your-sdk

Uses the logic from the baseclient here:

// We want to set the trace context for normal events only if there isn't already
// a trace context on the event. There is a product feature in place where we link
// errors with transaction and it relies on that.
if (this._span) {
event.contexts = { trace: this._span.getTraceContext(), ...event.contexts };
const transactionName = this._span.transaction && this._span.transaction.name;
if (transactionName) {
event.tags = { transaction: transactionName, ...event.tags };
}
}

Attach trace context info from active transaction to errors in an event processor. Couple things to note.

  1. This attaches the trace context to all events. Transactions should be setting their own trace context, and that will override this via the spread operator
  2. We don't use scope at all here - we are relying on identifying the active span via opentelemetry.

Supercedes approach from #6349 since we don't want to rely on scope.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.57 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.59 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.36 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.15 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.12 KB (0%)
@sentry/browser - Webpack (minified) 65.75 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.14 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.97 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.42 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.85 KB (+0.02% 🔺)
@sentry/replay index.js 37.2 KB (+0.02% 🔺)
@sentry/replay - Webpack (gzipped + minified) 37.18 KB (+0.02% 🔺)
@sentry/replay - Webpack (minified) 124.99 KB (+0.01% 🔺)

@AbhiPrasad AbhiPrasad merged commit 2ed5f8f into master Dec 1, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-link-error-otel branch December 1, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants