Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump opentelemetry-bom from 1.12.0 to 1.13.0 #24854

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<opentracing-jdbc.version>0.2.4</opentracing-jdbc.version>
<opentracing-kafka.version>0.1.15</opentracing-kafka.version>
<opentracing-mongo.version>0.1.5</opentracing-mongo.version>
<opentelemetry.version>1.12.0</opentelemetry.version>
<opentelemetry-alpha.version>1.12.0-alpha</opentelemetry-alpha.version>
<opentelemetry.version>1.13.0</opentelemetry.version>
<opentelemetry-alpha.version>1.13.0-alpha</opentelemetry-alpha.version>
<jaeger.version>1.8.0</jaeger.version>
<quarkus-http.version>4.1.8</quarkus-http.version>
<micrometer.version>1.8.4</micrometer.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -20,26 +22,31 @@
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 "
+ managedChannelBuilder.getClass().getName());
}
}
}

class OtlpExporterSubstitutions {
}
26 changes: 15 additions & 11 deletions extensions/opentelemetry/opentelemetry/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,22 @@
<artifactId>opentelemetry-extension-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-semconv</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-annotation-support</artifactId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
Expand All @@ -78,18 +82,18 @@
</exclusions>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-annotation-support</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-semconv</artifactId>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-semconv</artifactId>
</dependency>

<!-- Test Dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<GrpcRequest> {
INSTANCE;

class GrpcAttributesExtractor extends RpcAttributesExtractor<GrpcRequest, Status> {
@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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,14 +50,12 @@ public Instrumenter<Message, Message> getReceiveResponseInstrumenter() {
}

private static Instrumenter<Message, Message> getConsumerInstrumenter(final OpenTelemetry openTelemetry) {
EventBusAttributesExtractor eventBusAttributesExtractor = new EventBusAttributesExtractor(RECEIVE);

InstrumenterBuilder<Message, Message> 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<String> keys(final Message message) {
Expand All @@ -75,85 +73,74 @@ public String get(final Message message, final String key) {
}

private static Instrumenter<Message, Message> getProducerInstrumenter(final OpenTelemetry openTelemetry) {
EventBusAttributesExtractor eventBusAttributesExtractor = new EventBusAttributesExtractor(SEND);

InstrumenterBuilder<Message, Message> 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);
}
});
}

private static class EventBusAttributesExtractor extends MessagingAttributesExtractor<Message, Message> {
private final MessageOperation operation;

public EventBusAttributesExtractor(final MessageOperation operation) {
this.operation = operation;
}

@Override
public MessageOperation operation() {
return operation;
}
private enum EventBusAttributesGetter implements MessagingAttributesGetter<Message, Message> {
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;
}
}
Expand Down