-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(opentelemetry)!: Simplify propagation and remove custom OTel tracing utils #22702
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
Changes from all commits
0df122c
19d37d8
aa90c89
0166d24
d3b91f3
5c0580d
313d70f
2efb184
65c8a4c
5d24bc4
302be74
3e353a4
61517d1
03fa4f1
451cbac
0fc26a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,8 +257,7 @@ export const continueTrace = <V>( | |
| return withScope(scope => { | ||
| const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); | ||
| scope.setPropagationContext(propagationContext); | ||
| _setSpanForScope(scope, undefined); | ||
| return callback(); | ||
| return withActiveSpan(null, callback); | ||
| }); | ||
| }; | ||
|
|
||
|
|
@@ -330,13 +329,15 @@ export function startNewTrace<T>(callback: () => T): T { | |
| return acs.startNewTrace(callback); | ||
| } | ||
|
|
||
| return withScope(scope => { | ||
| scope.setPropagationContext({ | ||
| traceId: generateTraceId(), | ||
| sampleRand: safeMathRandom(), | ||
| return withActiveSpan(null, () => { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just switching this up, it should not make concrete difference but seems more resilient, as it makes us more independent of what |
||
| return withScope(scope => { | ||
| scope.setPropagationContext({ | ||
| traceId: generateTraceId(), | ||
| sampleRand: safeMathRandom(), | ||
| }); | ||
| DEBUG_BUILD && debug.log(`Starting a new trace with id ${scope.getPropagationContext().traceId}`); | ||
| return callback(); | ||
| }); | ||
| DEBUG_BUILD && debug.log(`Starting a new trace with id ${scope.getPropagationContext().traceId}`); | ||
| return withActiveSpan(null, callback); | ||
| }); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import * as os from 'node:os'; | ||
| import type { Tracer } from '@opentelemetry/api'; | ||
| import { trace } from '@opentelemetry/api'; | ||
| import type { DynamicSamplingContext, Scope, ServerRuntimeClientOptions, TraceContext } from '@sentry/core'; | ||
| import type { ServerRuntimeClientOptions } from '@sentry/core'; | ||
| import { | ||
| _INTERNAL_clearAiProviderSkips, | ||
| _INTERNAL_flushLogsBuffer, | ||
|
|
@@ -11,11 +11,7 @@ import { | |
| SDK_VERSION, | ||
| ServerRuntimeClient, | ||
| } from '@sentry/core'; | ||
| import { | ||
| type AsyncLocalStorageLookup, | ||
| getTraceContextForScope, | ||
| type SentryTracerProvider, | ||
| } from '@sentry/opentelemetry'; | ||
| import { type AsyncLocalStorageLookup, type SentryTracerProvider } from '@sentry/opentelemetry'; | ||
| import { isMainThread, threadId } from 'worker_threads'; | ||
| import { DEBUG_BUILD } from '../debug-build'; | ||
| import type { NodeClientOptions } from '../types'; | ||
|
|
@@ -170,15 +166,4 @@ export class NodeClient extends ServerRuntimeClient<NodeClientOptions> { | |
| _INTERNAL_clearAiProviderSkips(); | ||
| super._setupIntegrations(); | ||
| } | ||
|
|
||
| /** Custom implementation for OTEL, so we can handle scope-span linking. */ | ||
| protected _getTraceInfoFromScope( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems this was not used anywhere anymore! |
||
| scope: Scope | undefined, | ||
| ): [dynamicSamplingContext: Partial<DynamicSamplingContext> | undefined, traceContext: TraceContext | undefined] { | ||
| if (!scope) { | ||
| return [undefined, undefined]; | ||
| } | ||
|
|
||
| return getTraceContextForScope(this, scope); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.