diff --git a/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java b/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java index 576488938fe0..69ac194aa558 100644 --- a/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java +++ b/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java @@ -52,7 +52,7 @@ public void springBootSmokeTestOnJDK() throws IOException, InterruptedException Assertions.assertEquals(1, countSpansByName(traces, "WebController.withSpan")); Assertions.assertEquals(2, countSpansByAttributeValue(traces, "custom", "demo")); Assertions.assertNotEquals( - 0, countResourcesByValue(traces, "telemetry.auto.version", currentAgentVersion)); + 0, countResourcesByValue(traces, "telemetry.distro.version", currentAgentVersion)); Assertions.assertNotEquals(0, countResourcesByValue(traces, "custom.resource", "demo")); stopTarget(); diff --git a/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java b/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java index c320031344d5..fe124f40b767 100644 --- a/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java +++ b/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java @@ -76,7 +76,7 @@ private void testAndVerify() throws IOException, InterruptedException { Assertions.assertEquals(1, countSpansByName(traces, "WebController.withSpan")); Assertions.assertEquals(2, countSpansByAttributeValue(traces, "custom", "demo")); Assertions.assertNotEquals( - 0, countResourcesByValue(traces, "telemetry.auto.version", currentAgentVersion)); + 0, countResourcesByValue(traces, "telemetry.distro.version", currentAgentVersion)); Assertions.assertNotEquals(0, countResourcesByValue(traces, "custom.resource", "demo")); } } diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AutoVersionResourceProvider.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/DistroVersionResourceProvider.java similarity index 53% rename from javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AutoVersionResourceProvider.java rename to javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/DistroVersionResourceProvider.java index 4010f191da29..cedf577ece40 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AutoVersionResourceProvider.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/DistroVersionResourceProvider.java @@ -13,15 +13,22 @@ import io.opentelemetry.sdk.resources.Resource; @AutoService(ResourceProvider.class) -public class AutoVersionResourceProvider implements ResourceProvider { +public class DistroVersionResourceProvider implements ResourceProvider { - private static final AttributeKey TELEMETRY_AUTO_VERSION = - AttributeKey.stringKey("telemetry.auto.version"); + private static final AttributeKey TELEMETRY_DISTRO_NAME = + AttributeKey.stringKey("telemetry.distro.name"); + private static final AttributeKey TELEMETRY_DISTRO_VERSION = + AttributeKey.stringKey("telemetry.distro.version"); @Override public Resource createResource(ConfigProperties config) { return AgentVersion.VERSION == null ? Resource.empty() - : Resource.create(Attributes.of(TELEMETRY_AUTO_VERSION, AgentVersion.VERSION)); + : Resource.create( + Attributes.of( + TELEMETRY_DISTRO_NAME, + "opentelemetry-java-instrumentation", + TELEMETRY_DISTRO_VERSION, + AgentVersion.VERSION)); } } diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy index faf55ebf4f7f..81f23842bffa 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy @@ -6,7 +6,6 @@ package io.opentelemetry.smoketest import io.opentelemetry.proto.trace.v1.Span -import io.opentelemetry.semconv.ResourceAttributes import io.opentelemetry.semconv.SemanticAttributes import spock.lang.Shared import spock.lang.Unroll @@ -28,6 +27,8 @@ abstract class AppServerTest extends SmokeTest { @Shared boolean isWindows + private static final String TELEMETRY_DISTRO_VERSION = "telemetry.distro.version" + def setupSpec() { (serverVersion, jdk) = getAppServer() isWindows = System.getProperty("os.name").toLowerCase().contains("windows") && @@ -126,7 +127,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.NETWORK_PROTOCOL_VERSION.key, "1.1") == 3 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == 3 + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == 3 and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == 3 @@ -161,7 +162,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.URL_PATH.key, "/app/hello.txt") == 1 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == 1 + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == 1 and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == 1 @@ -195,7 +196,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.URL_PATH.key, "/app/file-that-does-not-exist") == 1 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == traces.countSpans() + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == traces.countSpans() and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == traces.countSpans() @@ -234,7 +235,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.NETWORK_PROTOCOL_VERSION.key, "1.1") == 1 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == traces.countSpans() + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == traces.countSpans() and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == traces.countSpans() @@ -273,7 +274,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.URL_PATH.key, "/app/exception") == 1 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == traces.countSpans() + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == traces.countSpans() and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == traces.countSpans() @@ -311,7 +312,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.NETWORK_PROTOCOL_VERSION.key, "1.1") == 1 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == traces.countSpans() + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == traces.countSpans() and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == traces.countSpans() @@ -358,7 +359,7 @@ abstract class AppServerTest extends SmokeTest { traces.countFilteredAttributes(SemanticAttributes.NETWORK_PROTOCOL_VERSION.key, "1.1") == 3 and: "Number of spans tagged with current otel library version" - traces.countFilteredResourceAttributes(ResourceAttributes.TELEMETRY_AUTO_VERSION.key, currentAgentVersion) == 3 + traces.countFilteredResourceAttributes(TELEMETRY_DISTRO_VERSION, currentAgentVersion) == 3 and: "Number of spans tagged with expected OS type" traces.countFilteredResourceAttributes(OS_TYPE.key, isWindows ? WINDOWS : LINUX) == 3 diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy index 63db1e8c2e31..66c3970353ba 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy @@ -51,7 +51,7 @@ class GrpcSmokeTest extends SmokeTest { countSpansByName(traces, 'opentelemetry.proto.collector.trace.v1.TraceService/Export') == 1 countSpansByName(traces, 'TestService.withSpan') == 1 - [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.auto.version") + [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.distro.version") .map { it.stringValue } .collect(toSet()) diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/QuarkusSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/QuarkusSmokeTest.groovy index d6b380771428..02e42ab2619d 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/QuarkusSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/QuarkusSmokeTest.groovy @@ -43,7 +43,7 @@ class QuarkusSmokeTest extends SmokeTest { countSpansByName(traces, 'GET /hello') == 1 countSpansByName(traces, 'HelloResource.hello') == 1 - [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.auto.version") + [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.distro.version") .map { it.stringValue } .collect(toSet()) diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy index 4e4b36ef236e..9c5ec325889b 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy @@ -60,7 +60,7 @@ class SpringBootSmokeTest extends SmokeTest { .allMatch { it.attributesList.stream().map { it.key }.collect(toSet()).containsAll(["thread.id", "thread.name"]) } then: "correct agent version is captured in the resource" - [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.auto.version") + [currentAgentVersion] as Set == findResourceAttribute(traces, "telemetry.distro.version") .map { it.stringValue } .collect(toSet())