rename telemetry.auto.version to telemetry.distro.version and add telemetry.distro.name (#9065)
Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
This commit is contained in:
parent
bede684adc
commit
1a054a53ad
|
@ -52,7 +52,7 @@ class SpringBootSmokeTest extends SmokeTest {
|
|||
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();
|
||||
|
|
|
@ -76,7 +76,7 @@ class SpringBootIntegrationTest extends IntegrationTest {
|
|||
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"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,15 +13,22 @@ import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
|
|||
import io.opentelemetry.sdk.resources.Resource;
|
||||
|
||||
@AutoService(ResourceProvider.class)
|
||||
public class AutoVersionResourceProvider implements ResourceProvider {
|
||||
public class DistroVersionResourceProvider implements ResourceProvider {
|
||||
|
||||
private static final AttributeKey<String> TELEMETRY_AUTO_VERSION =
|
||||
AttributeKey.stringKey("telemetry.auto.version");
|
||||
private static final AttributeKey<String> TELEMETRY_DISTRO_NAME =
|
||||
AttributeKey.stringKey("telemetry.distro.name");
|
||||
private static final AttributeKey<String> 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));
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
Loading…
Reference in New Issue