Skip to content

Commit 03dd4b3

Browse files
committed
fix: copy operationSpan to local variable in attemptStarted
1 parent d3153b0 commit 03dd4b3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/OpenTelemetryTracingTracer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ public void attemptStarted(Object request, int attemptNumber) {
181181
// Attempt spans are of the CLIENT kind
182182
spanBuilder.setSpanKind(SpanKind.CLIENT);
183183

184-
if (operationSpan != null) {
185-
spanBuilder.setParent(io.opentelemetry.context.Context.current().with(operationSpan));
184+
Span localOperationSpan = operationSpan;
185+
if (localOperationSpan != null) {
186+
spanBuilder.setParent(io.opentelemetry.context.Context.current().with(localOperationSpan));
186187
}
187188

188189
// Pass the combined attributes to the new SpanBuilder method

0 commit comments

Comments
 (0)