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 OTel to 1.24+1.25 #32001

Merged
merged 1 commit into from
Apr 21, 2023
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
16 changes: 8 additions & 8 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,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.23.1</opentelemetry.version>
<opentelemetry-alpha.version>1.23.0-alpha</opentelemetry-alpha.version>
<opentelemetry.version>1.25.0</opentelemetry.version>
<opentelemetry-alpha.version>1.25.0-alpha</opentelemetry-alpha.version>
<jaeger.version>1.8.1</jaeger.version>
<quarkus-http.version>5.0.2.Final</quarkus-http.version>
<micrometer.version>1.10.5</micrometer.version><!-- keep in sync with hdrhistogram -->
Expand Down Expand Up @@ -68,7 +68,7 @@
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>3.0.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>3.3.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.4.0</smallrye-reactive-messaging.version>
<smallrye-reactive-messaging.version>4.5.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.1.0</smallrye-stork.version>
<jakarta.activation.version>2.1.1</jakarta.activation.version>
<jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>
Expand Down Expand Up @@ -3269,7 +3269,7 @@
<artifactId>router</artifactId>
<version>${vaadin-router.version}</version>
<scope>runtime</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>path-to-regexp</artifactId>
Expand Down Expand Up @@ -3645,7 +3645,7 @@
<version>${dedupe-mixin.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Lit -->
<dependency>
<groupId>org.mvnpm</groupId>
Expand Down Expand Up @@ -3689,23 +3689,23 @@
<version>${lit-state.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Apache echarts -->
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>echarts</artifactId>
<version>${echarts.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Code editor -->
<dependency>
<groupId>org.mvnpm.at.vanillawc</groupId>
<artifactId>wc-codemirror</artifactId>
<version>${wc-codemirror.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Polyfill for importmaps -->
<dependency>
<groupId>org.mvnpm</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_URL;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_HOST_NAME;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_HOST_PORT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_NAME;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_PORT;
import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.util.stream.Collectors.toSet;
Expand Down Expand Up @@ -79,6 +81,8 @@ void client() throws Exception {
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello", client.getAttributes().get(HTTP_URL));
assertEquals(uri.getHost(), client.getAttributes().get(NET_PEER_NAME));
assertEquals(uri.getPort(), client.getAttributes().get(NET_PEER_PORT));

SpanData server = getSpanByKindAndParentId(spans, SERVER, client.getSpanId());
assertEquals(SERVER, server.getKind());
Expand Down Expand Up @@ -111,6 +115,8 @@ void path() throws Exception {
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello/naruto", client.getAttributes().get(HTTP_URL));
assertEquals(uri.getHost(), client.getAttributes().get(NET_PEER_NAME));
assertEquals(uri.getPort(), client.getAttributes().get(NET_PEER_PORT));

SpanData server = getSpanByKindAndParentId(spans, SERVER, client.getSpanId());
assertEquals(SERVER, server.getKind());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.opentelemetry.api.trace.SpanKind.SERVER;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_CLIENT_IP;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_FLAVOR;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_METHOD;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_ROUTE;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_SCHEME;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_STATUS_CODE;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_TARGET;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_USER_AGENT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_HOST_NAME;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_HOST_PORT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.USER_AGENT_ORIGINAL;
import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId;
import static io.restassured.RestAssured.given;
import static io.vertx.core.http.HttpMethod.GET;
Expand Down Expand Up @@ -90,7 +89,6 @@ void trace() throws NoSuchFieldException, IllegalAccessException, InvocationTarg

SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000");
assertEquals(HTTP_OK, server.getAttributes().get(HTTP_STATUS_CODE));
assertEquals("1.1", server.getAttributes().get(HTTP_FLAVOR));
assertEquals("/tracer", server.getAttributes().get(HTTP_TARGET));
assertEquals("http", server.getAttributes().get(HTTP_SCHEME));
assertEquals("localhost", server.getAttributes().get(NET_HOST_NAME));
Expand All @@ -100,7 +98,7 @@ void trace() throws NoSuchFieldException, IllegalAccessException, InvocationTarg
W3CBaggagePropagator.getInstance()));
assertThat(idGenerator, instanceOf(IdGenerator.random().getClass()));
assertThat(sampler.getDescription(), stringContainsInOrder("ParentBased", "AlwaysOnSampler"));
assertNotNull(server.getAttributes().get(HTTP_USER_AGENT));
assertNotNull(server.getAttributes().get(USER_AGENT_ORIGINAL));

SpanData internal = getSpanByKindAndParentId(spans, INTERNAL, server.getSpanId());
assertEquals("io.quarkus.vertx.opentelemetry", internal.getName());
Expand All @@ -118,13 +116,12 @@ void spanNameWithoutQueryString() {
final SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000");
assertEquals("GET /tracer", server.getName());
assertEquals(HTTP_OK, server.getAttributes().get(HTTP_STATUS_CODE));
assertEquals("1.1", server.getAttributes().get(HTTP_FLAVOR));
assertEquals("/tracer?id=1", server.getAttributes().get(HTTP_TARGET));
assertEquals("http", server.getAttributes().get(HTTP_SCHEME));
assertEquals("localhost", server.getAttributes().get(NET_HOST_NAME));
assertEquals("8081", server.getAttributes().get(NET_HOST_PORT).toString());
assertEquals("127.0.0.1", server.getAttributes().get(HTTP_CLIENT_IP));
assertNotNull(server.getAttributes().get(HTTP_USER_AGENT));
assertNotNull(server.getAttributes().get(USER_AGENT_ORIGINAL));

SpanData internal = getSpanByKindAndParentId(spans, INTERNAL, server.getSpanId());
assertEquals("io.quarkus.vertx.opentelemetry", internal.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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 @@ -24,18 +23,11 @@ final class Target_io_opentelemetry_exporter_otlp_internal_grpc_ManagedChannelUt
@Substitute
public static void setClientKeysAndTrustedCertificatesPem(
ManagedChannelBuilder<?> managedChannelBuilder,
byte[] privateKeyPem,
byte[] certificatePem,
byte[] trustedCertificatesPem)
X509TrustManager tmf,
X509KeyManager kmf)
throws SSLException {
requireNonNull(managedChannelBuilder, "managedChannelBuilder");
requireNonNull(trustedCertificatesPem, "trustedCertificatesPem");

X509TrustManager tmf = TlsUtil.trustManager(trustedCertificatesPem);
X509KeyManager kmf = null;
if (privateKeyPem != null && certificatePem != null) {
kmf = TlsUtil.keyManager(privateKeyPem, certificatePem);
}
requireNonNull(tmf, "X509TrustManager");

// gRPC does not abstract TLS configuration so we need to check the implementation and act
// accordingly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesGetter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import io.quarkus.arc.Unremovable;
import io.quarkus.opentelemetry.runtime.QuarkusContextStorage;

Expand Down Expand Up @@ -60,6 +62,7 @@ public OpenTelemetryClientFilter() {
@Inject
public OpenTelemetryClientFilter(final OpenTelemetry openTelemetry) {
ClientAttributesExtractor clientAttributesExtractor = new ClientAttributesExtractor();
ClientNetAttributesGetter clientNetAttributesExtractor = new ClientNetAttributesGetter();

InstrumenterBuilder<ClientRequestContext, ClientResponseContext> builder = Instrumenter.builder(
openTelemetry,
Expand All @@ -68,7 +71,8 @@ public OpenTelemetryClientFilter(final OpenTelemetry openTelemetry) {

this.instrumenter = builder
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(clientAttributesExtractor))
.addAttributesExtractor(HttpClientAttributesExtractor.create(clientAttributesExtractor))
.addAttributesExtractor(HttpClientAttributesExtractor.create(
clientAttributesExtractor, clientNetAttributesExtractor))
.buildClientInstrumenter(new ClientRequestContextTextMapSetter());
}

Expand Down Expand Up @@ -178,4 +182,23 @@ public List<String> getResponseHeader(final ClientRequestContext request, final
return response.getHeaders().getOrDefault(name, emptyList());
}
}

private static class ClientNetAttributesGetter
implements NetClientAttributesGetter<ClientRequestContext, ClientResponseContext> {

@Override
public String getTransport(ClientRequestContext clientRequestContext, ClientResponseContext clientResponseContext) {
return SemanticAttributes.NetTransportValues.IP_TCP;
}

@Override
public String getPeerName(ClientRequestContext clientRequestContext) {
return clientRequestContext.getUri().getHost();
}

@Override
public Integer getPeerPort(ClientRequestContext clientRequestContext) {
return clientRequestContext.getUri().getPort();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,6 @@ public boolean isTemporaryDestination(final Message message) {
return false;
}

@Override
public String getProtocol(final Message message) {
return null;
}

@Override
public String getProtocolVersion(final Message message) {
return "4.0";
}

@Override
public String getUrl(final Message message) {
return null;
}

@Override
public String getConversationId(final Message message) {
return message.replyAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesGetter;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesGetter;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesGetter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import io.vertx.core.Context;
import io.vertx.core.MultiMap;
import io.vertx.core.http.HttpHeaders;
Expand Down Expand Up @@ -127,6 +129,7 @@ private static Instrumenter<HttpRequest, HttpResponse> getServerInstrumenter(fin
private static Instrumenter<HttpRequest, HttpResponse> getClientInstrumenter(final OpenTelemetry openTelemetry) {
ServerAttributesExtractor serverAttributesExtractor = new ServerAttributesExtractor();
ClientAttributesExtractor clientAttributesExtractor = new ClientAttributesExtractor();
HttpClientNetAttributeGetter httpClientNetAttributeGetter = new HttpClientNetAttributeGetter();

InstrumenterBuilder<HttpRequest, HttpResponse> clientBuilder = Instrumenter.builder(
openTelemetry,
Expand All @@ -135,7 +138,8 @@ private static Instrumenter<HttpRequest, HttpResponse> getClientInstrumenter(fin

return clientBuilder
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(serverAttributesExtractor))
.addAttributesExtractor(HttpClientAttributesExtractor.create(clientAttributesExtractor))
.addAttributesExtractor(HttpClientAttributesExtractor.create(
clientAttributesExtractor, httpClientNetAttributeGetter))
.buildClientInstrumenter(new HttpRequestTextMapSetter());
}

Expand Down Expand Up @@ -295,6 +299,25 @@ public Integer getHostPort(HttpRequest httpRequest) {
}
}

private static class HttpClientNetAttributeGetter implements NetClientAttributesGetter<HttpRequest, HttpResponse> {
@Override
public String getTransport(HttpRequest httpClientRequest, HttpResponse httpClientResponse) {
return SemanticAttributes.NetTransportValues.IP_TCP;
}

@javax.annotation.Nullable
@Override
public String getPeerName(HttpRequest httpRequest) {
return httpRequest.remoteAddress().hostName();
}

@javax.annotation.Nullable
@Override
public Integer getPeerPort(HttpRequest httpRequest) {
return httpRequest.remoteAddress().port();
}
}

private static class HttpRequestTextMapGetter implements TextMapGetter<HttpRequest> {
@Override
public Iterable<String> keys(final HttpRequest carrier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,13 @@ private void verifyServer(Map<String, Object> spanData, Map<String, Object> pare
Assertions.assertFalse((Boolean) spanData.get("parent_remote"));

Assertions.assertEquals("GET", spanData.get("attr_http.method"));
Assertions.assertEquals("1.1", spanData.get("attr_http.flavor"));
Assertions.assertEquals("/direct", spanData.get("attr_http.target"));
assertEquals(url.getHost(), spanData.get("attr_net.host.name"));
assertEquals(url.getPort(), Integer.valueOf((String) spanData.get("attr_net.host.port")));
Assertions.assertEquals("http", spanData.get("attr_http.scheme"));
Assertions.assertEquals("200", spanData.get("attr_http.status_code"));
Assertions.assertNotNull(spanData.get("attr_http.client_ip"));
Assertions.assertNotNull(spanData.get("attr_http.user_agent"));
Assertions.assertNotNull(spanData.get("attr_user_agent.original"));
}

private static void verifyProducer(Map<String, Object> spanData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ void testResourceTracing() {
assertFalse((Boolean) spanData.get("parent_remote"));

assertEquals("GET", spanData.get("attr_http.method"));
assertEquals("1.1", spanData.get("attr_http.flavor"));
assertEquals("/direct", spanData.get("attr_http.target"));
assertEquals(deepPathUrl.getHost(), spanData.get("attr_net.host.name"));
assertEquals(deepPathUrl.getPort(), Integer.valueOf((String) spanData.get("attr_net.host.port")));
assertEquals("http", spanData.get("attr_http.scheme"));
assertEquals("200", spanData.get("attr_http.status_code"));
assertNotNull(spanData.get("attr_http.client_ip"));
assertNotNull(spanData.get("attr_http.user_agent"));
assertNotNull(spanData.get("attr_user_agent.original"));
}

@Test
Expand Down
Loading