From ad20d9736e1e21378eeb1990b751b185c1c9b561 Mon Sep 17 00:00:00 2001 From: Shijie Sheng Date: Wed, 12 Jun 2024 11:10:30 -0700 Subject: [PATCH] Fix incorrect span activation for local activities (#910) What changed? span is incorrectly activated for local activities, this is already activated in activity worker [cadence-java-client/src/main/java/com/uber/cadence/internal/worker/LocalActivityWorker.java](https://github.com/uber/cadence-java-client/blob/95cb139ff9947db730186369a4f4ed34578f85c8/src/main/java/com/uber/cadence/internal/worker/LocalActivityWorker.java#L137) --- .../internal/tracing/TracingPropagator.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java b/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java index 769a72b67..90fbe708a 100644 --- a/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java +++ b/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java @@ -101,17 +101,14 @@ public Span spanForExecuteLocalActivity(Task task) { // retrieve spancontext from params SpanContext parent = extract(params.getContext()); - Span span = - tracer - .buildSpan(EXECUTE_LOCAL_ACTIVITY) - .ignoreActiveSpan() - .addReference(References.FOLLOWS_FROM, parent) - .withTag(TAG_WORKFLOW_ID, params.getWorkflowExecution().getWorkflowId()) - .withTag(TAG_WORKFLOW_RUN_ID, params.getWorkflowExecution().getRunId()) - .withTag(TAG_ACTIVITY_TYPE, params.getActivityType().getName()) - .start(); - tracer.activateSpan(span); - return span; + return tracer + .buildSpan(EXECUTE_LOCAL_ACTIVITY) + .ignoreActiveSpan() + .addReference(References.FOLLOWS_FROM, parent) + .withTag(TAG_WORKFLOW_ID, params.getWorkflowExecution().getWorkflowId()) + .withTag(TAG_WORKFLOW_RUN_ID, params.getWorkflowExecution().getRunId()) + .withTag(TAG_ACTIVITY_TYPE, params.getActivityType().getName()) + .start(); } public void inject(Map headers) {