Skip to content

Introducing an internal integration name #8708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .circleci/config.continue.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation
debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"

default_system_tests_commit: &default_system_tests_commit 380d8deb4dd86369e30827ae3d908400c91d2d3e
default_system_tests_commit: &default_system_tests_commit 121787cbd6b3e5bc2840a0d5df17ecfb45566837

parameters:
nightly:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public AgentSpan afterStart(final AgentSpan span) {
if (spanType() != null) {
span.setSpanType(spanType());
}
span.setTag(Tags.COMPONENT, component());
final CharSequence component = component();
span.setTag(Tags.COMPONENT, component);
span.context().setIntegrationName(component);
if (traceAnalyticsEnabled) {
span.setMetric(DDTags.ANALYTICS_SAMPLE_RATE, traceAnalyticsSampleRate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datadog.trace.bootstrap.instrumentation.decorator


import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
import datadog.trace.bootstrap.instrumentation.api.ErrorPriorities
import datadog.trace.bootstrap.instrumentation.api.Tags
import datadog.trace.test.util.DDSpecification
Expand All @@ -16,6 +17,7 @@ class BaseDecoratorTest extends DDSpecification {
def errorPriority = null as Byte

def span = Mock(AgentSpan)
def spanContext = Mock(AgentSpanContext)

def "test afterStart"() {
when:
Expand All @@ -24,6 +26,8 @@ class BaseDecoratorTest extends DDSpecification {
then:
1 * span.setSpanType(decorator.spanType())
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setIntegrationName("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 @@ -2,6 +2,7 @@ package datadog.trace.bootstrap.instrumentation.decorator

import datadog.trace.api.DDTags
import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
import datadog.trace.bootstrap.instrumentation.api.Tags

class ClientDecoratorTest extends BaseDecoratorTest {
Expand All @@ -11,6 +12,7 @@ class ClientDecoratorTest extends BaseDecoratorTest {
def "test afterStart"() {
setup:
def decorator = newDecorator((String) serviceName)
def spanContext = Mock(AgentSpanContext)

when:
decorator.afterStart(span)
Expand All @@ -21,6 +23,8 @@ class ClientDecoratorTest extends BaseDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setIntegrationName("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 @@ -24,6 +24,8 @@ class DBTypeProcessingDatabaseClientDecoratorTest extends ClientDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setIntegrationName("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 @@ -2,6 +2,7 @@ package datadog.trace.bootstrap.instrumentation.decorator

import datadog.trace.api.DDTags
import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
import datadog.trace.bootstrap.instrumentation.api.Tags

import static datadog.trace.api.config.TraceInstrumentationConfig.DB_CLIENT_HOST_SPLIT_BY_HOST
Expand All @@ -15,6 +16,7 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
def "test afterStart"() {
setup:
def decorator = newDecorator((String) serviceName)
def spanContext = Mock(AgentSpanContext)

when:
decorator.afterStart(span)
Expand All @@ -25,6 +27,8 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setIntegrationName("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 @@ -2,6 +2,7 @@ package datadog.trace.bootstrap.instrumentation.decorator


import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext

import static datadog.trace.api.DDTags.ANALYTICS_SAMPLE_RATE
import static datadog.trace.api.DDTags.LANGUAGE_TAG_KEY
Expand All @@ -15,12 +16,16 @@ class ServerDecoratorTest extends BaseDecoratorTest {

def "test afterStart"() {
def decorator = newDecorator()
def spanContext = Mock(AgentSpanContext)

when:
decorator.afterStart(span)

then:
1 * span.setTag(LANGUAGE_TAG_KEY, LANGUAGE_TAG_VALUE)
1 * span.setTag(COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * spanContext.setIntegrationName("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,6 +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().setIntegrationName(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 @@ -3,23 +3,27 @@ package datadog.trace.civisibility.decorator
import datadog.trace.api.DDTags
import datadog.trace.api.sampling.PrioritySampling
import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
import datadog.trace.bootstrap.instrumentation.api.Tags
import spock.lang.Specification

class TestDecoratorImplTest extends Specification {

def span = Mock(AgentSpan)
def context = Mock(AgentSpanContext)


def "test afterStart"() {
setup:
def decorator = new TestDecoratorImpl("test-component", "session-name", "test-command", ["ci-tag-1": "value", "ci-tag-2": "another value"])

when:
decorator.afterStart(span)

then:
1 * span.setTag(Tags.TEST_SESSION_NAME, "session-name")
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> context
1 * context.setIntegrationName("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 @@ -44,6 +48,8 @@ class TestDecoratorImplTest extends Specification {
decorator.afterStart(span)

then:
1 * span.context() >> context
1 * context.setIntegrationName("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 @@ -12,7 +12,7 @@ abstract class CiVisibilitySmokeTest extends Specification {
def baseTemplatesPath = CiVisibilitySmokeTest.classLoader.getResource(projectName).toURI().schemeSpecificPart.replace('build/resources/test', 'src/test/resources')
CiVisibilityTestUtils.generateTemplates(baseTemplatesPath, events, coverages, additionalReplacements)
} else {
CiVisibilityTestUtils.assertData(projectName, events, coverages, additionalReplacements, [])
CiVisibilityTestUtils.assertData(projectName, events, coverages, additionalReplacements,["content.meta.['_dd.integration']"])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ abstract class CiVisibilityTestUtils {
]

// ignored tags on assertion and fixture build
static final List<String> IGNORED_TAGS = LibraryCapability.values().toList().stream().map(c -> "content.meta.['${c.asTag()}']").collect(Collectors.toList())
static final List<String> IGNORED_TAGS = LibraryCapability.values().toList().stream().map(c -> "content.meta.['${c.asTag()}']").collect(Collectors.toList()) +
["content.meta.['_dd.integration']"]

static final List<DynamicPath> COVERAGE_DYNAMIC_PATHS = [path("test_session_id"), path("test_suite_id"), path("span_id"),]

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

public static Span invalid() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class CxfContextPropagationTest extends AgentTestRunner {
"$InstrumentationTags.SERVLET_PATH" "/test"
"$Tags.HTTP_USER_AGENT" String
"$Tags.HTTP_CLIENT_IP" "127.0.0.1"
withCustomIntegrationName("jetty-server")
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class CxfContextPropagationTest extends AgentTestRunner {
"servlet.path" { it == null || it == "/test" }
"$Tags.HTTP_USER_AGENT" String
"$Tags.HTTP_CLIENT_IP" "127.0.0.1"
withCustomIntegrationName("jetty-server")
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static AgentScope onEnter(
return null;
}
final AgentSpan span = startSpan("view.render").setTag(Tags.COMPONENT, "dropwizard-view");
span.context().setIntegrationName("dropwizard-view");
span.setResourceName("View " + view.getTemplateName());
return activateSpan(span);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class DropwizardTest extends HttpServerTest<DropwizardTestSupport> {
return "/${endpoint.relativeRawPath()}"
}

@Override
String expectedIntegrationName() {
"java-web-servlet"
}

@Override
boolean hasHandlerSpan() {
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class FinatraServer270Test extends HttpServerTest<HttpServer> {
}
}

@Override
String expectedIntegrationName() {
"netty"
}

@Override
HttpServer startServer(int port) {
HttpServer testServer = new FinatraServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ abstract class FinatraServerTest extends HttpServerTest<HttpServer> {
return false
}

@Override
String expectedIntegrationName() {
"netty"
}

void handlerSpan(TraceAssert trace, ServerEndpoint endpoint = SUCCESS) {
def errorEndpoint = endpoint == EXCEPTION || endpoint == ERROR
trace.span {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class JakartaRsAnnotations3InstrumentationTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jakarta-rs"
"$Tags.HTTP_ROUTE" name.split(" ").last()
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +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().setIntegrationName("subprocess");
ProcessImplInstrumentationHelpers.setTags(span, command);
ProcessImplInstrumentationHelpers.cmdiRaspCheck(command);
return span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class JaxRsAnnotations1InstrumentationTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" name.split(" ").last()
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class JerseyTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" expectedResourceName.split(" ").last()
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down Expand Up @@ -78,6 +79,7 @@ class JerseyTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" parentResourceName.split(" ").last()
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class NestedResourcesTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" "/admin/realms"
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class JaxRsAnnotations2InstrumentationTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" name.split(" ").last()
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ abstract class JaxRsFilterTest extends AgentTestRunner {
if (httpRoute) {
"$Tags.HTTP_ROUTE" httpRoute
}
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down Expand Up @@ -123,6 +124,7 @@ abstract class JaxRsFilterTest extends AgentTestRunner {
tags {
"$Tags.COMPONENT" "jax-rs"
"$Tags.HTTP_ROUTE" resource
withCustomIntegrationName(null)
defaultTags()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ private AgentSpan withQueryInfo(AgentSpan span, DBQueryInfo info, CharSequence c
} else {
span.setResourceName(DB_QUERY);
}
span.context().setIntegrationName(component);
return span.setTag(Tags.COMPONENT, component);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +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().setIntegrationName("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 @@ -5,6 +5,7 @@
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.netty38.server.NettyHttpServerDecorator.DECORATE;
import static datadog.trace.instrumentation.netty38.server.NettyHttpServerDecorator.NETTY;
import static datadog.trace.instrumentation.netty38.server.NettyHttpServerDecorator.NETTY_CONNECT;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand Down Expand Up @@ -107,6 +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().setIntegrationName(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 @@ -5,6 +5,7 @@
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.netty40.AttributeKeys.CONNECT_PARENT_CONTINUATION_ATTRIBUTE_KEY;
import static datadog.trace.instrumentation.netty40.server.NettyHttpServerDecorator.NETTY;
import static datadog.trace.instrumentation.netty40.server.NettyHttpServerDecorator.NETTY_CONNECT;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand Down Expand Up @@ -92,6 +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().setIntegrationName(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 @@ -5,6 +5,7 @@
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.netty41.AttributeKeys.CONNECT_PARENT_CONTINUATION_ATTRIBUTE_KEY;
import static datadog.trace.instrumentation.netty41.server.NettyHttpServerDecorator.NETTY;
import static datadog.trace.instrumentation.netty41.server.NettyHttpServerDecorator.NETTY_CONNECT;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand Down Expand Up @@ -92,6 +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().setIntegrationName(NETTY);
try (final AgentScope scope = activateSpan(errorSpan)) {
NettyHttpServerDecorator.DECORATE.onError(errorSpan, cause);
NettyHttpServerDecorator.DECORATE.beforeFinish(errorSpan);
Expand Down
Loading
Loading