From e559cbdf93faac811d028f5af6acd5ad44b2f412 Mon Sep 17 00:00:00 2001 From: brunobat Date: Mon, 7 Oct 2024 17:01:53 +0100 Subject: [PATCH] Upgrade OTel-java to 1.42.1, instrumentation to 2.8.0 and semantic conventions to 1.27.0 --- bom/application/pom.xml | 6 ++--- .../exporter/InMemoryMetricExporter.java | 14 +++++----- .../GrpcOpenTelemetryTest.java | 8 +++--- .../traces/OpenTelemetryHttpCDITest.java | 7 ++--- .../OpenTelemetryReactiveRoutesTest.java | 6 ++--- extensions/opentelemetry/runtime/pom.xml | 4 +++ .../exporter/otlp/sender/VertxGrpcSender.java | 27 +++++++++---------- .../runtime/tracing/DropTargetsSampler.java | 8 +++--- .../runtime/tracing/TracerRecorder.java | 14 ++++++---- .../runtime/tracing/TracerUtil.java | 4 +-- .../grpc/GrpcStatusCodeExtractor.java | 5 ++-- .../OpenTelemetryClassicServerFilter.java | 8 +++--- .../OpenTelemetryReactiveServerFilter.java | 8 +++--- .../vertx/HttpInstrumenterVertxTracer.java | 6 ++--- .../RedisClientInstrumenterVertxTracer.java | 7 ++--- .../tracing/DropTargetsSamplerTest.java | 4 +-- .../runtime/tracing/TracerUtilTest.java | 14 ++++++---- 17 files changed, 85 insertions(+), 65 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 2c1f4e14984b7..ba3209e641a6d 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -32,9 +32,9 @@ 0.2.4 0.1.15 0.1.5 - 1.39.0 - 2.5.0-alpha - 1.26.0-alpha + 1.42.1 + 2.8.0-alpha + 1.27.0-alpha 5.3.3 1.13.5 2.2.2 diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java index 64774ae5097b9..fe62bd191870f 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java @@ -1,5 +1,8 @@ package io.quarkus.opentelemetry.deployment.common.exporter; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_ROUTE; import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toMap; @@ -27,16 +30,15 @@ import io.opentelemetry.sdk.metrics.data.MetricData; import io.opentelemetry.sdk.metrics.data.PointData; import io.opentelemetry.sdk.metrics.export.MetricExporter; -import io.opentelemetry.semconv.SemanticAttributes; import io.quarkus.arc.Unremovable; @Unremovable @ApplicationScoped public class InMemoryMetricExporter implements MetricExporter { - private static final List KEY_COMPONENTS = List.of(SemanticAttributes.HTTP_REQUEST_METHOD.getKey(), - SemanticAttributes.HTTP_ROUTE.getKey(), - SemanticAttributes.HTTP_RESPONSE_STATUS_CODE.getKey()); + private static final List KEY_COMPONENTS = List.of(HTTP_REQUEST_METHOD.getKey(), + HTTP_ROUTE.getKey(), + HTTP_RESPONSE_STATUS_CODE.getKey()); private final Queue finishedMetricItems = new ConcurrentLinkedQueue<>(); private final AggregationTemporality aggregationTemporality = AggregationTemporality.CUMULATIVE; @@ -89,7 +91,7 @@ public static Map getMostRecentPointsMap(List fin */ private static boolean notExporterPointData(PointData pointData) { return pointData.getAttributes().asMap().entrySet().stream() - .noneMatch(entry -> entry.getKey().getKey().equals(SemanticAttributes.HTTP_ROUTE.getKey()) && + .noneMatch(entry -> entry.getKey().getKey().equals(HTTP_ROUTE.getKey()) && entry.getValue().toString().contains("/export")); } @@ -97,7 +99,7 @@ private static boolean isPathFound(String path, Attributes attributes) { if (path == null) { return true;// any match } - Object value = attributes.asMap().get(AttributeKey.stringKey(SemanticAttributes.HTTP_ROUTE.getKey())); + Object value = attributes.asMap().get(AttributeKey.stringKey(HTTP_ROUTE.getKey())); if (value == null) { return false; } diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java index ae4fa1eafb10f..d96b72c5e5897 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java @@ -4,12 +4,12 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT; import static io.opentelemetry.api.trace.SpanKind.INTERNAL; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_GRPC_STATUS_CODE; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_SERVICE; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_SYSTEM; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig.INSTRUMENTATION_NAME; import static org.assertj.core.api.Assertions.assertThat; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java index fc18cf713aadd..379e5ef80cd9e 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java @@ -2,6 +2,8 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL; import static io.opentelemetry.api.trace.SpanKind.SERVER; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_FUNCTION; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_NAMESPACE; import static io.quarkus.opentelemetry.deployment.common.TestUtil.assertStringAttribute; import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.assertj.core.api.Assertions.assertThat; @@ -24,7 +26,6 @@ import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; -import io.opentelemetry.semconv.SemanticAttributes; import io.quarkus.opentelemetry.deployment.common.TestUtil; import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; @@ -64,9 +65,9 @@ void telemetry() { final SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000"); assertEquals("GET /hello", server.getName()); // verify that OpenTelemetryServerFilter took place - assertStringAttribute(server, SemanticAttributes.CODE_NAMESPACE, + assertStringAttribute(server, CODE_NAMESPACE, "io.quarkus.opentelemetry.deployment.traces.OpenTelemetryHttpCDITest$HelloResource"); - assertStringAttribute(server, SemanticAttributes.CODE_FUNCTION, "hello"); + assertStringAttribute(server, CODE_FUNCTION, "hello"); final SpanData internalFromBean = getSpanByKindAndParentId(spans, INTERNAL, server.getSpanId()); assertEquals("HelloBean.hello", internalFromBean.getName()); diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java index 7c38b4be2fb61..2d480e1b741b4 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java @@ -1,6 +1,7 @@ package io.quarkus.opentelemetry.deployment.traces; import static io.opentelemetry.api.trace.SpanKind.SERVER; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_ROUTE; import static io.quarkus.opentelemetry.deployment.common.TestUtil.assertStringAttribute; import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; @@ -18,7 +19,6 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.trace.data.SpanData; -import io.opentelemetry.semconv.SemanticAttributes; import io.quarkus.opentelemetry.deployment.common.TestUtil; import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; @@ -57,7 +57,7 @@ void root() { final SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000"); assertEquals("GET /", server.getName()); - assertStringAttribute(server, SemanticAttributes.HTTP_ROUTE, "/"); + assertStringAttribute(server, HTTP_ROUTE, "/"); } @Test @@ -71,7 +71,7 @@ void nonRoot() { final SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000"); assertEquals("GET /hello", server.getName()); - assertStringAttribute(server, SemanticAttributes.HTTP_ROUTE, "/hello"); + assertStringAttribute(server, HTTP_ROUTE, "/hello"); } @ApplicationScoped diff --git a/extensions/opentelemetry/runtime/pom.xml b/extensions/opentelemetry/runtime/pom.xml index e6abd62301dec..34c3f3a99a439 100644 --- a/extensions/opentelemetry/runtime/pom.xml +++ b/extensions/opentelemetry/runtime/pom.xml @@ -98,6 +98,10 @@ io.opentelemetry.semconv opentelemetry-semconv + + io.opentelemetry.semconv + opentelemetry-semconv-incubating + io.opentelemetry opentelemetry-api-incubator diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/sender/VertxGrpcSender.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/sender/VertxGrpcSender.java index 768e8ee20f70c..2b89009d54693 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/sender/VertxGrpcSender.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/sender/VertxGrpcSender.java @@ -8,7 +8,6 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.Supplier; @@ -84,7 +83,7 @@ public VertxGrpcSender( } @Override - public void send(Marshaler request, Runnable onSuccess, BiConsumer onError) { + public void send(Marshaler request, Consumer onSuccess, Consumer onError) { if (isShutdown.get()) { return; } @@ -164,13 +163,13 @@ public void accept(GrpcClientRequest request) { }, onFailureCallback); } - private void failOnClientRequest(String type, Throwable t, BiConsumer onError) { + private void failOnClientRequest(String type, Throwable t, Consumer onError) { String message = "Failed to export " + type + "s. The request could not be executed. Full error message: " + (t.getMessage() == null ? t.getClass().getName() : t.getMessage()); logger.log(Level.WARNING, message); - onError.accept(GrpcResponse.create(2 /* UNKNOWN */, message), t); + onError.accept(t); } private static final class ClientRequestOnSuccessHandler implements Handler> { @@ -184,8 +183,8 @@ private static final class ClientRequestOnSuccessHandler implements Handler onError; + private final Consumer onSuccess; + private final Consumer onError; private final String grpcEndpointPath; private final int attemptNumber; @@ -199,8 +198,8 @@ public ClientRequestOnSuccessHandler(GrpcClient client, AtomicBoolean loggedUnimplemented, ThrottlingLogger logger, String type, - Runnable onSuccess, - BiConsumer onError, + Consumer onSuccess, + Consumer onError, int attemptNumber, String grpcEndpointPath, Supplier isShutdown) { @@ -273,7 +272,7 @@ public void handle(GrpcError error) { public void handle(Void ignored) { GrpcStatus status = getStatus(response); if (status == GrpcStatus.OK) { - onSuccess.run(); + onSuccess.accept(GrpcResponse.create(status.code, status.toString())); } else { handleError(status, response); } @@ -284,9 +283,7 @@ public void handle(Void ignored) { private void handleError(GrpcStatus status, GrpcClientResponse response) { String statusMessage = getStatusMessage(response); logAppropriateWarning(status, statusMessage); - onError.accept( - GrpcResponse.create(2 /* UNKNOWN */, statusMessage), - new IllegalStateException(statusMessage)); + onError.accept(new IllegalStateException(statusMessage)); } private void logAppropriateWarning(GrpcStatus status, @@ -415,18 +412,18 @@ public void accept(Throwable throwable) { + "s. Unable to serialize payload. Full error message: " + (e.getMessage() == null ? e.getClass().getName() : e.getMessage()); logger.log(Level.WARNING, message); - onError.accept(GrpcResponse.create(2 /* UNKNOWN */, message), e); + onError.accept(e); } } - private void failOnClientRequest(Throwable t, BiConsumer onError, int attemptNumber) { + private void failOnClientRequest(Throwable t, Consumer onError, int attemptNumber) { final String message = "Failed to export " + type + "s. The request could not be executed after " + attemptNumber + " attempts. Full error message: " + (t != null ? t.getMessage() : ""); logger.log(Level.WARNING, message); - onError.accept(GrpcResponse.create(2 /* UNKNOWN */, message), t); + onError.accept(t); } public ClientRequestOnSuccessHandler newAttempt() { diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/DropTargetsSampler.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/DropTargetsSampler.java index 6e4b5fef9a29f..f42b26fbaa9e8 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/DropTargetsSampler.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/DropTargetsSampler.java @@ -1,5 +1,8 @@ package io.quarkus.opentelemetry.runtime.tracing; +import static io.opentelemetry.semconv.UrlAttributes.URL_PATH; +import static io.opentelemetry.semconv.UrlAttributes.URL_QUERY; + import java.util.List; import io.opentelemetry.api.common.Attributes; @@ -8,7 +11,6 @@ import io.opentelemetry.sdk.trace.data.LinkData; import io.opentelemetry.sdk.trace.samplers.Sampler; import io.opentelemetry.sdk.trace.samplers.SamplingResult; -import io.opentelemetry.semconv.SemanticAttributes; public class DropTargetsSampler implements Sampler { private final Sampler sampler; @@ -26,8 +28,8 @@ public SamplingResult shouldSample(Context parentContext, String traceId, String if (spanKind.equals(SpanKind.SERVER)) { // HTTP_TARGET was split into url.path and url.query - String path = attributes.get(SemanticAttributes.URL_PATH); - String query = attributes.get(SemanticAttributes.URL_QUERY); + String path = attributes.get(URL_PATH); + String query = attributes.get(URL_QUERY); String target = path + (query == null ? "" : "?" + query); if (shouldDrop(target)) { diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerRecorder.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerRecorder.java index a2c082ead70ec..9445e53ed4175 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerRecorder.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerRecorder.java @@ -1,5 +1,10 @@ package io.quarkus.opentelemetry.runtime.tracing; +import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_VERSION; +import static io.opentelemetry.semconv.incubating.WebengineIncubatingAttributes.WEBENGINE_NAME; +import static io.opentelemetry.semconv.incubating.WebengineIncubatingAttributes.WEBENGINE_VERSION; + import java.util.HashSet; import java.util.List; import java.util.Set; @@ -7,7 +12,6 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.ResourceAttributes; import io.quarkus.runtime.annotations.Recorder; import io.quarkus.runtime.annotations.StaticInit; @@ -28,10 +32,10 @@ public DelayedAttributes get() { result.setAttributesDelegate(Resource.getDefault() .merge(Resource.create( Attributes.of( - ResourceAttributes.SERVICE_NAME, serviceName, - ResourceAttributes.SERVICE_VERSION, serviceVersion, - ResourceAttributes.WEBENGINE_NAME, "Quarkus", - ResourceAttributes.WEBENGINE_VERSION, quarkusVersion))) + SERVICE_NAME, serviceName, + SERVICE_VERSION, serviceVersion, + WEBENGINE_NAME, "Quarkus", + WEBENGINE_VERSION, quarkusVersion))) .getAttributes()); return result; } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerUtil.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerUtil.java index 2bcb46ecf6a8e..44dc7c360f162 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerUtil.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerUtil.java @@ -1,7 +1,7 @@ package io.quarkus.opentelemetry.runtime.tracing; -import static io.opentelemetry.semconv.ResourceAttributes.HOST_NAME; -import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_NAME; import java.util.List; diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/grpc/GrpcStatusCodeExtractor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/grpc/GrpcStatusCodeExtractor.java index 73bb2c515e5f6..0a36f7b6434de 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/grpc/GrpcStatusCodeExtractor.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/grpc/GrpcStatusCodeExtractor.java @@ -1,10 +1,11 @@ package io.quarkus.opentelemetry.runtime.tracing.intrumentation.grpc; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE; + import io.grpc.Status; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; -import io.opentelemetry.semconv.SemanticAttributes; class GrpcStatusCodeExtractor implements AttributesExtractor { @Override @@ -24,7 +25,7 @@ public void onEnd( final Throwable error) { if (status != null) { - attributes.put(SemanticAttributes.RPC_GRPC_STATUS_CODE, status.getCode().value()); + attributes.put(RPC_GRPC_STATUS_CODE, status.getCode().value()); } } } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryClassicServerFilter.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryClassicServerFilter.java index c3251cf02738c..b5d7fe6c34971 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryClassicServerFilter.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryClassicServerFilter.java @@ -1,5 +1,8 @@ package io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_FUNCTION; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_NAMESPACE; + import java.io.IOException; import jakarta.ws.rs.container.ContainerRequestContext; @@ -10,7 +13,6 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; -import io.opentelemetry.semconv.SemanticAttributes; /** * Handles RESTEasy Classic @@ -25,7 +27,7 @@ public class OpenTelemetryClassicServerFilter implements ContainerRequestFilter public void filter(ContainerRequestContext requestContext) throws IOException { Span localRootSpan = LocalRootSpan.current(); - localRootSpan.setAttribute(SemanticAttributes.CODE_NAMESPACE, resourceInfo.getResourceClass().getName()); - localRootSpan.setAttribute(SemanticAttributes.CODE_FUNCTION, resourceInfo.getResourceMethod().getName()); + localRootSpan.setAttribute(CODE_NAMESPACE, resourceInfo.getResourceClass().getName()); + localRootSpan.setAttribute(CODE_FUNCTION, resourceInfo.getResourceMethod().getName()); } } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryReactiveServerFilter.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryReactiveServerFilter.java index f000f2e44069d..07d062c10834f 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryReactiveServerFilter.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryReactiveServerFilter.java @@ -1,5 +1,8 @@ package io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_FUNCTION; +import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_NAMESPACE; + import java.io.IOException; import org.jboss.resteasy.reactive.server.ServerRequestFilter; @@ -7,7 +10,6 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; -import io.opentelemetry.semconv.SemanticAttributes; /** * Handles RESTEasy Reactive (via Vert.x) @@ -18,7 +20,7 @@ public class OpenTelemetryReactiveServerFilter { public void filter(SimpleResourceInfo resourceInfo) throws IOException { Span localRootSpan = LocalRootSpan.current(); - localRootSpan.setAttribute(SemanticAttributes.CODE_NAMESPACE, resourceInfo.getResourceClass().getName()); - localRootSpan.setAttribute(SemanticAttributes.CODE_FUNCTION, resourceInfo.getMethodName()); + localRootSpan.setAttribute(CODE_NAMESPACE, resourceInfo.getResourceClass().getName()); + localRootSpan.setAttribute(CODE_FUNCTION, resourceInfo.getMethodName()); } } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/HttpInstrumenterVertxTracer.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/HttpInstrumenterVertxTracer.java index 2d1d7c68a1273..dd24e28e78819 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/HttpInstrumenterVertxTracer.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/HttpInstrumenterVertxTracer.java @@ -1,9 +1,9 @@ package io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx; import static io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteSource.SERVER_FILTER; -import static io.opentelemetry.semconv.SemanticAttributes.CLIENT_ADDRESS; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_REQUEST_BODY_SIZE; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_RESPONSE_BODY_SIZE; +import static io.opentelemetry.semconv.ClientAttributes.CLIENT_ADDRESS; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_REQUEST_BODY_SIZE; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE; import static io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig.INSTRUMENTATION_NAME; import java.net.URI; diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/RedisClientInstrumenterVertxTracer.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/RedisClientInstrumenterVertxTracer.java index a27b7dbd2e475..c48bb6a630b65 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/RedisClientInstrumenterVertxTracer.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/intrumentation/vertx/RedisClientInstrumenterVertxTracer.java @@ -1,5 +1,6 @@ package io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_REDIS_DATABASE_INDEX; import static io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig.INSTRUMENTATION_NAME; import java.util.Map; @@ -15,7 +16,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil; -import io.opentelemetry.semconv.SemanticAttributes; +import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import io.quarkus.opentelemetry.runtime.config.runtime.OTelRuntimeConfig; import io.vertx.core.Context; import io.vertx.core.spi.tracing.SpanKind; @@ -143,7 +144,7 @@ public String getOperation(final CommandTrace commandTrace) { @Override public String getSystem(final CommandTrace commandTrace) { - return SemanticAttributes.DbSystemValues.REDIS; + return DbIncubatingAttributes.DbSystemValues.REDIS; } @Override @@ -168,7 +169,7 @@ enum RedisClientAttributesExtractor implements AttributesExtractor