Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public DebuggerSpan createSpan(String encodedProbeId, String resourceName, Strin
return DebuggerSpan.NOOP_SPAN;
}
AgentSpan dynamicSpan =
tracerAPI.buildSpan(OPERATION_NAME).withResourceName(resourceName).start();
tracerAPI.buildSpan("debugger", OPERATION_NAME).withResourceName(resourceName).start();
if (tags != null) {
for (String tag : tags) {
int idx = tag.indexOf(':');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class CapturedSnapshot20 {

public static int main(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("process").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "process").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
if (arg.equals("exception") || arg.equals("illegal")) {
return new CapturedSnapshot20().processWithException(arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class CapturedSnapshot21 {

public static int main(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("rootProcess").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "rootProcess").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
return new CapturedSnapshot21().rootProcess(arg);
} finally {
Expand All @@ -34,7 +34,7 @@ public static int main(String arg) {

private int rootProcess(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("process1").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "process1").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
return process1(arg) + 1;
} finally {
Expand All @@ -44,7 +44,7 @@ private int rootProcess(String arg) {

private int process1(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("process2").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "process2").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
return process2(arg) + 1;
} finally {
Expand All @@ -54,7 +54,7 @@ private int process1(String arg) {

private int process2(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("process3").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "process3").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
return process3(arg) + 1;
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CapturedSnapshot28 {

public static int main(String arg) {
AgentTracer.TracerAPI tracerAPI = AgentTracer.get();
AgentSpan span = tracerAPI.buildSpan("process").start();
AgentSpan span = tracerAPI.buildSpan("debugger", "process").start();
try (AgentScope scope = tracerAPI.activateManualSpan(span)) {
return new CapturedSnapshot28().process(arg);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {
seedNodes = parent.getTag(InstrumentationTags.COUCHBASE_SEED_NODES);
}

AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder(spanName);
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
if (null != parent) {
builder.asChildOf(parent.context());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {
}
}
if (requestSpan == null) {
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder(spanName);
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
if (null != parent) {
builder.asChildOf(parent.context());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ public static AgentScope onEnter(@Advice.This final Statement statement) {
// The span ID is pre-determined so that we can reference it when setting the context
final long spanID = DECORATE.setContextInfo(connection, dbInfo);
// we then force that pre-determined span ID for the span covering the actual query
span = AgentTracer.get().singleSpanBuilder(DATABASE_QUERY).withSpanId(spanID).start();
span =
AgentTracer.get()
.singleSpanBuilder("java-jdbc-prepared_statement", DATABASE_QUERY)
.withSpanId(spanID)
.start();
span.setTag(DBM_TRACE_INJECTED, true);
} else if (DECORATE.isPostgres(dbInfo) && DBM_TRACE_PREPARED_STATEMENTS) {
span = startSpan("java-jdbc-prepared_statement", DATABASE_QUERY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public long setContextInfo(Connection connection, DBInfo dbInfo) {
// potentially get build span like here
AgentSpan instrumentationSpan =
AgentTracer.get()
.singleSpanBuilder("set context_info")
.singleSpanBuilder("java-jdbc", "set context_info")
.withTag("dd.instrumentation", true)
.start();
DECORATE.afterStart(instrumentationSpan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ public static AgentScope onEnter(
// The span ID is pre-determined so that we can reference it when setting the context
final long spanID = DECORATE.setContextInfo(connection, dbInfo);
// we then force that pre-determined span ID for the span covering the actual query
span = AgentTracer.get().singleSpanBuilder(DATABASE_QUERY).withSpanId(spanID).start();
span =
AgentTracer.get()
.singleSpanBuilder("java-jdbc-statement", DATABASE_QUERY)
.withSpanId(spanID)
.start();
} else if (isOracle) {
span = startSpan("java-jdbc-statement", DATABASE_QUERY);
DECORATE.setAction(span, connection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ognl.Ognl
class OgnlInstrumentationSpec extends InstrumentationSpecification {
void 'creates a new span for ognl parsing expressions'() {
when:
AgentSpan span = AgentTracer.get().buildSpan("top-span").start()
AgentSpan span = AgentTracer.get().buildSpan("ognl", "top-span").start()
def ognlExpr
AgentTracer.activateSpan(span).withCloseable {
ognlExpr = Ognl.parseExpression('foo')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class ReactorCoreTest extends InstrumentationSpecification {
where:
spanType | buildSpan | finishSpan
"datadog" | {
TEST_TRACER.buildSpan("contextual").start()
TEST_TRACER.buildSpan("reactor-core", "contextual").start()
} | {
AgentSpan span -> span.finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class ReactorCoreTest extends InstrumentationSpecification {
where:
spanType | buildSpan | finishSpan
"datadog" | {
TEST_TRACER.buildSpan("contextual").start()
TEST_TRACER.buildSpan("reactor-core", "contextual").start()
} | {
AgentSpan span -> span.finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ private void setDataJobsSamplingPriority(AgentSpan span) {

private AgentTracer.SpanBuilder buildSparkSpan(String spanName, Properties properties) {
AgentTracer.SpanBuilder builder =
tracer.buildSpan(spanName).withSpanType("spark").withTag("app_id", appId);
tracer.buildSpan("spark", spanName).withSpanType("spark").withTag("app_id", appId);

if (databricksServiceName != null) {
builder.withServiceName(databricksServiceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static synchronized void createLauncherSpan(Object launcher) {
AgentTracer.TracerAPI tracer = AgentTracer.get();
AgentSpan span =
tracer
.buildSpan("spark.launcher.launch")
.buildSpan("spark-launcher", "spark.launcher.launch")
.withSpanType("spark")
.withResourceName("SparkLauncher.startApplication")
.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class SparkLauncherTest extends InstrumentationSpecification {
SparkLauncherListener.launcherSpan = null
def tracer = AgentTracer.get()
SparkLauncherListener.launcherSpan = tracer
.buildSpan("spark.launcher.launch")
.buildSpan("spark-launcher", "spark.launcher.launch")
.withSpanType("spark")
.withResourceName("SparkLauncher.startApplication")
.start()
Expand Down Expand Up @@ -135,7 +135,7 @@ class SparkLauncherTest extends InstrumentationSpecification {
SparkLauncherListener.launcherSpan = null
def tracer = AgentTracer.get()
SparkLauncherListener.launcherSpan = tracer
.buildSpan("spark.launcher.launch")
.buildSpan("spark-launcher", "spark.launcher.launch")
.withSpanType("spark")
.withResourceName("SparkLauncher.startApplication")
.start()
Expand Down Expand Up @@ -167,7 +167,7 @@ class SparkLauncherTest extends InstrumentationSpecification {
SparkLauncherListener.launcherSpan = null
def tracer = AgentTracer.get()
SparkLauncherListener.launcherSpan = tracer
.buildSpan("spark.launcher.launch")
.buildSpan("spark-launcher", "spark.launcher.launch")
.withSpanType("spark")
.withResourceName("SparkLauncher.startApplication")
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class TracerConnectionReliabilityTest extends DDSpecification {

def createSpans(int count, int delay) {
for (def index: 1..count) {
def span = tracer.buildSpan("operation-${index}").start()
def span = tracer.buildSpan("datadog", "operation-${index}").start()
Thread.sleep(delay)
span.finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PrintingWriterTest extends DDCoreSpecification {
Types.newParameterizedType(List, Map))))

def setup() {
def builder = tracer.buildSpan("fakeOperation")
def builder = tracer.buildSpan("datadog", "fakeOperation")
.withServiceName("fakeService")
.withResourceName("fakeResource")
.withSpanType("fakeType")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class CiVisibilityApmProtocolInterceptorTest extends DDCoreSpecification {
setup:
tracer.addTraceInterceptor(CiVisibilityApmProtocolInterceptor.INSTANCE)

tracer.buildSpan("test-module").withSpanType(DDSpanTypes.TEST_MODULE_END).start().finish()
tracer.buildSpan("test-suite").withSpanType(DDSpanTypes.TEST_SUITE_END).start().finish()
tracer.buildSpan("test").withSpanType(DDSpanTypes.TEST).start().finish()
tracer.buildSpan("datadog", "test-module").withSpanType(DDSpanTypes.TEST_MODULE_END).start().finish()
tracer.buildSpan("datadog", "test-suite").withSpanType(DDSpanTypes.TEST_SUITE_END).start().finish()
tracer.buildSpan("datadog", "test").withSpanType(DDSpanTypes.TEST).start().finish()

writer.waitForTraces(1)

Expand All @@ -38,7 +38,7 @@ class CiVisibilityApmProtocolInterceptorTest extends DDCoreSpecification {
setup:
tracer.addTraceInterceptor(CiVisibilityApmProtocolInterceptor.INSTANCE)

def testSpan = tracer.buildSpan("test").withSpanType(DDSpanTypes.TEST).start()
def testSpan = tracer.buildSpan("datadog", "test").withSpanType(DDSpanTypes.TEST).start()
testSpan.setTag(Tags.TEST_SESSION_ID, "session ID")
testSpan.setTag(Tags.TEST_MODULE_ID, "module ID")
testSpan.setTag(Tags.TEST_SUITE_ID, "suite ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CiVisibilityTraceInterceptorTest extends DDCoreSpecification {

def "discard a trace that does not come from ci app"() {
tracer.addTraceInterceptor(CiVisibilityTraceInterceptor.INSTANCE)
tracer.buildSpan("sample-span").start().finish()
tracer.buildSpan("datadog", "sample-span").start().finish()

expect:
writer.size() == 0
Expand All @@ -29,7 +29,7 @@ class CiVisibilityTraceInterceptorTest extends DDCoreSpecification {
def "do not discard a trace that comes from ci app"() {
tracer.addTraceInterceptor(CiVisibilityTraceInterceptor.INSTANCE)

def span = tracer.buildSpan("sample-span").start()
def span = tracer.buildSpan("datadog", "sample-span").start()
((DDSpanContext) span.context()).origin = CIConstants.CIAPP_TEST_ORIGIN
span.finish()

Expand All @@ -42,7 +42,7 @@ class CiVisibilityTraceInterceptorTest extends DDCoreSpecification {
tracer.addTraceInterceptor(CiVisibilityTraceInterceptor.INSTANCE)


def span = tracer.buildSpan("sample-span").withSpanType(spanType).start()
def span = tracer.buildSpan("datadog", "sample-span").withSpanType(spanType).start()
((DDSpanContext) span.context()).origin = CIConstants.CIAPP_TEST_ORIGIN
span.finish()
writer.waitForTraces(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AsmStandaloneSamplerTest extends DDCoreSpecification{
def tracer = tracerBuilder().writer(writer).sampler(sampler).build()

when:
def span1 = tracer.buildSpan("test").start()
def span1 = tracer.buildSpan("datadog", "test").start()
sampler.setSamplingPriority(span1)

then:
Expand All @@ -33,7 +33,7 @@ class AsmStandaloneSamplerTest extends DDCoreSpecification{
span1.getSamplingPriority() == PrioritySampling.SAMPLER_KEEP

when:
def span2 = tracer.buildSpan("test2").start()
def span2 = tracer.buildSpan("datadog", "test2").start()
sampler.setSamplingPriority(span2)

then:
Expand All @@ -43,7 +43,7 @@ class AsmStandaloneSamplerTest extends DDCoreSpecification{
span2.getSamplingPriority() == PrioritySampling.SAMPLER_DROP

when:
def span3 = tracer.buildSpan("test3").start()
def span3 = tracer.buildSpan("datadog", "test3").start()
sampler.setSamplingPriority(span3)

then: "Mock one minute later"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ForcePrioritySamplerTest extends DDCoreSpecification {
def tracer = tracerBuilder().writer(writer).sampler(sampler).build()

when:
def span1 = tracer.buildSpan("test").start()
def span1 = tracer.buildSpan("datadog", "test").start()
sampler.setSamplingPriority(span1)

then:
Expand All @@ -43,7 +43,7 @@ class ForcePrioritySamplerTest extends DDCoreSpecification {
def tracer = tracerBuilder().writer(writer).sampler(sampler).build()

when:
def span = tracer.buildSpan("test").start()
def span = tracer.buildSpan("datadog", "test").start()

then:
span.getSamplingPriority() == null
Expand All @@ -69,7 +69,7 @@ class ForcePrioritySamplerTest extends DDCoreSpecification {
when:
def sampler = new ForcePrioritySampler(SAMPLER_KEEP, DEFAULT)
def tracer = tracerBuilder().writer(new LoggingWriter()).sampler(sampler).build()
def span = tracer.buildSpan("root").start()
def span = tracer.buildSpan("datadog", "root").start()
if (tagName) {
span.setTag(tagName, tagValue)
}
Expand All @@ -91,7 +91,7 @@ class ForcePrioritySamplerTest extends DDCoreSpecification {
setup:
def sampler = new ForcePrioritySampler(SAMPLER_KEEP, DEFAULT)
def tracer = tracerBuilder().writer(new LoggingWriter()).sampler(sampler).build()
def span = tracer.buildSpan("root").start()
def span = tracer.buildSpan("datadog", "root").start()
if (tagName) {
span.setTag(tagName, tagValue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
when:
String response = '{"rate_by_service": {"service:spock,env:test":0.0}}'
serviceSampler.onResponse("traces", serializer.fromJson(response))
DDSpan span1 = tracer.buildSpan("fakeOperation")
DDSpan span1 = tracer.buildSpan("datadog", "fakeOperation")
.withServiceName("foo")
.withTag("env", "bar")
.ignoreActiveSpan().start()
Expand All @@ -106,7 +106,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
response = '{"rate_by_service": {"service:spock,env:test":1.0, "service:SPOCK,env:Test": 0.0}}'
serviceSampler.onResponse("traces", serializer.fromJson(response))

DDSpan span2 = tracer.buildSpan("fakeOperation")
DDSpan span2 = tracer.buildSpan("datadog", "fakeOperation")
.withServiceName("spock")
.withTag("env", "test")
.ignoreActiveSpan().start()
Expand All @@ -129,7 +129,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
def response = '{"rate_by_service": {"service:spock,env:test":1.0}}'
serviceSampler.onResponse("traces", serializer.fromJson(response))

DDSpan span = tracer.buildSpan("fakeOperation")
DDSpan span = tracer.buildSpan("datadog", "fakeOperation")
.withServiceName("SPOCK")
.withTag("env", "Test")
.ignoreActiveSpan().start()
Expand All @@ -151,7 +151,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
serviceSampler.onResponse("traces", serializer.fromJson(response))

when:
DDSpan span = tracer.buildSpan("fakeOperation")
DDSpan span = tracer.buildSpan("datadog", "fakeOperation")
.withServiceName("spock")
.withTag("env", "test")
.ignoreActiveSpan().start()
Expand All @@ -176,7 +176,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
.fromJson('{"rate_by_service":{"service:,env:":1.0,"service:spock,env:":0.0}}'))

when:
def span = tracer.buildSpan("test").start()
def span = tracer.buildSpan("datadog", "test").start()

then:
span.getSamplingPriority() == null
Expand All @@ -190,7 +190,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
span.getSamplingPriority() == PrioritySampling.SAMPLER_DROP

when:
span = tracer.buildSpan("test").withTag(DDTags.SERVICE_NAME, "spock").start()
span = tracer.buildSpan("datadog", "test").withTag(DDTags.SERVICE_NAME, "spock").start()
span.finish()
writer.waitForTraces(2)

Expand All @@ -205,7 +205,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
when:
def sampler = new RateByServiceTraceSampler()
def tracer = tracerBuilder().writer(new LoggingWriter()).sampler(sampler).build()
def span = tracer.buildSpan("root").start()
def span = tracer.buildSpan("datadog", "root").start()
if (tagName) {
span.setTag(tagName, tagValue)
}
Expand Down Expand Up @@ -392,7 +392,7 @@ class RateByServiceTraceSamplerTest extends DDCoreSpecification {
setup:
def sampler = new RateByServiceTraceSampler()
def tracer = tracerBuilder().writer(new LoggingWriter()).sampler(sampler).build()
def span = tracer.buildSpan("root").start()
def span = tracer.buildSpan("datadog", "root").start()
if (tagName) {
span.setTag(tagName, tagValue)
}
Expand Down
Loading
Loading