Skip to content
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

[1.2.x] Fix concurrent issue in observability #42962

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading