You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case Using OpenTelemetry Without Any Java Agent, I want to record traceId and spanId to associate with log, but I found the OTEL span is ignored if the span not sampled.
In OpenTelemetry'sSdkSpanBuilder.startSpan, the SkdSpan will return if samplingDecision is DROP, and span will not trigger span.onStart which the SentrySpanProcessor is required.
// io.opentelemetry.sdk.trace.SdkSpan#startSpan// Call onStart here instead of calling in the constructor to make sure the span is completely// initialized.if (spanProcessor.isStartRequired()) {
spanProcessor.onStart(parentContext, span);
}
SentrySpanProcessor.onStart will add a span to spanStorage, if not, this.spanStorage.get(spanId) will be null.
richieyan
changed the title
Always record the traceId and spanId when the context is available, even if the span is not sampled
Always record opentelemetry traceId and spanId when the context is available, even if the span is not sampled
Dec 11, 2024
Problem Statement
In the case Using OpenTelemetry Without Any Java Agent, I want to record traceId and spanId to associate with log, but I found the OTEL span is ignored if the span not sampled.
In OpenTelemetry's
SdkSpanBuilder.startSpan
, the SkdSpan will return ifsamplingDecision
isDROP
, and span will not triggerspan.onStart
which theSentrySpanProcessor
is required.SentrySpanProcessor.onStart
will add a span to spanStorage, if not,this.spanStorage.get(spanId)
will be null.Could we add SpanId and TraceId even if
spanStorage.get(spanId)
is null, to create a SpanContext by OTEL, so that we can record traceId from OTEL.Solution Brainstorm
The text was updated successfully, but these errors were encountered: