Rename to PendingTrace
MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/DDSpanContext.java
dd-trace-ot/src/main/java/datadog/opentracing/DDSpanContext.java
@@ -28,7 +28,7 @@ public class DDSpanContext implements io.opentracing.SpanContext {
private final DDTracer tracer;
/** The collection of all span related to this one */
- private final SpanCollection trace;
+ private final PendingTrace trace;
/** Baggage is associated with the whole trace and shared with other spans */
private final Map<String, String> baggageItems;
@@ -72,7 +72,7 @@ public class DDSpanContext implements io.opentracing.SpanContext {
final boolean errorFlag,
final String spanType,
final Map<String, Object> tags,
- final SpanCollection trace,
+ final PendingTrace trace,
final DDTracer tracer) {
assert tracer != null;
@@ -217,7 +217,7 @@ public class DDSpanContext implements io.opentracing.SpanContext {
}
@JsonIgnore
- public SpanCollection getTrace() {
+ public PendingTrace getTrace() {
return this.trace;
}

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/DDTracer.java
dd-trace-ot/src/main/java/datadog/opentracing/DDTracer.java
@@ -190,7 +190,7 @@ public class DDTracer implements io.opentracing.Tracer {
*
* @param trace a list of the spans related to the same trace
*/
- void write(final SpanCollection trace) {
+ void write(final PendingTrace trace) {
if (trace.isEmpty()) {
return;
}
@@ -414,7 +414,7 @@ public class DDTracer implements io.opentracing.Tracer {
final long spanId = generateNewId();
final long parentSpanId;
final Map<String, String> baggage;
- final SpanCollection parentTrace;
+ final PendingTrace parentTrace;
final int samplingPriority;
final DDSpanContext context;
@@ -442,7 +442,7 @@ public class DDTracer implements io.opentracing.Tracer {
traceId = ddsc.getTraceId();
parentSpanId = ddsc.getSpanId();
baggage = ddsc.getBaggage();
- parentTrace = new SpanCollection(DDTracer.this, traceId);
+ parentTrace = new PendingTrace(DDTracer.this, traceId);
samplingPriority = ddsc.getSamplingPriority();
// Start a new trace
@@ -450,7 +450,7 @@ public class DDTracer implements io.opentracing.Tracer {
traceId = generateNewId();
parentSpanId = 0L;
baggage = null;
- parentTrace = new SpanCollection(DDTracer.this, traceId);
+ parentTrace = new PendingTrace(DDTracer.this, traceId);
samplingPriority = PrioritySampling.UNSET;
}

RENAME
dd-trace-ot/src/main/java/datadog/opentracing/SpanCollection.java
dd-trace-ot/src/main/java/datadog/opentracing/PendingTrace.java
@@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class SpanCollection extends ConcurrentLinkedDeque<DDSpan> {
+public class PendingTrace extends ConcurrentLinkedDeque<DDSpan> {
static {
SpanCleaner.start();
}
@@ -33,7 +33,7 @@ public class SpanCollection extends ConcurrentLinkedDeque<DDSpan> {
/** Ensure a trace is never written multiple times */
private final AtomicBoolean isWritten = new AtomicBoolean(false);
- SpanCollection(final DDTracer tracer, final long traceId) {
+ PendingTrace(final DDTracer tracer, final long traceId) {
this.tracer = tracer;
this.traceId = traceId;
SpanCleaner.pendingTraces.add(this);
@@ -140,7 +140,7 @@ public class SpanCollection extends ConcurrentLinkedDeque<DDSpan> {
private static final ScheduledExecutorService EXECUTOR_SERVICE =
Executors.newScheduledThreadPool(1, FACTORY);
- static final Set<SpanCollection> pendingTraces = Sets.newConcurrentHashSet();
+ static final Set<PendingTrace> pendingTraces = Sets.newConcurrentHashSet();
static void start() {
EXECUTOR_SERVICE.scheduleAtFixedRate(new SpanCleaner(), 0, CLEAN_FREQUENCY, TimeUnit.SECONDS);
@@ -148,7 +148,7 @@ public class SpanCollection extends ConcurrentLinkedDeque<DDSpan> {
@Override
public void run() {
- for (final SpanCollection trace : pendingTraces) {
+ for (final PendingTrace trace : pendingTraces) {
trace.clean();
}
}

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanBuilderTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanBuilderTest.groovy
@@ -119,7 +119,7 @@ class DDSpanBuilderTest extends Specification {
when(mockedContext.getSpanId()).thenReturn(spanId)
when(mockedContext.getServiceName()).thenReturn("foo")
- when(mockedContext.getTrace()).thenReturn(new SpanCollection(tracer, 1L))
+ when(mockedContext.getTrace()).thenReturn(new PendingTrace(tracer, 1L))
final String expectedName = "fakeName"

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanSerializationTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanSerializationTest.groovy
@@ -51,7 +51,7 @@ class DDSpanSerializationTest extends Specification {
false,
"type",
tags,
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
baggage.put(DDTags.THREAD_NAME, Thread.currentThread().getName())

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/DDSpanTest.groovy
@@ -27,7 +27,7 @@ class DDSpanTest extends Specification {
false,
"fakeType",
null,
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
final DDSpan span = new DDSpan(1L, context)

RENAME
dd-trace-ot/src/test/groovy/datadog/opentracing/SpanCollectionTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/PendingTraceTest.groovy
@@ -5,14 +5,14 @@ import spock.lang.Specification
import spock.lang.Subject
-class SpanCollectionTest extends Specification {
+class PendingTraceTest extends Specification {
def writer = new ListWriter()
def tracer = new DDTracer(writer)
def traceId = System.identityHashCode(this)
@Subject
- SpanCollection trace = new SpanCollection(tracer, traceId)
+ PendingTrace trace = new PendingTrace(tracer, traceId)
DDSpan rootSpan = SpanFactory.newSpanOf(trace)
@@ -122,7 +122,7 @@ class SpanCollectionTest extends Specification {
def "register span to wrong trace fails"() {
setup:
- def otherTrace = new SpanCollection(tracer, traceId - 10)
+ def otherTrace = new PendingTrace(tracer, traceId - 10)
otherTrace.registerSpan(new DDSpan(0, rootSpan.context()))
expect:
@@ -133,7 +133,7 @@ class SpanCollectionTest extends Specification {
def "add span to wrong trace fails"() {
setup:
- def otherTrace = new SpanCollection(tracer, traceId - 10)
+ def otherTrace = new PendingTrace(tracer, traceId - 10)
rootSpan.finish()
otherTrace.addSpan(rootSpan)

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/SpanFactory.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/SpanFactory.groovy
@@ -19,7 +19,7 @@ class SpanFactory {
false,
"fakeType",
Collections.emptyMap(),
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
return new DDSpan(timestampMicro, context)
}
@@ -37,12 +37,12 @@ class SpanFactory {
false,
"fakeType",
Collections.emptyMap(),
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
return new DDSpan(1, context)
}
- static newSpanOf(SpanCollection trace) {
+ static newSpanOf(PendingTrace trace) {
def context = new DDSpanContext(
trace.traceId,
1L,
@@ -75,7 +75,7 @@ class SpanFactory {
false,
"fakeType",
Collections.emptyMap(),
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
context.setTag("env", envName)
return new DDSpan(0l, context)

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/URLAsResourceNameTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/URLAsResourceNameTest.groovy
@@ -2,7 +2,7 @@ package datadog.opentracing.decorators
import datadog.opentracing.DDSpanContext
import datadog.opentracing.DDTracer
-import datadog.opentracing.SpanCollection
+import datadog.opentracing.PendingTrace
import datadog.trace.common.sampling.PrioritySampling
import datadog.trace.common.writer.ListWriter
import io.opentracing.tag.Tags
@@ -100,7 +100,7 @@ class URLAsResourceNameTest extends Specification {
false,
"fakeType",
tags,
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
then:

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/propagation/HTTPCodecTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/propagation/HTTPCodecTest.groovy
@@ -2,7 +2,7 @@ package datadog.opentracing.propagation
import datadog.opentracing.DDSpanContext
import datadog.opentracing.DDTracer
-import datadog.opentracing.SpanCollection
+import datadog.opentracing.PendingTrace
import datadog.trace.common.sampling.PrioritySampling
import datadog.trace.common.writer.ListWriter
import io.opentracing.propagation.TextMapExtractAdapter
@@ -46,7 +46,7 @@ class HTTPCodecTest extends Specification {
false,
"fakeType",
null,
- new SpanCollection(tracer, 1L),
+ new PendingTrace(tracer, 1L),
tracer)
final Map<String, String> carrier = new HashMap<>()

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/scopemanager/ScopeManagerTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/scopemanager/ScopeManagerTest.groovy
@@ -3,7 +3,7 @@ package datadog.opentracing.scopemanager
import datadog.opentracing.DDSpan
import datadog.opentracing.DDSpanContext
import datadog.opentracing.DDTracer
-import datadog.opentracing.SpanCollection
+import datadog.opentracing.PendingTrace
import datadog.trace.common.writer.ListWriter
import io.opentracing.Scope
import io.opentracing.Span
@@ -115,7 +115,7 @@ class ScopeManagerTest extends Specification {
when:
continuation.activate()
continuation = null // Continuation references also hold up traces.
- SpanCollection.awaitGC()
+ PendingTrace.awaitGC()
((DDSpanContext) scopeManager.active().span().context()).trace.clean()
then:
@@ -147,7 +147,7 @@ class ScopeManagerTest extends Specification {
when:
// remove hard reference and force GC
continuation = null
- SpanCollection.awaitGC()
+ PendingTrace.awaitGC()
span.context().trace.clean()
then:
@@ -183,7 +183,7 @@ class ScopeManagerTest extends Specification {
when:
def newScope = cont.activate()
cont = null // Continuation references also hold up traces.
- SpanCollection.awaitGC()
+ PendingTrace.awaitGC()
((DDSpanContext) scopeManager.active().span().context()).trace.clean()
then:
@@ -236,7 +236,7 @@ class ScopeManagerTest extends Specification {
when:
// remove hard reference and force GC
continuation = null
- SpanCollection.awaitGC()
+ PendingTrace.awaitGC()
span.context().trace.clean()
then:

Rename to PendingTrace