File tree Expand file tree Collapse file tree
dd-trace-ot/src/main/java/datadog/opentracing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ public class PendingTrace extends ConcurrentLinkedDeque<DDSpan> {
4040 Collections .newSetFromMap (new ConcurrentHashMap <WeakReference <?>, Boolean >());
4141
4242 private final AtomicInteger pendingReferenceCount = new AtomicInteger (0 );
43+ /**
44+ * During a trace there are cases where the root span must be accessed (e.g. priority sampling and
45+ * trace-search tags).
46+ *
47+ * <p>Use a weak ref because we still need to handle buggy cases where the root span is not
48+ * correctly closed (see SpanCleaner).
49+ *
50+ * <p>The root span will be available in non-buggy cases because it has either finished and
51+ * strongly ref'd in this queue or is unfinished and ref'd in a ContinuableScope.
52+ */
4353 private final AtomicReference <WeakReference <DDSpan >> rootSpan = new AtomicReference <>();
4454
4555 /** Ensure a trace is never written multiple times */
You can’t perform that action at this time.
0 commit comments