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

[#3190] Use OpenTelemetry for tracing (via OpenTracing shim) #3205

Merged
merged 1 commit into from
Apr 20, 2022
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 .github/workflows/native-images-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
run: |
mvn install -B -e -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dquarkus.native.remote-container-build=false -Dquarkus.native.container-build=true \
-Pjaeger,build-native-image -am \
-Pbuild-native-image -am \
-pl :hono-service-auth-quarkus,:hono-service-command-router-quarkus,:hono-service-device-registry-mongodb-quarkus,\
:hono-adapter-mqtt-vertx-quarkus,:hono-adapter-amqp-vertx-quarkus,:hono-adapter-coap-vertx-quarkus,:hono-adapter-http-vertx-quarkus,\
:hono-tests
- name: "Build JDBC registry image"
run: |
mvn install -B -e -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Pjaeger,build-docker-image -am -pl :hono-service-device-registry-jdbc-quarkus
-Pbuild-docker-image -am -pl :hono-service-device-registry-jdbc-quarkus
- name: "Run integration tests with Mongo DB and Kafka"
run: |
mvn verify -pl :hono-tests -B -e -DCI=$CI \
Expand Down
71 changes: 24 additions & 47 deletions adapters/base-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry-exporter-otlp</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- JAX-RS API used by quarkus-opentelemetry; preferring Jakarta impl here over 'jboss-jaxrs-api_2.1_spec' used in quarkus -->
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
<dependency>
<!-- adding support for jaeger propagator -->
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-extension-trace-propagators</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
Expand Down Expand Up @@ -77,26 +101,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>quarkus.jaeger.metrics.enabled</name>
<value>${jaeger.metrics.enabled}</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -254,32 +258,5 @@
</dependency>
</dependencies>
</profile>

<profile>
<id>jaeger</id>
<activation>
<property>
<name>jaeger</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-micrometer</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaeger</artifactId>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
7 changes: 0 additions & 7 deletions adapters/coap-vertx-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
<artifactId>vertx-core</artifactId>
</dependency>

<!-- testing -->
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2019, 2021 Contributors to the Eclipse Foundation
* Copyright (c) 2019, 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -21,7 +21,6 @@

import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.coap.CoAP.ResponseCode;
import org.eclipse.californium.core.coap.OptionSet;
import org.eclipse.californium.core.coap.Response;
import org.eclipse.californium.core.network.Exchange;
import org.eclipse.californium.core.server.resources.CoapExchange;
Expand All @@ -36,9 +35,7 @@
import org.slf4j.LoggerFactory;

import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.tag.Tags;
import io.vertx.core.Future;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -149,16 +146,10 @@ public static String getAuthId(final CoapExchange exchange) {
return extPrincipal.getExtendedInfo().get(DeviceInfoSupplier.EXT_INFO_KEY_HONO_AUTH_ID, String.class);
}

private SpanContext extractSpanContextFromRequest(final OptionSet requestOptions) {
return CoapOptionInjectExtractAdapter.forExtraction(requestOptions)
.map(carrier -> tracer.extract(Format.Builtin.BINARY, carrier))
.orElse(null);
}

private Span newSpan(final Exchange exchange) {
return TracingHelper.buildServerChildSpan(
tracer,
extractSpanContextFromRequest(exchange.getRequest().getOptions()),
null,
exchange.getRequest().getCode().toString(),
adapter.getTypeName())
.withTag(Tags.HTTP_METHOD, exchange.getRequest().getCode().name())
Expand All @@ -177,11 +168,6 @@ private Span newSpan(final Exchange exchange) {
* associated with the {@link CoapContext} that is created by the <em>createCoapContextForXXX</em>
* method matching the request code. The {@link CoapContext} is then passed in to the corresponding
* <em>handleXXXX</em> method.
* <p>
* If the request contains the {@link CoapOptionInjectExtractAdapter#OPTION_TRACE_CONTEXT} option, its value
* is expected to be a binary encoded trace context and the {@link CoapOptionInjectExtractAdapter}
* is used to extract a {@code SpanContext} which is then used as the parent of the newly created
* {@code Span}.
*/
@Override
public void handleRequest(final Exchange exchange) {
Expand Down

This file was deleted.

Loading