Fix remove PendingTrace from span cleaner bug
MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/PendingTrace.java
dd-trace-ot/src/main/java/datadog/opentracing/PendingTrace.java
@@ -205,6 +205,7 @@ public class PendingTrace extends ConcurrentLinkedDeque<DDSpan> {
while ((ref = referenceQueue.poll()) != null) {
weakReferences.remove(ref);
if (isWritten.compareAndSet(false, true)) {
+ SPAN_CLEANER.pendingTraces.remove(this);
// preserve throughput count.
// Don't report the trace because the data comes from buggy uses of the api and is suspect.
tracer.incrementTraceCount();

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/PendingTraceTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/PendingTraceTest.groovy
@@ -121,6 +121,7 @@ class PendingTraceTest extends Specification {
trace.asList() == [rootSpan]
writer == []
traceCount.get() == 1
+ !PendingTrace.SPAN_CLEANER.pendingTraces.contains(trace)
}
def "add unfinished span to trace fails"() {

Fix remove PendingTrace from span cleaner bug