Fixing deprecated methods
MODIFY
dd-trace/dd-trace.gradle
dd-trace/dd-trace.gradle
@@ -23,7 +23,6 @@ dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.8'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.8.8'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
- compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'com.google.auto.service', name: 'auto-service', version: '1.0-rc3'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.6.2'

MODIFY
dd-trace/src/test/java/ExampleWithLoggingWriter.java
dd-trace/src/test/java/ExampleWithLoggingWriter.java
@@ -10,14 +10,14 @@ public class ExampleWithLoggingWriter {
DDTracer tracer = new DDTracer(new LoggingWriter(), new AllSampler());
Span parent =
- tracer.buildSpan("hello-world").withServiceName("service-name").withSpanType("web").start();
+ tracer.buildSpan("hello-world").withServiceName("service-name").withSpanType("web").startManual();
parent.setBaggageItem("a-baggage", "value");
Thread.sleep(100);
Span child =
- tracer.buildSpan("hello-world").asChildOf(parent).withResourceName("resource-name").start();
+ tracer.buildSpan("hello-world").asChildOf(parent).withResourceName("resource-name").startManual();
Thread.sleep(100);

MODIFY
dd-trace/src/test/java/com/datadoghq/trace/DDSpanBuilderTest.java
dd-trace/src/test/java/com/datadoghq/trace/DDSpanBuilderTest.java
@@ -28,7 +28,7 @@ public class DDSpanBuilderTest {
public void shouldBuildSimpleSpan() {
final String expectedName = "fakeName";
- DDSpan span = tracer.buildSpan(expectedName).withServiceName("foo").start();
+ DDSpan span = tracer.buildSpan(expectedName).withServiceName("foo").startManual();
assertThat(span.getOperationName()).isEqualTo(expectedName);
}
@@ -52,14 +52,14 @@ public class DDSpanBuilderTest {
.withTag("1", (Boolean) tags.get("1"))
.withTag("2", (String) tags.get("2"))
.withTag("3", (Number) tags.get("3"))
- .start();
+ .startManual();
assertThat(span.getOperationName()).isEqualTo(expectedName);
assertThat(span.getTags()).containsAllEntriesOf(tags);
// with no tag provided
- span = tracer.buildSpan(expectedName).withServiceName("foo").start();
+ span = tracer.buildSpan(expectedName).withServiceName("foo").startManual();
assertThat(span.getTags()).isNotNull();
assertThat(span.getTags().size()).isEqualTo(2);
@@ -77,7 +77,7 @@ public class DDSpanBuilderTest {
.withServiceName(expectedService)
.withErrorFlag()
.withSpanType(expectedType)
- .start();
+ .startManual();
DDSpanContext actualContext = span.context();
@@ -96,7 +96,7 @@ public class DDSpanBuilderTest {
final String expectedName = "fakeName";
- DDSpan span = tracer.buildSpan(expectedName).withServiceName("foo").start();
+ DDSpan span = tracer.buildSpan(expectedName).withServiceName("foo").startManual();
assertThat(span.getBaggageItem(DDSpanContext.LANGUAGE_FIELDNAME)).isEqualTo("java");
}
@@ -120,7 +120,7 @@ public class DDSpanBuilderTest {
// auto-timestamp in nanoseconds
long tick = System.currentTimeMillis();
- span = tracer.buildSpan(expectedName).withServiceName("foo").start();
+ span = tracer.buildSpan(expectedName).withServiceName("foo").startManual();
// Give a range of +/- 2 millis
assertThat(span.getStartTime())
@@ -141,7 +141,7 @@ public class DDSpanBuilderTest {
final String expectedName = "fakeName";
DDSpan span =
- tracer.buildSpan(expectedName).withServiceName("foo").asChildOf(mockedContext).start();
+ tracer.buildSpan(expectedName).withServiceName("foo").asChildOf(mockedContext).startManual();
DDSpanContext actualContext = span.context();
@@ -167,7 +167,7 @@ public class DDSpanBuilderTest {
.withServiceName("foo")
.withResourceName(expectedParentResourceName)
.withSpanType(expectedParentType)
- .start();
+ .startManual();
parent.setBaggageItem(expectedBaggageItemKey, expectedBaggageItemValue);
@@ -177,7 +177,7 @@ public class DDSpanBuilderTest {
.buildSpan(expectedName)
.withServiceName(expectedParentServiceName)
.asChildOf(parent)
- .start();
+ .startManual();
assertThat(span.getOperationName()).isEqualTo(expectedName);
assertThat(span.getBaggageItem(expectedBaggageItemKey)).isEqualTo(expectedBaggageItemValue);
@@ -193,7 +193,7 @@ public class DDSpanBuilderTest {
.withResourceName(expectedChildResourceName)
.withSpanType(expectedChildType)
.asChildOf(parent)
- .start();
+ .startManual();
assertThat(span.getOperationName()).isEqualTo(expectedName);
assertThat(span.getBaggageItem(expectedBaggageItemKey)).isEqualTo(expectedBaggageItemValue);
@@ -211,7 +211,7 @@ public class DDSpanBuilderTest {
// root (aka spans[0]) is the parent
// others are just for fun
- DDSpan root = tracer.buildSpan("fake_O").withServiceName("foo").start();
+ DDSpan root = tracer.buildSpan("fake_O").withServiceName("foo").startManual();
spans.add(root);
Thread.sleep(200);
@@ -219,7 +219,7 @@ public class DDSpanBuilderTest {
for (int i = 1; i <= 10; i++) {
spans.add(
- tracer.buildSpan("fake_" + i).withServiceName("foo").asChildOf(spans.get(i - 1)).start());
+ tracer.buildSpan("fake_" + i).withServiceName("foo").asChildOf(spans.get(i - 1)).startManual());
}
spans.get(1).finish(tickEnd);

MODIFY
dd-trace/src/test/java/com/datadoghq/trace/DDSpanTest.java
dd-trace/src/test/java/com/datadoghq/trace/DDSpanTest.java
@@ -50,7 +50,7 @@ public class DDSpanTest {
final String expectedName = "operationName";
- DDSpan span = new DDTracer().buildSpan(expectedName).start();
+ DDSpan span = new DDTracer().buildSpan(expectedName).startManual();
// ResourceName = expectedName
assertThat(span.getResourceName()).isEqualTo(expectedName);
assertThat(span.getServiceName()).isEqualTo(DDTracer.UNASSIGNED_DEFAULT_SERVICE_NAME);
@@ -62,7 +62,7 @@ public class DDSpanTest {
.buildSpan(expectedName)
.withResourceName(expectedResourceName)
.withServiceName("foo")
- .start();
+ .startManual();
assertThat(span.getResourceName()).isEqualTo(expectedResourceName);
assertThat(span.getServiceName()).isEqualTo("foo");

MODIFY
dd-trace/src/test/java/com/datadoghq/trace/sampling/ExampleWithDDAgentWriter.java
dd-trace/src/test/java/com/datadoghq/trace/sampling/ExampleWithDDAgentWriter.java
@@ -22,14 +22,14 @@ public class ExampleWithDDAgentWriter {
DDTracer tracer = new DDTracer(writer, sampler);
Span parent =
- tracer.buildSpan("hello-world").withServiceName("service-name").withSpanType("web").start();
+ tracer.buildSpan("hello-world").withServiceName("service-name").withSpanType("web").startManual();
Thread.sleep(100);
parent.setBaggageItem("a-baggage", "value");
Span child =
- tracer.buildSpan("hello-world").asChildOf(parent).withResourceName("resource-name").start();
+ tracer.buildSpan("hello-world").asChildOf(parent).withResourceName("resource-name").startManual();
Thread.sleep(100);

MODIFY
dd-trace/src/test/java/com/datadoghq/trace/writer/impl/DDAgentWriterTest.java
dd-trace/src/test/java/com/datadoghq/trace/writer/impl/DDAgentWriterTest.java
@@ -27,12 +27,12 @@ public class DDAgentWriterTest {
//Setup
DDTracer tracer = new DDTracer();
- parent = tracer.buildSpan("hello-world").withServiceName("service-name").start();
+ parent = tracer.buildSpan("hello-world").withServiceName("service-name").startManual();
parent.setBaggageItem("a-baggage", "value");
Thread.sleep(100);
- DDSpan child = tracer.buildSpan("hello-world").asChildOf(parent).start();
+ DDSpan child = tracer.buildSpan("hello-world").asChildOf(parent).startManual();
Thread.sleep(100);
child.finish();

Fixing deprecated methods