diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 02982ee4c..1ab60c2a2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,11 +8,12 @@ groovy = "4.0.17" spock = "2.3-groovy-4.0" managed-brave-instrumentation = '6.0.2' -managed-opentelemetry = '1.36.0' -managed-opentelemetry-alpha = '1.36.0-alpha' -managed-opentelemetry-instrumentation = '1.33.1' -managed-opentelemetry-instrumentation-alpha = '1.33.1-alpha' +managed-opentelemetry = '1.41.0' +managed-opentelemetry-alpha = '1.41.0-alpha' +managed-opentelemetry-instrumentation = '2.7.0' +managed-opentelemetry-instrumentation-alpha = '2.7.0-alpha' managed-opentelemetry-contrib-aws-xray = '1.34.0' +managed-opentelemetry-contrib-aws-xray-propagation = '1.34.0-alpha' managed-opentelemetry-contrib-aws-resources = '1.31.0-alpha' managed-opentelemetry-gcp-trace = '0.27.0-alpha' managed-opentelemetry-semconv = '1.21.0-alpha' @@ -44,6 +45,7 @@ micronaut-gradle-plugin = "4.3.6" micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' } managed-opentelemetry-contrib-aws-xray = { module = 'io.opentelemetry.contrib:opentelemetry-aws-xray', version.ref = 'managed-opentelemetry-contrib-aws-xray'} +managed-opentelemetry-contrib-aws-xray-propagator = { module = 'io.opentelemetry.contrib:opentelemetry-aws-xray-propagator', version.ref = 'managed-opentelemetry-contrib-aws-xray-propagation'} managed-opentelemetry-contrib-aws-resources = { module = 'io.opentelemetry.contrib:opentelemetry-aws-resources', version.ref = 'managed-opentelemetry-contrib-aws-resources'} managed-opentelemetry-gcp-trace = { module = 'com.google.cloud.opentelemetry:exporter-auto', version.ref = 'managed-opentelemetry-gcp-trace'} @@ -75,16 +77,16 @@ zipkin-reporter = { module = 'io.zipkin.reporter2:zipkin-reporter' } zipkin-reporter-brave = { module = 'io.zipkin.reporter2:zipkin-reporter-brave' } opentelemetry-api = { module = 'io.opentelemetry:opentelemetry-api' } -opentelemetry-api-events = { module = 'io.opentelemetry:opentelemetry-api-events' } +opentelemetry-api-incubator = { module = 'io.opentelemetry:opentelemetry-api-incubator' } opentelemetry-sdk = { module = 'io.opentelemetry:opentelemetry-sdk' } opentelemetry-sdk-testing = { module = 'io.opentelemetry:opentelemetry-sdk-testing' } opentelemetry-autoconfigure = { module = 'io.opentelemetry:opentelemetry-sdk-extension-autoconfigure' } opentelemetry-exporter-zipkin = { module = 'io.opentelemetry:opentelemetry-exporter-zipkin', version.ref = 'managed-opentelemetry' } opentelemetry-instrumentation-api = { module = 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-api' } +opentelemetry-instrumentation-api-incubator = { module = 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator' } opentelemetry-instrumentation-grpc = { module = 'io.opentelemetry.instrumentation:opentelemetry-grpc-1.6'} opentelemetry-instrumentation-kafka-common = { module = 'io.opentelemetry.instrumentation:opentelemetry-kafka-clients-common'} -opentelemetry-instrumentation-api-semconv = { module = 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv' } opentelemetry-instrumentation-semconv = { module = 'io.opentelemetry.semconv:opentelemetry-semconv', version.ref ='managed-opentelemetry-semconv' } opentelemetry-instrumentation-annotations = { module = 'io.opentelemetry.instrumentation: opentelemetry-instrumentation-annotations' } opentelemetry-aws-sdk = { module = 'io.opentelemetry.instrumentation:opentelemetry-aws-sdk-2.2' } diff --git a/test-suite-java/src/test/java/opentelemetry/HttpTracingTest.java b/test-suite-java/src/test/java/opentelemetry/HttpTracingTest.java index 4213fb0de..4e6a43443 100644 --- a/test-suite-java/src/test/java/opentelemetry/HttpTracingTest.java +++ b/test-suite-java/src/test/java/opentelemetry/HttpTracingTest.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter; import io.opentelemetry.sdk.trace.data.SpanData; +import io.opentelemetry.semconv.HttpAttributes; import jakarta.inject.Inject; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -29,7 +30,7 @@ public class HttpTracingTest { private HttpClient client; public static final String TRACING_ID = "X-TrackingId"; - public static final String TRACING_ID_IN_SPAN = "http.request.header.x_trackingid"; + public static final String TRACING_ID_IN_SPAN = HttpAttributes.HTTP_REQUEST_HEADER.getAttributeKey(TRACING_ID.toLowerCase()).getKey(); @Inject ReactorHttpClient reactorHttpClient; diff --git a/tracing-bom/build.gradle b/tracing-bom/build.gradle index 8e07b454c..c0e6906f0 100644 --- a/tracing-bom/build.gradle +++ b/tracing-bom/build.gradle @@ -44,10 +44,10 @@ micronautBom { "io.zipkin.proto3" ] as Set ) - dependencies.add("io.opentelemetry:opentelemetry-bom:1.36.0") - dependencies.add("io.opentelemetry:opentelemetry-bom-alpha:1.36.0-alpha") - dependencies.add("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:1.33.1") - dependencies.add("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.33.1-alpha") + dependencies.add("io.opentelemetry:opentelemetry-bom:1.41.0") + dependencies.add("io.opentelemetry:opentelemetry-bom-alpha:1.41.0-alpha") + dependencies.add("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:2.7.0") + dependencies.add("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:2.7.0-alpha") dependencies.add("io.zipkin.brave:brave-instrumentation-benchmarks:6.0.2") dependencies.add("io.zipkin.reporter2:zipkin-reporter-bom:3.3.0") } diff --git a/tracing-opentelemetry-http/build.gradle b/tracing-opentelemetry-http/build.gradle index aaa527c90..de840ad60 100644 --- a/tracing-opentelemetry-http/build.gradle +++ b/tracing-opentelemetry-http/build.gradle @@ -14,8 +14,7 @@ dependencies { api libs.opentelemetry.api api libs.opentelemetry.instrumentation.annotations api libs.opentelemetry.instrumentation.api - api libs.opentelemetry.instrumentation.api.semconv - api libs.opentelemetry.instrumentation.semconv + api libs.opentelemetry.instrumentation.api.incubator compileOnly mn.kotlinx.coroutines.core compileOnly mn.kotlinx.coroutines.reactor diff --git a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientAttributesGetter.java b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientAttributesGetter.java index bf67e8f70..b5ed7a20e 100644 --- a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientAttributesGetter.java +++ b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientAttributesGetter.java @@ -20,7 +20,7 @@ import io.micronaut.http.HttpResponse; import io.micronaut.http.HttpVersion; import io.micronaut.http.MutableHttpRequest; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter; +import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter; import java.util.List; import java.util.Map; diff --git a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientTelemetryFactory.java b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientTelemetryFactory.java index 1a6fd4dec..9382c577f 100644 --- a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientTelemetryFactory.java +++ b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/client/MicronautHttpClientTelemetryFactory.java @@ -22,17 +22,17 @@ import io.micronaut.http.HttpResponse; import io.micronaut.http.MutableHttpRequest; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor; +import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceResolver; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractorBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceAttributesExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder; +import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics; +import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceResolver; import jakarta.inject.Named; import jakarta.inject.Qualifier; diff --git a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerAttributesGetter.java b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerAttributesGetter.java index c9cae4dd6..5e8db5392 100644 --- a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerAttributesGetter.java +++ b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerAttributesGetter.java @@ -27,7 +27,7 @@ import io.micronaut.http.HttpVersion; import io.micronaut.http.uri.UriMatchTemplate; import io.micronaut.web.router.UriRouteInfo; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesGetter; +import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter; import static io.micronaut.http.HttpVersion.HTTP_1_0; import static io.micronaut.http.HttpVersion.HTTP_1_1; diff --git a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerTelemetryFactory.java b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerTelemetryFactory.java index db94d405b..0d8332dd6 100644 --- a/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerTelemetryFactory.java +++ b/tracing-opentelemetry-http/src/main/java/io/micronaut/tracing/opentelemetry/instrument/http/server/MicronautHttpServerTelemetryFactory.java @@ -25,12 +25,12 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractorBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerMetrics; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerRoute; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder; +import io.opentelemetry.instrumentation.api.semconv.http.HttpServerMetrics; +import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; +import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; +import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; import jakarta.inject.Named; import jakarta.inject.Qualifier; diff --git a/tracing-opentelemetry-http/src/test/groovy/io/micronaut/tracing/opentelemetry/instrument/http/OpenTelemetryHttpSpec.groovy b/tracing-opentelemetry-http/src/test/groovy/io/micronaut/tracing/opentelemetry/instrument/http/OpenTelemetryHttpSpec.groovy index b1819f3a0..cc54727f2 100644 --- a/tracing-opentelemetry-http/src/test/groovy/io/micronaut/tracing/opentelemetry/instrument/http/OpenTelemetryHttpSpec.groovy +++ b/tracing-opentelemetry-http/src/test/groovy/io/micronaut/tracing/opentelemetry/instrument/http/OpenTelemetryHttpSpec.groovy @@ -34,7 +34,8 @@ import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.annotations.SpanAttribute import io.opentelemetry.instrumentation.annotations.WithSpan import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter -import io.opentelemetry.semconv.SemanticAttributes +import io.opentelemetry.semconv.HttpAttributes +import io.opentelemetry.semconv.ServerAttributes import io.reactivex.Single import jakarta.inject.Inject import org.reactivestreams.Publisher @@ -55,7 +56,7 @@ import static io.micronaut.scheduling.TaskExecutors.IO class OpenTelemetryHttpSpec extends Specification { String TRACING_ID = "X-TrackingId" - String TRACING_ID_IN_SPAN = "http.request.header.x_trackingid" + String TRACING_ID_IN_SPAN = HttpAttributes.HTTP_REQUEST_HEADER.getAttributeKey(TRACING_ID.toLowerCase()).getKey() @AutoCleanup private ApplicationContext context @@ -102,10 +103,11 @@ class OpenTelemetryHttpSpec extends Specification { } void hasHttpSemanticAttributes(HttpStatus httpStatus, boolean hasRoute = true) { + def serverSpans = exporter.finishedSpanItems.findAll { it -> it.kind == SpanKind.SERVER } - assert serverSpans.every {it.attributes.stream().any { it.get(SemanticAttributes.HTTP_METHOD) }} - assert !hasRoute || serverSpans.every {it.attributes.stream().any { it.get(SemanticAttributes.HTTP_ROUTE) }} - assert serverSpans.every {it.attributes.stream().any {x -> Optional.ofNullable(x.get(SemanticAttributes.HTTP_STATUS_CODE)).map { it.intValue() == httpStatus.code }.orElse(false) }} + assert serverSpans.every {it.attributes.stream().any { it.get(HttpAttributes.HTTP_REQUEST_METHOD) }} + assert !hasRoute || serverSpans.every {it.attributes.stream().any { it.get(HttpAttributes.HTTP_ROUTE) }} + assert serverSpans.every {it.attributes.stream().any {x -> Optional.ofNullable(x.get(HttpAttributes.HTTP_RESPONSE_STATUS_CODE)).map { it.intValue() == httpStatus.code }.orElse(false) }} } void 'test map WithSpan annotation'() { @@ -245,7 +247,7 @@ class OpenTelemetryHttpSpec extends Specification { exporter.finishedSpanItems.name.contains("WarehouseClient.order") exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(AttributeKey.stringKey("warehouse.order")) == "{testOrderKey=testOrderValue}") exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(AttributeKey.stringKey("upc")) == "10") - exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(SemanticAttributes.NET_PEER_NAME) == "localhost") + exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(ServerAttributes.SERVER_ADDRESS) == "localhost") hasHttpSemanticAttributes(HttpStatus.OK) } @@ -266,7 +268,7 @@ class OpenTelemetryHttpSpec extends Specification { conditions.eventually { hasSpans(internalSpanCount, serverSpanCount, clientSpanCount) exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(AttributeKey.stringKey("warehouse.order")) == "{testOrderKey=testOrderValue}") - exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(SemanticAttributes.NET_PEER_NAME) == "correctspanname") + exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(ServerAttributes.SERVER_ADDRESS) == "correctspanname") } cleanup: @@ -332,7 +334,7 @@ class OpenTelemetryHttpSpec extends Specification { then: conditions.eventually { hasSpans(internalSpanCount, serverSpanCount, clientSpanCount) - exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(SemanticAttributes.HTTP_ROUTE) == "/client/order/{orderId}") + exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(HttpAttributes.HTTP_ROUTE) == "/client/order/{orderId}") hasHttpSemanticAttributes(HttpStatus.OK) } @@ -353,7 +355,7 @@ class OpenTelemetryHttpSpec extends Specification { then: conditions.eventually { hasSpans(internalSpanCount, serverSpanCount, clientSpanCount) - exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(SemanticAttributes.HTTP_ROUTE) == "/client/order/{orderId}") + exporter.finishedSpanItems.attributes.stream().anyMatch(x -> x.get(HttpAttributes.HTTP_ROUTE) == "/client/order/{orderId}") hasHttpSemanticAttributes(HttpStatus.OK) } diff --git a/tracing-opentelemetry-kafka/build.gradle b/tracing-opentelemetry-kafka/build.gradle index aef626770..5b9768b8f 100644 --- a/tracing-opentelemetry-kafka/build.gradle +++ b/tracing-opentelemetry-kafka/build.gradle @@ -10,7 +10,6 @@ dependencies { api projects.micronautTracingOpentelemetry api libs.opentelemetry.api api(mnKafka.micronaut.kafka) - api libs.opentelemetry.instrumentation.semconv api libs.opentelemetry.instrumentation.kafka.common testImplementation mnSerde.micronaut.serde.jackson diff --git a/tracing-opentelemetry-zipkin-exporter/src/test/groovy/io/micronaut/tracing/opentelemetry/exporter/zipkin/HttpClientSenderSpec.groovy b/tracing-opentelemetry-zipkin-exporter/src/test/groovy/io/micronaut/tracing/opentelemetry/exporter/zipkin/HttpClientSenderSpec.groovy index e83415636..0b24ab873 100644 --- a/tracing-opentelemetry-zipkin-exporter/src/test/groovy/io/micronaut/tracing/opentelemetry/exporter/zipkin/HttpClientSenderSpec.groovy +++ b/tracing-opentelemetry-zipkin-exporter/src/test/groovy/io/micronaut/tracing/opentelemetry/exporter/zipkin/HttpClientSenderSpec.groovy @@ -17,6 +17,8 @@ import io.micronaut.scheduling.TaskExecutors import io.micronaut.scheduling.annotation.ExecuteOn import io.micronaut.tracing.zipkin.http.client.HttpClientSender import io.opentelemetry.api.trace.Span +import io.opentelemetry.semconv.HttpAttributes +import io.opentelemetry.semconv.UrlAttributes import jakarta.inject.Inject import jakarta.inject.Singleton import org.reactivestreams.Publisher @@ -90,21 +92,21 @@ class HttpClientSenderSpec extends Specification { spanController.receivedSpans.size() == 4 spanController.receivedSpans[0].tags.get('foo') == 'bar' - spanController.receivedSpans[0].tags.get('http.target') == '/traced/hello/John' + spanController.receivedSpans[0].tags.get(UrlAttributes.URL_PATH.key) == '/traced/hello/John' spanController.receivedSpans[0].name == 'get /traced/hello/{name}' spanController.receivedSpans[0].kind == SERVER.name() - spanController.receivedSpans[1].tags.get('http.url').contains("/traced/hello/John") + spanController.receivedSpans[1].tags.get(UrlAttributes.URL_FULL.key).contains("/traced/hello/John") spanController.receivedSpans[1].name == 'get' spanController.receivedSpans[1].kind == CLIENT.name() spanController.receivedSpans[2].name == 'get /traced/nested/{name}' spanController.receivedSpans[2].kind == SERVER.name() - spanController.receivedSpans[2].tags.get('http.method') == 'GET' - spanController.receivedSpans[2].tags.get('http.target') == '/traced/nested/John' + spanController.receivedSpans[2].tags.get(HttpAttributes.HTTP_REQUEST_METHOD.key) == 'GET' + spanController.receivedSpans[2].tags.get(UrlAttributes.URL_PATH.key) == '/traced/nested/John' spanController.receivedSpans[3].tags.get('foo') == null - spanController.receivedSpans[3].tags.get('http.url').contains('/traced/nested/John') + spanController.receivedSpans[3].tags.get(UrlAttributes.URL_FULL.key).contains('/traced/nested/John') spanController.receivedSpans[3].name == 'get' spanController.receivedSpans[3].kind == CLIENT.name() } @@ -154,21 +156,21 @@ class HttpClientSenderSpec extends Specification { customPathSpanController.receivedSpans.size() == 4 customPathSpanController.receivedSpans[0].tags.get('foo') == 'bar' - customPathSpanController.receivedSpans[0].tags.get('http.target') == '/traced/hello/John' + customPathSpanController.receivedSpans[0].tags.get(UrlAttributes.URL_PATH.key) == '/traced/hello/John' customPathSpanController.receivedSpans[0].name == 'get /traced/hello/{name}' customPathSpanController.receivedSpans[0].kind == SERVER.name() - customPathSpanController.receivedSpans[1].tags.get('http.url').contains("/traced/hello/John") + customPathSpanController.receivedSpans[1].tags.get(UrlAttributes.URL_FULL.key).contains("/traced/hello/John") customPathSpanController.receivedSpans[1].name == 'get' customPathSpanController.receivedSpans[1].kind == CLIENT.name() customPathSpanController.receivedSpans[2].name == 'get /traced/nested/{name}' customPathSpanController.receivedSpans[2].kind == SERVER.name() - customPathSpanController.receivedSpans[2].tags.get('http.method') == 'GET' - customPathSpanController.receivedSpans[2].tags.get('http.target') == '/traced/nested/John' + customPathSpanController.receivedSpans[2].tags.get(HttpAttributes.HTTP_REQUEST_METHOD.key) == 'GET' + customPathSpanController.receivedSpans[2].tags.get(UrlAttributes.URL_PATH.key) == '/traced/nested/John' customPathSpanController.receivedSpans[3].tags.get('foo') == null - customPathSpanController.receivedSpans[3].tags.get('http.url').contains("/traced/nested/John") + customPathSpanController.receivedSpans[3].tags.get(UrlAttributes.URL_FULL.key).contains("/traced/nested/John") customPathSpanController.receivedSpans[3].name == 'get' customPathSpanController.receivedSpans[3].kind == CLIENT.name() } diff --git a/tracing-opentelemetry/build.gradle b/tracing-opentelemetry/build.gradle index f10817023..af8f78058 100644 --- a/tracing-opentelemetry/build.gradle +++ b/tracing-opentelemetry/build.gradle @@ -14,10 +14,9 @@ dependencies { api projects.micronautTracingAnnotation api projects.micronautTracingOpentelemetryAnnotation api libs.opentelemetry.api - api libs.opentelemetry.api.events + api libs.opentelemetry.api.incubator api libs.opentelemetry.instrumentation.annotations api libs.opentelemetry.instrumentation.api - api libs.opentelemetry.instrumentation.semconv api libs.opentelemetry.autoconfigure implementation(platform(libs.micronaut.aws)) diff --git a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/DefaultOpenTelemetryFactory.java b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/DefaultOpenTelemetryFactory.java index f195a01ba..b50ca73cd 100644 --- a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/DefaultOpenTelemetryFactory.java +++ b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/DefaultOpenTelemetryFactory.java @@ -27,7 +27,7 @@ import io.micronaut.runtime.ApplicationConfiguration; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.api.events.GlobalEventEmitterProvider; +import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder; import io.opentelemetry.sdk.trace.IdGenerator; @@ -121,7 +121,7 @@ protected OpenTelemetry defaultOpenTelemetry(ApplicationConfiguration applicatio void resetForTest(Environment environment) { if (environment.getActiveNames().contains(Environment.TEST)) { GlobalOpenTelemetry.resetForTest(); - GlobalEventEmitterProvider.resetForTest(); + GlobalEventLoggerProvider.resetForTest(); } } diff --git a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/instrument/util/MicronautCodeTelemetryFactory.java b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/instrument/util/MicronautCodeTelemetryFactory.java index 62c50a3e5..cfe2b5821 100644 --- a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/instrument/util/MicronautCodeTelemetryFactory.java +++ b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/instrument/util/MicronautCodeTelemetryFactory.java @@ -19,12 +19,12 @@ import io.micronaut.context.annotation.Prototype; import io.micronaut.context.annotation.Requires; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.api.incubator.semconv.code.CodeAttributesGetter; +import io.opentelemetry.instrumentation.api.incubator.semconv.code.CodeSpanNameExtractor; +import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesGetter; -import io.opentelemetry.instrumentation.api.instrumenter.code.CodeSpanNameExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics; -import io.opentelemetry.instrumentation.api.instrumenter.util.ClassAndMethod; +import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics; import jakarta.inject.Named; /** diff --git a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/AbstractOpenTelemetryTraceInterceptor.java b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/AbstractOpenTelemetryTraceInterceptor.java index 5d4cfb8bc..b2880f273 100644 --- a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/AbstractOpenTelemetryTraceInterceptor.java +++ b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/AbstractOpenTelemetryTraceInterceptor.java @@ -22,8 +22,8 @@ import io.micronaut.core.type.Argument; import io.micronaut.tracing.annotation.SpanTag; import io.opentelemetry.api.trace.Span; +import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.instrumentation.api.instrumenter.util.ClassAndMethod; import jakarta.inject.Named; /** diff --git a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/ContinueSpanOpenTelemetryTraceInterceptor.java b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/ContinueSpanOpenTelemetryTraceInterceptor.java index 072e5891b..1366f6ef8 100644 --- a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/ContinueSpanOpenTelemetryTraceInterceptor.java +++ b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/ContinueSpanOpenTelemetryTraceInterceptor.java @@ -23,8 +23,8 @@ import io.micronaut.tracing.annotation.ContinueSpan; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.instrumentation.api.instrumenter.util.ClassAndMethod; import jakarta.inject.Named; import jakarta.inject.Singleton; diff --git a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/NewSpanOpenTelemetryTraceInterceptor.java b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/NewSpanOpenTelemetryTraceInterceptor.java index df08d07ca..1c1ee7562 100644 --- a/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/NewSpanOpenTelemetryTraceInterceptor.java +++ b/tracing-opentelemetry/src/main/java/io/micronaut/tracing/opentelemetry/interceptor/NewSpanOpenTelemetryTraceInterceptor.java @@ -29,8 +29,8 @@ import io.micronaut.tracing.opentelemetry.OpenTelemetryPropagationContext; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.instrumentation.api.instrumenter.util.ClassAndMethod; import jakarta.inject.Named; import jakarta.inject.Singleton; import reactor.core.publisher.Flux;