Skip to content

Commit

Permalink
Merge pull request #42962 from NipunaMadhushan/fix-observability-1.2.x
Browse files Browse the repository at this point in the history
[1.2.x] Fix concurrent issue in observability
  • Loading branch information
keizer619 authored Jun 26, 2024
2 parents 52176f1 + 12c26d3 commit 046c47a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import org.ballerinalang.jvm.observability.tracer.TracersStore;
import org.ballerinalang.jvm.scheduling.Strand;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;

import static org.ballerinalang.jvm.observability.ObservabilityConstants.CONFIG_TRACING_ENABLED;
Expand All @@ -43,7 +44,7 @@ public class OpenTracerBallerinaWrapper {
private static OpenTracerBallerinaWrapper instance = new OpenTracerBallerinaWrapper();
private TracersStore tracerStore;
private final boolean enabled;
private Map<Long, ObserverContext> observerContextList = new HashMap<>();
private ConcurrentMap<Long, ObserverContext> observerContextList = new ConcurrentHashMap<>();
private AtomicLong spanId = new AtomicLong();
private static final int SYSTEM_TRACE_INDICATOR = -1;

Expand Down Expand Up @@ -139,7 +140,7 @@ public boolean finishSpan(Strand strand, long spanId) {
return false;
}
}

/**
* Method to add tags to an existing span.
*
Expand Down

0 comments on commit 046c47a

Please sign in to comment.