Skip to content

Commit 74cb793

Browse files
amarzialidevflow.devflow-routing-intake
andauthored
Remove deprecated internal spanBuilder methods (#11287)
Remove deprecated internal spanBuilder methods Fix missing callsites in tests change name for dynamic-instrumentation Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
1 parent ce88169 commit 74cb793

50 files changed

Lines changed: 248 additions & 242 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/DebuggerTracer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public DebuggerSpan createSpan(String encodedProbeId, String resourceName, Strin
2525
return DebuggerSpan.NOOP_SPAN;
2626
}
2727
AgentSpan dynamicSpan =
28-
tracerAPI.buildSpan(OPERATION_NAME).withResourceName(resourceName).start();
28+
tracerAPI
29+
.buildSpan("dynamic-instrumentation", OPERATION_NAME)
30+
.withResourceName(resourceName)
31+
.start();
2932
if (tags != null) {
3033
for (String tag : tags) {
3134
int idx = tag.indexOf(':');

dd-java-agent/agent-debugger/src/test/resources/com/datadog/debugger/CapturedSnapshot20.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class CapturedSnapshot20 {
2424

2525
public static int main(String arg) {
2626
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
27-
AgentSpan span = tracerAPI.buildSpan("process").start();
27+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "process").start();
2828
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
2929
if (arg.equals("exception") || arg.equals("illegal")) {
3030
return new CapturedSnapshot20().processWithException(arg);

dd-java-agent/agent-debugger/src/test/resources/com/datadog/debugger/CapturedSnapshot21.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class CapturedSnapshot21 {
2424

2525
public static int main(String arg) {
2626
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
27-
AgentSpan span = tracerAPI.buildSpan("rootProcess").start();
27+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "rootProcess").start();
2828
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
2929
return new CapturedSnapshot21().rootProcess(arg);
3030
} finally {
@@ -34,7 +34,7 @@ public static int main(String arg) {
3434

3535
private int rootProcess(String arg) {
3636
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
37-
AgentSpan span = tracerAPI.buildSpan("process1").start();
37+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "process1").start();
3838
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
3939
return process1(arg) + 1;
4040
} finally {
@@ -44,7 +44,7 @@ private int rootProcess(String arg) {
4444

4545
private int process1(String arg) {
4646
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
47-
AgentSpan span = tracerAPI.buildSpan("process2").start();
47+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "process2").start();
4848
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
4949
return process2(arg) + 1;
5050
} finally {
@@ -54,7 +54,7 @@ private int process1(String arg) {
5454

5555
private int process2(String arg) {
5656
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
57-
AgentSpan span = tracerAPI.buildSpan("process3").start();
57+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "process3").start();
5858
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
5959
return process3(arg) + 1;
6060
} finally {

dd-java-agent/agent-debugger/src/test/resources/com/datadog/debugger/CapturedSnapshot28.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CapturedSnapshot28 {
2525

2626
public static int main(String arg) {
2727
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
28-
AgentSpan span = tracerAPI.buildSpan("process").start();
28+
AgentSpan span = tracerAPI.buildSpan("dynamic-instrumentation", "process").start();
2929
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
3030
return new CapturedSnapshot28().process(arg);
3131
} finally {

dd-java-agent/instrumentation/couchbase/couchbase-3.1/src/main/java/datadog/trace/instrumentation/couchbase_31/client/DatadogRequestTracer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {
5050
seedNodes = parent.getTag(InstrumentationTags.COUCHBASE_SEED_NODES);
5151
}
5252

53-
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder(spanName);
53+
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
5454
if (null != parent) {
5555
builder.asChildOf(parent.context());
5656
}

dd-java-agent/instrumentation/couchbase/couchbase-3.2/src/main/java/datadog/trace/instrumentation/couchbase_32/client/DatadogRequestTracer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {
5454
}
5555
}
5656
if (requestSpan == null) {
57-
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder(spanName);
57+
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
5858
if (null != parent) {
5959
builder.asChildOf(parent.context());
6060
}

dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/AbstractPreparedStatementInstrumentation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ public static AgentScope onEnter(@Advice.This final Statement statement) {
8686
// The span ID is pre-determined so that we can reference it when setting the context
8787
final long spanID = DECORATE.setContextInfo(connection, dbInfo);
8888
// we then force that pre-determined span ID for the span covering the actual query
89-
span = AgentTracer.get().singleSpanBuilder(DATABASE_QUERY).withSpanId(spanID).start();
89+
span =
90+
AgentTracer.get()
91+
.singleSpanBuilder("java-jdbc-prepared_statement", DATABASE_QUERY)
92+
.withSpanId(spanID)
93+
.start();
9094
span.setTag(DBM_TRACE_INJECTED, true);
9195
} else if (DECORATE.isPostgres(dbInfo) && DBM_TRACE_PREPARED_STATEMENTS) {
9296
span = startSpan("java-jdbc-prepared_statement", DATABASE_QUERY);

dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/JDBCDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public long setContextInfo(Connection connection, DBInfo dbInfo) {
336336
// potentially get build span like here
337337
AgentSpan instrumentationSpan =
338338
AgentTracer.get()
339-
.singleSpanBuilder("set context_info")
339+
.singleSpanBuilder("java-jdbc", "set context_info")
340340
.withTag("dd.instrumentation", true)
341341
.start();
342342
DECORATE.afterStart(instrumentationSpan);

dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/StatementInstrumentation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public static AgentScope onEnter(
9898
// The span ID is pre-determined so that we can reference it when setting the context
9999
final long spanID = DECORATE.setContextInfo(connection, dbInfo);
100100
// we then force that pre-determined span ID for the span covering the actual query
101-
span = AgentTracer.get().singleSpanBuilder(DATABASE_QUERY).withSpanId(spanID).start();
101+
span =
102+
AgentTracer.get()
103+
.singleSpanBuilder("java-jdbc-statement", DATABASE_QUERY)
104+
.withSpanId(spanID)
105+
.start();
102106
} else if (isOracle) {
103107
span = startSpan("java-jdbc-statement", DATABASE_QUERY);
104108
DECORATE.setAction(span, connection);

dd-java-agent/instrumentation/kotlin-coroutines-1.3/src/testFixtures/kotlin/datadog/trace/instrumentation/kotlin/coroutines/CoreKotlinCoroutineTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ abstract class CoreKotlinCoroutineTests(private val dispatcher: CoroutineDispatc
364364
activeSpan().setSpanName(opName)
365365
}
366366

367-
protected fun childSpan(opName: String): AgentSpan = get().buildSpan(opName)
367+
protected fun childSpan(opName: String): AgentSpan = get().buildSpan("kotlin_coroutine", opName)
368368
.withResourceName("coroutines-test-span")
369369
.start()
370370

0 commit comments

Comments
 (0)