From ba6165b98d9b22c2c7ac4cf35bccbc63c92bb558 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Apr 2022 22:25:21 +0000 Subject: [PATCH] Bump opentelemetry-bom from 1.12.0 to 1.13.0 Bumps [opentelemetry-bom](https://github.com/open-telemetry/opentelemetry-java) from 1.12.0 to 1.13.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-java/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-java/compare/v1.12.0...v1.13.0) --- updated-dependencies: - dependency-name: io.opentelemetry:opentelemetry-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- bom/application/pom.xml | 4 +- .../graal/OtlpExporterSubstitutions.java | 21 +++++--- .../opentelemetry/runtime/pom.xml | 26 +++++----- .../tracing/cdi/WithSpanInterceptor.java | 2 +- ...tractor.java => GrpcAttributesGetter.java} | 13 ++--- .../grpc/GrpcTracingClientInterceptor.java | 3 +- .../grpc/GrpcTracingServerInterceptor.java | 3 +- .../EventBusInstrumenterVertxTracer.java | 49 +++++++------------ 8 files changed, 61 insertions(+), 60 deletions(-) rename extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/{GrpcAttributesExtractor.java => GrpcAttributesGetter.java} (52%) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index d33e474e96e04..1383bb23cdf65 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -24,8 +24,8 @@ 0.2.4 0.1.15 0.1.5 - 1.12.0 - 1.12.0-alpha + 1.13.0 + 1.13.0-alpha 1.8.0 4.1.8 1.8.4 diff --git a/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/graal/OtlpExporterSubstitutions.java b/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/graal/OtlpExporterSubstitutions.java index d47b99eee7071..6290a2144142e 100644 --- a/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/graal/OtlpExporterSubstitutions.java +++ b/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/graal/OtlpExporterSubstitutions.java @@ -3,6 +3,7 @@ import static java.util.Objects.requireNonNull; import javax.net.ssl.SSLException; +import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; import com.oracle.svm.core.annotate.Substitute; @@ -11,6 +12,7 @@ import io.grpc.ManagedChannelBuilder; import io.grpc.netty.GrpcSslContexts; import io.grpc.netty.NettyChannelBuilder; +import io.opentelemetry.exporter.internal.TlsUtil; /** * Replace the {@code setTrustedCertificatesPem()} method in native because the upstream code supports using @@ -20,19 +22,27 @@ final class Target_io_opentelemetry_exporter_otlp_internal_grpc_ManagedChannelUtil { @Substitute - public static void setTrustedCertificatesPem( - ManagedChannelBuilder managedChannelBuilder, byte[] trustedCertificatesPem) + public static void setClientKeysAndTrustedCertificatesPem( + ManagedChannelBuilder managedChannelBuilder, + byte[] privateKeyPem, + byte[] certificatePem, + byte[] trustedCertificatesPem) throws SSLException { requireNonNull(managedChannelBuilder, "managedChannelBuilder"); requireNonNull(trustedCertificatesPem, "trustedCertificatesPem"); - X509TrustManager tm = io.opentelemetry.exporter.internal.TlsUtil.trustManager(trustedCertificatesPem); + X509TrustManager tmf = TlsUtil.trustManager(trustedCertificatesPem); + X509KeyManager kmf = null; + if (privateKeyPem != null && certificatePem != null) { + kmf = TlsUtil.keyManager(privateKeyPem, certificatePem); + } // gRPC does not abstract TLS configuration so we need to check the implementation and act // accordingly. if (managedChannelBuilder.getClass().getName().equals("io.grpc.netty.NettyChannelBuilder")) { NettyChannelBuilder nettyBuilder = (NettyChannelBuilder) managedChannelBuilder; - nettyBuilder.sslContext(GrpcSslContexts.forClient().trustManager(tm).build()); + nettyBuilder.sslContext( + GrpcSslContexts.forClient().keyManager(kmf).trustManager(tmf).build()); } else { throw new SSLException( "TLS certificate configuration not supported for unrecognized ManagedChannelBuilder " @@ -40,6 +50,3 @@ public static void setTrustedCertificatesPem( } } } - -class OtlpExporterSubstitutions { -} diff --git a/extensions/opentelemetry/opentelemetry/runtime/pom.xml b/extensions/opentelemetry/opentelemetry/runtime/pom.xml index 00d2c9ed05a1e..8901277f01a71 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/pom.xml +++ b/extensions/opentelemetry/opentelemetry/runtime/pom.xml @@ -58,18 +58,22 @@ opentelemetry-extension-annotations - io.opentelemetry.instrumentation - opentelemetry-instrumentation-api + io.opentelemetry + opentelemetry-sdk-extension-autoconfigure-spi - com.google.code.findbugs - jsr305 + * + * + + io.opentelemetry + opentelemetry-semconv + io.opentelemetry.instrumentation - opentelemetry-instrumentation-api-annotation-support + opentelemetry-instrumentation-api com.google.code.findbugs @@ -78,18 +82,18 @@ - io.opentelemetry - opentelemetry-sdk-extension-autoconfigure-spi + io.opentelemetry.instrumentation + opentelemetry-instrumentation-api-annotation-support - * - * + com.google.code.findbugs + jsr305 - io.opentelemetry - opentelemetry-semconv + io.opentelemetry.instrumentation + opentelemetry-instrumentation-api-semconv diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java index c50518ecd4540..4ca623453e196 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java @@ -21,7 +21,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.SpanNames; +import io.opentelemetry.instrumentation.api.util.SpanNames; @SuppressWarnings("CdiInterceptorInspection") @Interceptor diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesExtractor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesGetter.java similarity index 52% rename from extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesExtractor.java rename to extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesGetter.java index a124c8b9ac681..5e2a9df02ca40 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesExtractor.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcAttributesGetter.java @@ -1,21 +1,22 @@ package io.quarkus.opentelemetry.runtime.tracing.grpc; -import io.grpc.Status; -import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcAttributesGetter; + +enum GrpcAttributesGetter implements RpcAttributesGetter { + INSTANCE; -class GrpcAttributesExtractor extends RpcAttributesExtractor { @Override - protected String system(final GrpcRequest grpcRequest) { + public String system(final GrpcRequest grpcRequest) { return "grpc"; } @Override - protected String service(final GrpcRequest grpcRequest) { + public String service(final GrpcRequest grpcRequest) { return grpcRequest.getMethodDescriptor().getServiceName(); } @Override - protected String method(final GrpcRequest grpcRequest) { + public String method(final GrpcRequest grpcRequest) { return grpcRequest.getMethodDescriptor().getBareMethodName(); } } diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java index 050276b14df77..6b054906ee89d 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java @@ -19,6 +19,7 @@ import io.opentelemetry.context.propagation.TextMapSetter; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcClientAttributesExtractor; import io.quarkus.grpc.GlobalInterceptor; @Singleton @@ -35,7 +36,7 @@ public GrpcTracingClientInterceptor(final OpenTelemetry openTelemetry) { INSTRUMENTATION_NAME, new GrpcSpanNameExtractor()); - builder.addAttributesExtractor(new GrpcAttributesExtractor()) + builder.addAttributesExtractor(RpcClientAttributesExtractor.create(GrpcAttributesGetter.INSTANCE)) .addAttributesExtractor(new GrpcStatusCodeExtractor()) .setSpanStatusExtractor(new GrpcSpanStatusExtractor()); diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java index 779ab5f29d18f..959188539fe3c 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java @@ -24,6 +24,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.net.InetSocketAddressNetServerAttributesGetter; import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcServerAttributesExtractor; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import io.quarkus.grpc.GlobalInterceptor; @@ -38,7 +39,7 @@ public GrpcTracingServerInterceptor(final OpenTelemetry openTelemetry) { INSTRUMENTATION_NAME, new GrpcSpanNameExtractor()); - builder.addAttributesExtractor(new GrpcAttributesExtractor()) + builder.addAttributesExtractor(RpcServerAttributesExtractor.create(GrpcAttributesGetter.INSTANCE)) .addAttributesExtractor(NetServerAttributesExtractor.create(new GrpcServerNetServerAttributesGetter())) .addAttributesExtractor(new GrpcStatusCodeExtractor()) .setSpanStatusExtractor(new GrpcSpanStatusExtractor()); diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/EventBusInstrumenterVertxTracer.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/EventBusInstrumenterVertxTracer.java index d2ce9f9f07d8a..4471d4dfcc990 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/EventBusInstrumenterVertxTracer.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/EventBusInstrumenterVertxTracer.java @@ -8,8 +8,8 @@ import io.opentelemetry.context.propagation.TextMapGetter; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessageOperation; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingSpanNameExtractor; import io.vertx.core.eventbus.Message; import io.vertx.core.spi.tracing.TagExtractor; @@ -50,14 +50,12 @@ public Instrumenter getReceiveResponseInstrumenter() { } private static Instrumenter getConsumerInstrumenter(final OpenTelemetry openTelemetry) { - EventBusAttributesExtractor eventBusAttributesExtractor = new EventBusAttributesExtractor(RECEIVE); - InstrumenterBuilder serverBuilder = Instrumenter.builder( openTelemetry, - INSTRUMENTATION_NAME, MessagingSpanNameExtractor.create(eventBusAttributesExtractor)); + INSTRUMENTATION_NAME, MessagingSpanNameExtractor.create(EventBusAttributesGetter.INSTANCE, RECEIVE)); return serverBuilder - .addAttributesExtractor(eventBusAttributesExtractor) + .addAttributesExtractor(MessagingAttributesExtractor.create(EventBusAttributesGetter.INSTANCE, RECEIVE)) .newConsumerInstrumenter(new TextMapGetter<>() { @Override public Iterable keys(final Message message) { @@ -75,14 +73,12 @@ public String get(final Message message, final String key) { } private static Instrumenter getProducerInstrumenter(final OpenTelemetry openTelemetry) { - EventBusAttributesExtractor eventBusAttributesExtractor = new EventBusAttributesExtractor(SEND); - InstrumenterBuilder serverBuilder = Instrumenter.builder( openTelemetry, - INSTRUMENTATION_NAME, MessagingSpanNameExtractor.create(eventBusAttributesExtractor)); + INSTRUMENTATION_NAME, MessagingSpanNameExtractor.create(EventBusAttributesGetter.INSTANCE, SEND)); return serverBuilder - .addAttributesExtractor(eventBusAttributesExtractor) + .addAttributesExtractor(MessagingAttributesExtractor.create(EventBusAttributesGetter.INSTANCE, SEND)) .newProducerInstrumenter((message, key, value) -> { if (message != null) { message.headers().set(key, value); @@ -90,70 +86,61 @@ private static Instrumenter getProducerInstrumenter(final Open }); } - private static class EventBusAttributesExtractor extends MessagingAttributesExtractor { - private final MessageOperation operation; - - public EventBusAttributesExtractor(final MessageOperation operation) { - this.operation = operation; - } - - @Override - public MessageOperation operation() { - return operation; - } + private enum EventBusAttributesGetter implements MessagingAttributesGetter { + INSTANCE; @Override - protected String system(final Message message) { + public String system(final Message message) { return "vert.x"; } @Override - protected String destinationKind(final Message message) { + public String destinationKind(final Message message) { return message.isSend() ? "queue" : "topic"; } @Override - protected String destination(final Message message) { + public String destination(final Message message) { return message.address(); } @Override - protected boolean temporaryDestination(final Message message) { + public boolean temporaryDestination(final Message message) { return false; } @Override - protected String protocol(final Message message) { + public String protocol(final Message message) { return null; } @Override - protected String protocolVersion(final Message message) { + public String protocolVersion(final Message message) { return "4.0"; } @Override - protected String url(final Message message) { + public String url(final Message message) { return null; } @Override - protected String conversationId(final Message message) { + public String conversationId(final Message message) { return message.replyAddress(); } @Override - protected Long messagePayloadSize(final Message message) { + public Long messagePayloadSize(final Message message) { return null; } @Override - protected Long messagePayloadCompressedSize(final Message message) { + public Long messagePayloadCompressedSize(final Message message) { return null; } @Override - protected String messageId(final Message message, final Message message2) { + public String messageId(final Message message, final Message message2) { return null; } }