Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Rename to instrumentationName
  • Loading branch information
amarziali committed May 6, 2025
commit faec1e8b5a56ee70cc8ac2e173f6578056c979f8
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public AgentSpan afterStart(final AgentSpan span) {
}
final CharSequence component = component();
span.setTag(Tags.COMPONENT, component);
span.context().setInstrumentationComponentName(component);
span.context().setInstrumentationName(component);
if (traceAnalyticsEnabled) {
span.setMetric(DDTags.ANALYTICS_SAMPLE_RATE, traceAnalyticsSampleRate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BaseDecoratorTest extends DDSpecification {
1 * span.setSpanType(decorator.spanType())
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setInstrumentationComponentName("test-component")
1 * spanContext.setInstrumentationName("test-component")
_ * span.setTag(_, _) // Want to allow other calls from child implementations.
_ * span.setMeasured(true)
_ * span.setMetric(_, _)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClientDecoratorTest extends BaseDecoratorTest {
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setInstrumentationComponentName("test-component")
1 * spanContext.setInstrumentationName("test-component")
1 * span.setTag(Tags.SPAN_KIND, "client")
1 * span.setSpanType(decorator.spanType())
1 * span.setMetric(DDTags.ANALYTICS_SAMPLE_RATE, 1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DBTypeProcessingDatabaseClientDecoratorTest extends ClientDecoratorTest {
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setInstrumentationComponentName("test-component")
1 * spanContext.setInstrumentationName("test-component")
1 * span.setTag(Tags.SPAN_KIND, "client")
1 * span.setSpanType("test-type")
1 * span.setServiceName("test-db")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setInstrumentationComponentName("test-component")
1 * spanContext.setInstrumentationName("test-component")
1 * span.setTag(Tags.SPAN_KIND, "client")
1 * span.setSpanType("test-type")
1 * span.setMetric(DDTags.ANALYTICS_SAMPLE_RATE, 1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ServerDecoratorTest extends BaseDecoratorTest {
1 * span.setTag(LANGUAGE_TAG_KEY, LANGUAGE_TAG_VALUE)
1 * span.setTag(COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setInstrumentationComponentName("test-component")
1 * spanContext.setInstrumentationName("test-component")
1 * span.setTag(SPAN_KIND, "server")
1 * span.setSpanType(decorator.spanType())
if (decorator.traceAnalyticsEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public AgentSpan afterStart(final AgentSpan span) {
span.setTag(DDTags.HOST_VCPU_COUNT, cpuCount);
span.setTag(Tags.TEST_TYPE, testType());
span.setTag(Tags.COMPONENT, component());
span.context().setInstrumentationComponentName(component());
span.context().setInstrumentationName(component());
span.setTag(Tags.TEST_SESSION_NAME, sessionName);

for (final Map.Entry<String, String> ciTag : ciTags.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestDecoratorImplTest extends Specification {
1 * span.setTag(Tags.TEST_SESSION_NAME, "session-name")
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> context
1 * context.setInstrumentationComponentName("test-component")
1 * context.setInstrumentationName("test-component")
1 * span.setTag(Tags.TEST_TYPE, decorator.testType())
1 * span.setSamplingPriority(PrioritySampling.SAMPLER_KEEP)
1 * span.setTag(DDTags.ORIGIN_KEY, decorator.origin())
Expand All @@ -49,7 +49,7 @@ class TestDecoratorImplTest extends Specification {

then:
1 * span.context() >> context
1 * context.setInstrumentationComponentName("test-component")
1 * context.setInstrumentationName("test-component")
1 * span.setTag(Tags.TEST_SESSION_NAME, expectedSessionName)

where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public OtelSpan(AgentSpan delegate) {
}
this.statusCode = UNSET;
this.recording = true;
delegate.context().setInstrumentationComponentName("otel");
delegate.context().setInstrumentationName("otel");
}

public static Span invalid() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static AgentScope onEnter(
return null;
}
final AgentSpan span = startSpan("view.render").setTag(Tags.COMPONENT, "dropwizard-view");
span.context().setInstrumentationComponentName("dropwizard-view");
span.context().setInstrumentationName("dropwizard-view");
span.setResourceName("View " + view.getTemplateName());
return activateSpan(span);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static AgentSpan startSpan(@Advice.Argument(0) final String[] command) th
span.setSpanType("system");
span.setResourceName(ProcessImplInstrumentationHelpers.determineResource(command));
span.setTag("component", "subprocess");
span.context().setInstrumentationComponentName("subprocess");
span.context().setInstrumentationName("subprocess");
ProcessImplInstrumentationHelpers.setTags(span, command);
ProcessImplInstrumentationHelpers.cmdiRaspCheck(command);
return span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private AgentSpan withQueryInfo(AgentSpan span, DBQueryInfo info, CharSequence c
} else {
span.setResourceName(DB_QUERY);
}
span.context().setInstrumentationComponentName(component);
span.context().setInstrumentationName(component);
return span.setTag(Tags.COMPONENT, component);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public boolean beforeStep(Step step, ScenarioRuntime sr) {
String stepName = step.getPrefix() + " " + step.getText();
span.setResourceName(stepName);
span.setTag(Tags.COMPONENT, "karate");
span.context().setInstrumentationComponentName("karate");
span.context().setInstrumentationName("karate");
span.setTag("step.name", stepName);
span.setTag("step.startLine", step.getLine());
span.setTag("step.endLine", step.getEndLine());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static AgentScope activateScope(@Advice.Argument(0) final ChannelFuture f
final AgentScope parentScope = continuation.activate();

final AgentSpan errorSpan = startSpan(NETTY_CONNECT).setTag(Tags.COMPONENT, "netty");
errorSpan.context().setInstrumentationComponentName(NETTY);
errorSpan.context().setInstrumentationName(NETTY);
try (final AgentScope scope = activateSpan(errorSpan)) {
DECORATE.onError(errorSpan, cause);
DECORATE.beforeFinish(errorSpan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static AgentScope activateScope(@Advice.Argument(0) final ChannelFuture f
final AgentScope parentScope = continuation.activate();

final AgentSpan errorSpan = startSpan(NETTY_CONNECT).setTag(Tags.COMPONENT, "netty");
errorSpan.context().setInstrumentationComponentName(NETTY);
errorSpan.context().setInstrumentationName(NETTY);
try (final AgentScope scope = activateSpan(errorSpan)) {
NettyHttpServerDecorator.DECORATE.onError(errorSpan, cause);
NettyHttpServerDecorator.DECORATE.beforeFinish(errorSpan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static AgentScope activateScope(@Advice.Argument(0) final ChannelFuture f
final AgentScope parentScope = continuation.activate();

final AgentSpan errorSpan = startSpan(NETTY_CONNECT).setTag(Tags.COMPONENT, "netty");
errorSpan.context().setInstrumentationComponentName(NETTY);
errorSpan.context().setInstrumentationName(NETTY);
try (final AgentScope scope = activateSpan(errorSpan)) {
NettyHttpServerDecorator.DECORATE.onError(errorSpan, cause);
NettyHttpServerDecorator.DECORATE.beforeFinish(errorSpan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public Span.Builder setStartTimestamp(final long startTimestamp) {
@Override
public Span startSpan() {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("otel");
agentSpan.context().setInstrumentationName("otel");
return converter.toSpan(agentSpan);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class OpenTelemetryTest extends AgentTestRunner {
}
defaultTags()
}
assert span.context().instrumentationComponentName == "otel"
assert span.context().instrumentationName == "otel"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class OpenTelemetry14Test extends AgentTestRunner {
"empty-array" ""
}
}
assert span.context().instrumentationComponentName == "otel"
assert span.context().instrumentationName == "otel"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ public Span startManual() {
@Override
public Span start() {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
agentSpan.context().setInstrumentationName("opentracing");
return converter.toSpan(agentSpan);
}

@Override
public Scope startActive(final boolean finishSpanOnClose) {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
agentSpan.context().setInstrumentationName("opentracing");
return converter.toScope(tracer.activateManualSpan(agentSpan), finishSpanOnClose);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import spock.lang.Subject

import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopContinuation
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled

class OpenTracing31Test extends AgentTestRunner {

Expand Down Expand Up @@ -113,7 +112,7 @@ class OpenTracing31Test extends AgentTestRunner {
}
defaultTags(addReference != null)
}
assert span.context().instrumentationComponentName == "opentracing"
assert span.context().instrumentationName == "opentracing"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ public Span startManual() {
@Override
public Span start() {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
agentSpan.context().setInstrumentationName("opentracing");
return converter.toSpan(agentSpan);
}

@Override
public Scope startActive(final boolean finishSpanOnClose) {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
agentSpan.context().setInstrumentationName("opentracing");
return converter.toScope(tracer.activateManualSpan(agentSpan), finishSpanOnClose);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import static datadog.trace.api.sampling.SamplingMechanism.AGENT_RATE
import static datadog.trace.api.sampling.SamplingMechanism.DEFAULT
import static datadog.trace.api.sampling.SamplingMechanism.MANUAL
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopContinuation
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled

class OpenTracing32Test extends AgentTestRunner {

Expand Down Expand Up @@ -118,7 +117,7 @@ class OpenTracing32Test extends AgentTestRunner {
}
defaultTags(addReference != null)
}
assert span.context().instrumentationComponentName == "opentracing"
assert span.context().instrumentationName == "opentracing"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public <T> AgentSpan startAndDecorateSpanForStatement(
span.setResourceName(DB_QUERY);
}
span.setTag(Tags.COMPONENT, component);
span.context().setInstrumentationComponentName(component);
span.context().setInstrumentationName(component);
return span;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class DDSpanContext
private final UTF8BytesString threadName;

private volatile short httpStatusCode;
private CharSequence instrumentationComponentName;
private CharSequence instrumentationName;

/**
* Tags are associated to the current span, they will not propagate to the children span.
Expand Down Expand Up @@ -882,12 +882,12 @@ public void processTagsAndBaggage(
}

@Override
public void setInstrumentationComponentName(CharSequence componentName) {
this.instrumentationComponentName = componentName;
public void setInstrumentationName(CharSequence componentName) {
this.instrumentationName = componentName;
}

public CharSequence getInstrumentationComponentName() {
return instrumentationComponentName;
public CharSequence getInstrumentationName() {
return instrumentationName;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class InstrumentationComponentAdder implements TagsPostProcessor {
@Override
public Map<String, Object> processTags(
Map<String, Object> unsafeTags, DDSpanContext spanContext, List<AgentSpanLink> spanLinks) {
final CharSequence internalComponentName = spanContext.getInstrumentationComponentName();
final CharSequence internalComponentName = spanContext.getInstrumentationName();
if (internalComponentName != null) {
unsafeTags.put(DD_INTEGRATION, internalComponentName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class InstrumentationComponentAdderTest extends DDSpecification {
def enrichedTags = calculator.processTags(["_dd.integration": "bad"], spanContext, [])

then:
1 * spanContext.getInstrumentationComponentName() >> (isSet ? "test" : null)
1 * spanContext.getInstrumentationName() >> (isSet ? "test" : null)

and:
assert enrichedTags == (isSet ? ["_dd.integration": "test"] : [:])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ public Span startManual() {
@Override
public Span start() {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
agentSpan.context().setInstrumentationName("opentracing");
return converter.toSpan(agentSpan);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface AgentSpanContext {

default void mergePathwayContext(PathwayContext pathwayContext) {}

default void setInstrumentationComponentName(CharSequence componentName) {}
default void setInstrumentationName(CharSequence componentName) {}

/**
* Gets whether the span context used is part of the local trace or from another service
Expand Down