diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 12ba92c88e127e..8d317925da1f72 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -33,7 +33,6 @@ 0.1.5 1.30.1 1.30.0-alpha - 1.8.1 5.0.3.Final 1.11.5 2.1.12 @@ -56,7 +55,6 @@ 4.0.0 3.7.0 2.5.1 - 3.0.3 6.2.6 4.3.1 2.1.0 @@ -1229,16 +1227,6 @@ quarkus-infinispan-client-deployment ${project.version} - - io.quarkus - quarkus-jaeger - ${project.version} - - - io.quarkus - quarkus-jaeger-deployment - ${project.version} - io.quarkus quarkus-jdbc-db2 @@ -1606,16 +1594,6 @@ quarkus-smallrye-graphql-client-deployment ${project.version} - - io.quarkus - quarkus-smallrye-opentracing - ${project.version} - - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - io.quarkus quarkus-smallrye-stork @@ -3389,52 +3367,6 @@ angus-activation ${angus-activation.version} - - io.jaegertracing - jaeger-core - ${jaeger.version} - - - io.jaegertracing - jaeger-thrift - ${jaeger.version} - - - org.apache.tomcat.embed - tomcat-embed-core - - - - javax.annotation - javax.annotation-api - - - - - org.apache.tomcat - tomcat-annotations-api - - - - - io.jaegertracing - jaeger-zipkin - ${jaeger.version} - - - commons-logging - commons-logging - - - javax.annotation - javax.annotation-api - - - org.apache.tomcat.embed - tomcat-embed-core - - - com.h2database h2 @@ -3955,22 +3887,6 @@ smallrye-graphql-client-implementation-vertx ${smallrye-graphql.version} - - io.smallrye - smallrye-opentracing - ${smallrye-opentracing.version} - - - org.eclipse.microprofile.config - microprofile-config-api - - - - - io.smallrye - smallrye-opentracing-contrib - ${smallrye-opentracing.version} - io.smallrye smallrye-fault-tolerance @@ -6307,6 +6223,26 @@ quarkus-opentelemetry-exporter-otlp ${project.version} + + io.quarkus + quarkus-jaeger + ${project.version} + + + io.quarkus + quarkus-jaeger-deployment + ${project.version} + + + io.quarkus + quarkus-smallrye-opentracing + ${project.version} + + + io.quarkus + quarkus-smallrye-opentracing-deployment + ${project.version} + diff --git a/core/deployment/src/main/java/io/quarkus/deployment/Capability.java b/core/deployment/src/main/java/io/quarkus/deployment/Capability.java index 5f3d5d46246d1f..73cd3cff70287d 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/Capability.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/Capability.java @@ -113,16 +113,8 @@ public interface Capability { String KEYCLOAK_AUTHORIZATION = QUARKUS_PREFIX + ".keycloak.authorization"; - /** - * Presence of an io.opentracing tracer (for example, Jaeger). - */ - String OPENTRACING = QUARKUS_PREFIX + ".opentracing"; - /** - * Presence of SmallRye OpenTracing. - */ String SCHEDULER = QUARKUS_PREFIX + ".scheduler"; - String SMALLRYE_OPENTRACING = QUARKUS_PREFIX + ".smallrye.opentracing"; String SMALLRYE_HEALTH = QUARKUS_PREFIX + ".smallrye.health"; String SMALLRYE_OPENAPI = QUARKUS_PREFIX + ".smallrye.openapi"; String SMALLRYE_GRAPHQL = QUARKUS_PREFIX + ".smallrye.graphql"; diff --git a/core/deployment/src/main/java/io/quarkus/deployment/Feature.java b/core/deployment/src/main/java/io/quarkus/deployment/Feature.java index cebff1c71facec..1f52df61cac15a 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/Feature.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/Feature.java @@ -38,7 +38,6 @@ public enum Feature { HIBERNATE_VALIDATOR, INFINISPAN_CLIENT, INFINISPAN_EMBEDDED, - JAEGER, JDBC_DB2, JDBC_DERBY, JDBC_H2, @@ -129,7 +128,6 @@ public enum Feature { SMALLRYE_JWT, SMALLRYE_METRICS, SMALLRYE_OPENAPI, - SMALLRYE_OPENTRACING, SMALLRYE_REACTIVE_MESSAGING, SMALLRYE_REACTIVE_MESSAGING_KAFKA, SMALLRYE_REACTIVE_MESSAGING_AMQP, diff --git a/devtools/bom-descriptor-json/pom.xml b/devtools/bom-descriptor-json/pom.xml index cbdbc050e4dfc4..02d144586d3ca9 100644 --- a/devtools/bom-descriptor-json/pom.xml +++ b/devtools/bom-descriptor-json/pom.xml @@ -928,19 +928,6 @@ - - io.quarkus - quarkus-jaeger - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-jaxb @@ -2514,19 +2501,6 @@ - - io.quarkus - quarkus-smallrye-opentracing - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-smallrye-reactive-messaging diff --git a/docs/pom.xml b/docs/pom.xml index ab9fe672999ad2..49d905f2374133 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -944,19 +944,6 @@ - - io.quarkus - quarkus-jaeger-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-jaxb-deployment @@ -2530,19 +2517,6 @@ - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-smallrye-reactive-messaging-deployment diff --git a/docs/src/main/asciidoc/mongodb.adoc b/docs/src/main/asciidoc/mongodb.adoc index a08b5a42a1257e..91f52129ce13c4 100644 --- a/docs/src/main/asciidoc/mongodb.adoc +++ b/docs/src/main/asciidoc/mongodb.adoc @@ -616,13 +616,6 @@ This behavior must first be enabled by setting the `quarkus.mongodb.metrics.enab So when you access the `/q/metrics` endpoint of your application you will have information about the connection pool status. When using xref:smallrye-metrics.adoc[SmallRye Metrics], connection pool metrics will be available under the `vendor` scope. -== Tracing - -If you are using the `quarkus-smallrye-opentracing` extension, `quarkus-mongodb-client` can register traces about the commands executed. -This behavior must be enabled by setting the `quarkus.mongodb.tracing.enabled` property to `true` in your `application.properties` and adding the dependency `io.opentracing.contrib:opentracing-mongo-common` to your pom.xml (for more info read the xref:opentracing.adoc#mongodb-client[OpenTracing - MongoDB client] section). - -Read the xref:opentracing.adoc[OpenTracing] guide, for how to configure OpenTracing and how to use the Jaeger tracer. - == Testing helpers xref:#dev-services[Dev Services for MongoDB] is your best option to start a MongoDB database for your unit tests. diff --git a/docs/src/main/asciidoc/opentracing.adoc b/docs/src/main/asciidoc/opentracing.adoc deleted file mode 100644 index c089dc6847c940..00000000000000 --- a/docs/src/main/asciidoc/opentracing.adoc +++ /dev/null @@ -1,354 +0,0 @@ -//// -This guide is maintained in the main Quarkus repository -and pull requests should be submitted there: -https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc -//// -= Using OpenTracing -:extension-status: deprecated -include::_attributes.adoc[] -:categories: observability -:summary: This guide explains how your Quarkus application can utilize OpenTracing to provide distributed tracing for interactive web applications. -:topics: observability,opentracing -:extensions: io.quarkus:quarkus-smallrye-opentracing - -This guide explains how your Quarkus application can utilize OpenTracing to provide distributed tracing for -interactive web applications. - -[IMPORTANT] -==== -xref:opentelemetry.adoc[OpenTelemetry] is the recommended approach to tracing and telemetry for Quarkus and xref:telemetry-opentracing-to-otel-tutorial.adoc[a guide to help with the migration] is available. - -When Quarkus will upgrade to Eclipse MicroProfile 6, the SmallRye OpenTracing support will be discontinued. -==== - -include::{includes}/extension-status.adoc[] - -== Prerequisites - -:prerequisites-docker: -include::{includes}/prerequisites.adoc[] - -== Architecture - -In this guide, we create a straightforward REST application to demonstrate distributed tracing. - -== Solution - -We recommend that you follow the instructions in the next sections and create the application step by step. -However, you can skip right to the completed example. - -Clone the Git repository: `git clone {quickstarts-clone-url}`, or download an {quickstarts-archive-url}[archive]. - -The solution is located in the `opentracing-quickstart` link:{quickstarts-tree-url}/opentracing-quickstart[directory]. - -== Creating the Maven project - -First, we need a new project. Create a new project with the following command: - -:create-app-artifact-id: opentracing-quickstart -:create-app-extensions: resteasy-reactive,quarkus-smallrye-opentracing -include::{includes}/devtools/create-app.adoc[] - -This command generates the Maven project and imports the `smallrye-opentracing` extension, which -includes the OpenTracing support and the default https://www.jaegertracing.io/[Jaeger] tracer. - -If you already have your Quarkus project configured, you can add the `smallrye-opentracing` extension -to your project by running the following command in your project base directory: - -:add-extension-extensions: smallrye-opentracing -include::{includes}/devtools/extension-add.adoc[] - -This will add the following to your build file: - -[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] -.pom.xml ----- - - io.quarkus - quarkus-smallrye-opentracing - ----- - -[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] -.build.gradle ----- -implementation("io.quarkus:quarkus-smallrye-opentracing") ----- - -=== Examine the Jakarta REST resource - -Create the `src/main/java/org/acme/opentracing/TracedResource.java` file with the following content: - -[source,java] ----- -package org.acme.opentracing; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import org.jboss.logging.Logger; - -@Path("/hello") -public class TracedResource { - - private static final Logger LOG = Logger.getLogger(TracedResource.class); - - @GET - @Produces(MediaType.TEXT_PLAIN) - public String hello() { - LOG.info("hello"); // <1> - return "hello"; - } -} ----- - -<1> The log event carries OpenTracing information as well. In order to print OpenTracing information to the console output, the console log handler with the required OpenTracing event's keys needs to be defined in the `application.properties` file. - -Notice that there is no tracing specific code included in the application. By default, requests sent to this -endpoint will be traced without any code changes being required. It is also possible to enhance the tracing information. -This can be achieved by https://github.com/smallrye/smallrye-opentracing/[SmallRye OpenTracing] an implementation of -https://github.com/eclipse/microprofile-opentracing/[MicroProfile OpenTracing]. - -=== Create the configuration - -There are two ways to configure the Jaeger tracer within the application. - -The first approach is by providing the properties within the `src/main/resources/application.properties` file: - -[source,properties] ----- -quarkus.jaeger.service-name=myservice // <1> -quarkus.jaeger.sampler-type=const // <2> -quarkus.jaeger.sampler-param=1 // <3> -quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n // <4> ----- - -<1> If the `quarkus.jaeger.service-name` property (or `JAEGER_SERVICE_NAME` environment variable) is not provided then a "no-op" tracer will be configured, resulting in no tracing data being reported to the backend. -<2> Set up a sampler that uses a constant sampling strategy. -<3> Sample all requests. Set sampler-param to somewhere between 0 and 1, e.g. 0.50, if you do not wish to sample all requests. -<4> Add trace IDs into log message. - -The second approach is to supply the properties as https://www.jaegertracing.io/docs/latest/client-features/[environment variables]. These can be specified using `jvm.args` as shown in the following section. - -== Run the application - -The first step is to start the tracing system to collect and display the captured traces: - -[source,bash] ----- -docker run -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 jaegertracing/all-in-one:latest ----- - -Now we are ready to run our application. If using `application.properties` to configure the tracer: - -include::{includes}/devtools/dev.adoc[] - -or if configuring the tracer via environment variables: - -:dev-additional-parameters: -Djvm.args="-DJAEGER_SERVICE_NAME=myservice -DJAEGER_SAMPLER_TYPE=const -DJAEGER_SAMPLER_PARAM=1" -include::{includes}/devtools/dev.adoc[] -:!dev-additional-parameters: - -Once both the application and tracing system are started, you can make a request to the provided endpoint: - -[source,shell] ----- -$ curl http://localhost:8080/hello -hello ----- -When the first request has been submitted, the Jaeger tracer within the app will be initialized: - -[source] ----- -2019-10-16 09:35:23,464 INFO [io.jae.Configuration] (executor-thread-1) Initialized tracer=JaegerTracer(version=Java-0.34.0, serviceName=myservice, reporter=RemoteReporter(sender=UdpSender(), closeEnqueueTimeout=1000), sampler=ConstSampler(decision=true, tags={sampler.type=const, sampler.param=true}), tags={hostname=localhost.localdomain, jaeger.version=Java-0.34.0, ip=127.0.0.1}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false) -13:20:11 INFO traceId=1336b2b0a76a96a3, parentId=0, spanId=1336b2b0a76a96a3, sampled=true [or.ac.qu.TracedResource] (executor-thread-63) hello ----- - -Then visit the http://localhost:16686[Jaeger UI] to see the tracing information. - -Hit `CTRL+C` to stop the application. - -== Tracing additional methods - -REST endpoints are automatically traced. -If you need to trace additional methods, you can add the `org.eclipse.microprofile.opentracing.Traced` annotation to CDI bean classes or their non-private methods. - -This can be useful to trace incoming requests from non-REST calls (like request coming from a message) or to create spans inside a trace. - -Here is an example of a `FrancophoneService` which methods are traced. - -[source, java] ----- -import jakarta.enterprise.context.ApplicationScoped; - -import org.eclipse.microprofile.opentracing.Traced; - -@Traced -@ApplicationScoped -public class FrancophoneService { - - public String bonjour() { - return "bonjour"; - } -} ----- - -NOTE: The best way to add OpenTracing capability to reactive messaging based applications is by adding the `Traced` annotation to all incoming methods. - -== Additional instrumentation - -The https://github.com/opentracing-contrib[OpenTracing API Contributions project] offers additional instrumentation that can be used to add tracing to a large variety of technologies/components. - -The instrumentation documented in this section has been tested with Quarkus and works in both standard and native mode. - -=== JDBC - -The https://github.com/opentracing-contrib/java-jdbc[JDBC instrumentation] will add a span for each JDBC queries done by your application, to enable it, add the following dependency to your build file: - -[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] -.pom.xml ----- - - io.opentracing.contrib - opentracing-jdbc - ----- - -[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] -.build.gradle ----- -implementation("io.opentracing.contrib:opentracing-jdbc") ----- - -Then, you need to enable it in the configuration: - -[source, properties] ----- -quarkus.datasource.jdbc.tracing=true ----- - -`quarkus.datasource.jdbc.tracing` is a build time configuration property: -it makes sure all the tracing infrastructure is included in your application. - -[NOTE] -==== -This is especially important when building a native executable as we need to -make sure the OpenTracing JDBC driver has been registered for reflection, -together with the underlying JDBC driver. -==== - -The Agroal extension will take care of adjusting the JDBC URL with the `tracing` prefix -when tracing is enabled, -so you do not have to adjust the JDBC URL yourself. - -By default, when `quarkus.datasource.jdbc.tracing` is true, tracing is enabled at runtime -but you can explicitly disable it by setting the following property: - -[source, properties] ----- -quarkus.datasource.jdbc.tracing.enabled=false ----- - -This way, you can have your Quarkus application ready for tracing and toggle JDBC tracing at runtime. - -=== Kafka - -The https://github.com/opentracing-contrib/java-kafka-client[Kafka instrumentation] will add a span for each message sent to or received from a Kafka topic. To enable it, add the following dependency to your build file: - -[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] -.pom.xml ----- - - io.opentracing.contrib - opentracing-kafka-client - ----- - -[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] -.build.gradle ----- -implementation("io.opentracing.contrib:opentracing-kafka-client") ----- - -It contains OpenTracing interceptors that must be registered on Kafka producers and consumers. - -If you followed the xref:kafka.adoc[Kafka guide], the interceptors can be added on the `generated-price` and the `prices` channels as follows: - -[source, properties] ----- -# Configure the Kafka sink (we write to it) -mp.messaging.outgoing.generated-price.connector=smallrye-kafka -mp.messaging.outgoing.generated-price.topic=prices -mp.messaging.outgoing.generated-price.value.serializer=org.apache.kafka.common.serialization.IntegerSerializer -mp.messaging.outgoing.generated-price.interceptor.classes=io.opentracing.contrib.kafka.TracingProducerInterceptor - -# Configure the Kafka source (we read from it) -mp.messaging.incoming.prices.connector=smallrye-kafka -mp.messaging.incoming.prices.value.deserializer=org.apache.kafka.common.serialization.IntegerDeserializer -mp.messaging.incoming.prices.interceptor.classes=io.opentracing.contrib.kafka.TracingConsumerInterceptor ----- - -NOTE: `interceptor.classes` accept a list of classes separated by a comma. - - -=== MongoDB client - -The https://github.com/opentracing-contrib/java-mongo-driver[Mongo Driver instrumentation] will add a span for each command executed by your application. To enable it, add the following dependency to your build file: - -[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] -.pom.xml ----- - - io.opentracing.contrib - opentracing-mongo-common - ----- - -[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] -.build.gradle ----- -implementation("io.opentracing.contrib:opentracing-mongo-common") ----- - -It contains the OpenTracing CommandListener that will be registered on the configuration of the mongo client. -Following the xref:mongodb.adoc[MongoDB guide], the command listener will be registered defining the config property as follows: - -[source, properties] ----- -# Enable tracing commands in mongodb client -quarkus.mongodb.tracing.enabled=true ----- - -=== Zipkin compatibility mode - -To enable it, add the following dependency to your build file: - -[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] -.pom.xml ----- - - io.jaegertracing - jaeger-zipkin - ----- - -[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] -.build.gradle ----- -implementation("io.jaegertracing:jaeger-zipkin") ----- - -It contains the dependencies to convert the request to zipkin format. -The zipkin compatibility mode will be activated after defining the config property as follows: - -[source, properties] ----- -# Enable zipkin compatibility mode -quarkus.jaeger.zipkin.compatibility-mode=true ----- - -[[configuration-reference]] -== Jaeger Configuration Reference - -include::{generated-dir}/config/quarkus-jaeger.adoc[leveloffset=+1, opts=optional] diff --git a/docs/src/main/asciidoc/reaugmentation.adoc b/docs/src/main/asciidoc/reaugmentation.adoc index 0c5c976565bdc1..3458f8ffac0978 100644 --- a/docs/src/main/asciidoc/reaugmentation.adoc +++ b/docs/src/main/asciidoc/reaugmentation.adoc @@ -27,7 +27,7 @@ It doesn't matter if you use profiles or any other way to override the propertie == When is re-augmentation useful? Re-augmentation is useful in case the users of your application want to be able to change some of its build time properties. -For instance changing the database driver or switching features on or off (e.g. xref:opentracing.adoc[OpenTracing] or link:{config-consul-guide}[Config Consul]). +For instance changing the database driver or switching features on or off (e.g. xref:opentelemetry.adoc[OpenTelemetry] or link:{config-consul-guide}[Config Consul]). If there are only two or three build time properties that depend on the user environment, you may consider providing alternative builds of the application. However, in case there are more such properties you may prefer shipping a mutable jar instead and let your users re-augment the application for their environment. Please notice that you won't be able to use native images with the package type `mutable-jar`. Think of the consequences and what other options you have! diff --git a/docs/src/main/asciidoc/telemetry-opentracing-to-otel-tutorial.adoc b/docs/src/main/asciidoc/telemetry-opentracing-to-otel-tutorial.adoc index 63348b95ea7f13..66046da5280106 100644 --- a/docs/src/main/asciidoc/telemetry-opentracing-to-otel-tutorial.adoc +++ b/docs/src/main/asciidoc/telemetry-opentracing-to-otel-tutorial.adoc @@ -11,7 +11,7 @@ include::_attributes.adoc[] :topics: observability,opentracing,opentelemetry,tracing,migration :extensions: io.quarkus:quarkus-smallrye-opentracing,io.quarkus:quarkus-opentelemetry -Migrate an application from xref:opentracing.adoc[OpenTracing] to xref:opentelemetry.adoc[OpenTelemetry tracing] in Quarkus 3.x. +Migrate an application from https://docs.quarkiverse.io/quarkus-smallrye-opentracing/dev/index.html[OpenTracing] to xref:opentelemetry.adoc[OpenTelemetry tracing] in Quarkus 3.x. The legacy OpenTracing framework has been deprecated in favor of the new OpenTelemetry tracing framework. We announced the https://quarkus.io/blog/quarkus-observability-roadmap-2023/#opentracing-archived[OpenTracing deprecation on November 2022], and we are dropping the extension from Quarkus core repository and moving it to the Quarkiverse Hub. diff --git a/extensions/jaeger/deployment/pom.xml b/extensions/jaeger/deployment/pom.xml deleted file mode 100644 index 5b8ad53ce4b328..00000000000000 --- a/extensions/jaeger/deployment/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - quarkus-jaeger-parent - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - quarkus-jaeger-deployment - Quarkus - Jaeger - Deployment - - - - io.quarkus - quarkus-core-deployment - - - io.quarkus - quarkus-jaeger - - - jakarta.enterprise - jakarta.enterprise.cdi-api - - - - io.quarkus - quarkus-junit5-internal - test - - - io.quarkus - quarkus-arc-deployment - - - io.quarkus - quarkus-smallrye-metrics-deployment - test - - - org.mockito - mockito-core - test - - - io.jaegertracing - jaeger-zipkin - test - - - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerAlwaysEnabledProcessor.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerAlwaysEnabledProcessor.java deleted file mode 100644 index cb3ad4f399dc1e..00000000000000 --- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerAlwaysEnabledProcessor.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.quarkus.jaeger.deployment; - -import io.quarkus.deployment.Feature; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.FeatureBuildItem; - -// Executed even if the extension is disabled, see https://github.com/quarkusio/quarkus/pull/26966/ -public class JaegerAlwaysEnabledProcessor { - - @BuildStep - public FeatureBuildItem build() { - return new FeatureBuildItem(Feature.JAEGER); - } - -} diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerEnabled.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerEnabled.java deleted file mode 100644 index 8f6b2e781b5897..00000000000000 --- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerEnabled.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.quarkus.jaeger.deployment; - -import java.util.function.BooleanSupplier; - -import io.quarkus.jaeger.runtime.JaegerBuildTimeConfig; - -public class JaegerEnabled implements BooleanSupplier { - - private final JaegerBuildTimeConfig buildTimeConfig; - - public JaegerEnabled(JaegerBuildTimeConfig buildTimeConfig) { - this.buildTimeConfig = buildTimeConfig; - } - - @Override - public boolean getAsBoolean() { - return buildTimeConfig.enabled; - } - -} diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java deleted file mode 100644 index 838ed596dfd697..00000000000000 --- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java +++ /dev/null @@ -1,62 +0,0 @@ -package io.quarkus.jaeger.deployment; - -import java.util.Optional; - -import io.jaegertracing.internal.JaegerTracer; -import io.quarkus.deployment.Feature; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.BuildSteps; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; -import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; -import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import io.quarkus.deployment.metrics.MetricsCapabilityBuildItem; -import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; -import io.quarkus.jaeger.runtime.JaegerBuildTimeConfig; -import io.quarkus.jaeger.runtime.JaegerConfig; -import io.quarkus.jaeger.runtime.JaegerDeploymentRecorder; -import io.quarkus.jaeger.runtime.ZipkinConfig; -import io.quarkus.runtime.ApplicationConfig; -import io.quarkus.runtime.metrics.MetricsFactory; - -@BuildSteps(onlyIf = JaegerEnabled.class) -public class JaegerProcessor { - - @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) - @Record(ExecutionTime.STATIC_INIT) - void setVersion(JaegerDeploymentRecorder jdr) { - jdr.setJaegerVersion(JaegerTracer.getVersionFromProperties()); - } - - @BuildStep - @Record(ExecutionTime.RUNTIME_INIT) - ExtensionSslNativeSupportBuildItem setupTracer(JaegerDeploymentRecorder jdr, JaegerBuildTimeConfig buildTimeConfig, - JaegerConfig jaeger, ApplicationConfig appConfig, Optional metricsCapability, - ZipkinConfig zipkinConfig) { - - if (buildTimeConfig.metricsEnabled && metricsCapability.isPresent()) { - if (metricsCapability.get().metricsSupported(MetricsFactory.MICROMETER)) { - jdr.registerTracerWithMicrometerMetrics(jaeger, appConfig, zipkinConfig); - } else { - jdr.registerTracerWithMpMetrics(jaeger, appConfig, zipkinConfig); - } - } else { - jdr.registerTracerWithoutMetrics(jaeger, appConfig, zipkinConfig); - } - - // Indicates that this extension would like the SSL support to be enabled - return new ExtensionSslNativeSupportBuildItem(Feature.JAEGER.getName()); - } - - @BuildStep - public ReflectiveClassBuildItem reflectiveClasses() { - return ReflectiveClassBuildItem - .builder("io.jaegertracing.internal.samplers.http.OperationSamplingParameters", - "io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters", - "io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy", - "io.jaegertracing.internal.samplers.http.RateLimitingSamplingStrategy", - "io.jaegertracing.internal.samplers.http.SamplingStrategyResponse") - .fields() - .build(); - } -} diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/ZipkinProcessor.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/ZipkinProcessor.java deleted file mode 100644 index f22d6af0c82b08..00000000000000 --- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/ZipkinProcessor.java +++ /dev/null @@ -1,35 +0,0 @@ -package io.quarkus.jaeger.deployment; - -import java.util.function.BooleanSupplier; - -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.BuildSteps; -import io.quarkus.jaeger.runtime.JaegerDeploymentRecorder; -import io.quarkus.jaeger.runtime.ZipkinConfig; -import io.quarkus.jaeger.runtime.ZipkinReporterProvider; - -@BuildSteps(onlyIf = ZipkinProcessor.ZipkinEnabled.class) -public class ZipkinProcessor { - - static final String REGISTRY_CLASS_NAME = "zipkin2.reporter.urlconnection.URLConnectionSender"; - static final Class REGISTRY_CLASS = JaegerDeploymentRecorder.getClassForName(REGISTRY_CLASS_NAME); - - public static class ZipkinEnabled implements BooleanSupplier { - ZipkinConfig config; - - public boolean getAsBoolean() { - return REGISTRY_CLASS != null && config.compatibilityMode; - } - } - - @BuildStep - void addZipkinClasses(BuildProducer additionalBeans) { - - // Add Zipkin classes - additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(ZipkinReporterProvider.class) - .setUnremovable().build()); - - } -} diff --git a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/CommaParseJaegerConfigurationTest.java b/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/CommaParseJaegerConfigurationTest.java deleted file mode 100644 index a6400b1e1db244..00000000000000 --- a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/CommaParseJaegerConfigurationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package io.quarkus.jaeger.test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.text.NumberFormat; -import java.util.Locale; - -import jakarta.inject.Inject; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.jaegertracing.Configuration.SamplerConfiguration; -import io.quarkus.jaeger.runtime.JaegerConfig; -import io.quarkus.test.QuarkusUnitTest; - -/** - * Some Locales, like FRENCH use a different separator between the integer and the fraction part. The internal - * Jaeger configuration, read the value with the default locale, so we need the config to write the value to Jaeger in - * the same expected format. - */ -public class CommaParseJaegerConfigurationTest { - private static final Locale DEFAULT_LOCALE = Locale.getDefault(); - - @RegisterExtension - static final QuarkusUnitTest TEST = new QuarkusUnitTest().withEmptyApplication() - .setBeforeAllCustomizer(() -> Locale.setDefault(Locale.FRENCH)) - .setAfterAllCustomizer(() -> Locale.setDefault(DEFAULT_LOCALE)) - .overrideConfigKey("quarkus.jaeger.sampler-type", "probabilistic") - .overrideConfigKey("quarkus.jaeger.sampler-param", "0.5"); - - @Inject - JaegerConfig jaegerConfig; - - @Test - void localeParse() { - assertEquals("0,5", NumberFormat.getInstance().format(jaegerConfig.samplerParam.get())); - - SamplerConfiguration samplerConfiguration = SamplerConfiguration.fromEnv(); - assertEquals(0.5d, samplerConfiguration.getParam().doubleValue()); - } -} diff --git a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/JaegerMetricsTestCase.java b/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/JaegerMetricsTestCase.java deleted file mode 100644 index 3e0c864aeee0ad..00000000000000 --- a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/JaegerMetricsTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.quarkus.jaeger.test; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.util.Set; -import java.util.stream.Collectors; - -import jakarta.inject.Inject; - -import org.eclipse.microprofile.metrics.MetricID; -import org.eclipse.microprofile.metrics.MetricRegistry; -import org.eclipse.microprofile.metrics.annotation.RegistryType; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.quarkus.test.QuarkusUnitTest; - -public class JaegerMetricsTestCase { - - @RegisterExtension - static final QuarkusUnitTest config = new QuarkusUnitTest() - .withEmptyApplication() - .withConfigurationResource("application-metrics-enabled.properties"); - - @Inject - @RegistryType(type = MetricRegistry.Type.VENDOR) - MetricRegistry registry; - - /** - * We're not running a Jaeger instance to be able to test anything thoroughly, - * so just check that the metrics are registered after start. - */ - @Test - public void test() { - Set registeredMetrics = registry.getMetrics().keySet().stream().map(MetricID::getName) - .collect(Collectors.toSet()); - assertTrue(registeredMetrics.contains("jaeger_tracer_baggage_restrictions_updates")); - assertTrue(registeredMetrics.contains("jaeger_tracer_baggage_updates")); - assertTrue(registeredMetrics.contains("jaeger_tracer_baggage_truncations")); - assertTrue(registeredMetrics.contains("jaeger_tracer_finished_spans")); - assertTrue(registeredMetrics.contains("jaeger_tracer_reporter_queue_length")); - assertTrue(registeredMetrics.contains("jaeger_tracer_reporter_spans")); - assertTrue(registeredMetrics.contains("jaeger_tracer_sampler_queries")); - assertTrue(registeredMetrics.contains("jaeger_tracer_sampler_updates")); - assertTrue(registeredMetrics.contains("jaeger_tracer_span_context_decoding_errors")); - assertTrue(registeredMetrics.contains("jaeger_tracer_started_spans")); - assertTrue(registeredMetrics.contains("jaeger_tracer_traces")); - } - -} diff --git a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/NestedMdcScopesTest.java b/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/NestedMdcScopesTest.java deleted file mode 100644 index e3a9302a3dafbd..00000000000000 --- a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/NestedMdcScopesTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package io.quarkus.jaeger.test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertSame; - -import java.util.Map; - -import org.jboss.logging.MDC; -import org.junit.jupiter.api.Test; - -import io.jaegertracing.internal.JaegerSpanContext; -import io.opentracing.Scope; -import io.opentracing.Span; -import io.opentracing.SpanContext; -import io.opentracing.tag.Tag; -import io.opentracing.util.ThreadLocalScopeManager; -import io.quarkus.jaeger.runtime.MDCScopeManager; - -public class NestedMdcScopesTest { - @Test - public void mdcIsRestoredCorrectly() { - ThreadLocalScopeManager threadLocalScopeManager = new ThreadLocalScopeManager(); - MDCScopeManager mdcScopeManager = new MDCScopeManager(threadLocalScopeManager); - - assertNull(mdcScopeManager.activeSpan()); - assertNull(threadLocalScopeManager.activeSpan()); - assertNull(MDC.get("traceId")); - assertNull(MDC.get("parentId")); - - JaegerSpanContext span = new JaegerSpanContext(1, 1, 1, 0, Byte.parseByte("0")); - Scope scope = mdcScopeManager.activate(new TestSpan(span)); - assertSame(span, threadLocalScopeManager.activeSpan().context()); - assertEquals("00000000000000010000000000000001", MDC.get("traceId")); - assertEquals("0", MDC.get("parentId")); - - JaegerSpanContext subSpan = new JaegerSpanContext(2, 2, 2, 1, Byte.parseByte("0")); - Scope subScope = mdcScopeManager.activate(new TestSpan(subSpan)); - assertSame(subSpan, threadLocalScopeManager.activeSpan().context()); - assertEquals("00000000000000020000000000000002", MDC.get("traceId")); - assertEquals("1", MDC.get("parentId")); - - subScope.close(); - - assertSame(span, threadLocalScopeManager.activeSpan().context()); - assertEquals("00000000000000010000000000000001", MDC.get("traceId")); - assertEquals("0", MDC.get("parentId")); - - scope.close(); - - assertNull(mdcScopeManager.activeSpan()); - assertNull(threadLocalScopeManager.activeSpan()); - assertNull(MDC.get("traceId")); - assertNull(MDC.get("parentId")); - } - - static class TestSpan implements Span { - private final SpanContext spanContext; - - TestSpan(SpanContext spanContext) { - this.spanContext = spanContext; - } - - @Override - public SpanContext context() { - return spanContext; - } - - @Override - public Span setTag(String key, String value) { - return this; - } - - @Override - public Span setTag(String key, boolean value) { - return this; - } - - @Override - public Span setTag(String key, Number value) { - return this; - } - - @Override - public Span setTag(final Tag tag, final T value) { - return this; - } - - @Override - public Span log(Map fields) { - return this; - } - - @Override - public Span log(long timestampMicroseconds, Map fields) { - return this; - } - - @Override - public Span log(String event) { - return this; - } - - @Override - public Span log(long timestampMicroseconds, String event) { - return this; - } - - @Override - public Span setBaggageItem(String key, String value) { - return this; - } - - @Override - public String getBaggageItem(String key) { - return null; - } - - @Override - public Span setOperationName(String operationName) { - return this; - } - - @Override - public void finish() { - } - - @Override - public void finish(long finishMicros) { - } - } -} diff --git a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/QuarkusJaegerTracerTest.java b/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/QuarkusJaegerTracerTest.java deleted file mode 100644 index 1302b401001b87..00000000000000 --- a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/QuarkusJaegerTracerTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package io.quarkus.jaeger.test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -import jakarta.enterprise.inject.Default; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.spi.CDI; - -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.MockedStatic; -import org.mockito.Mockito; - -import io.jaegertracing.Configuration; -import io.jaegertracing.internal.JaegerTracer; -import io.jaegertracing.internal.JaegerTracer.Builder; -import io.jaegertracing.spi.Reporter; -import io.jaegertracing.zipkin.ZipkinV2Reporter; -import io.opentracing.Tracer; -import io.quarkus.jaeger.runtime.QuarkusJaegerTracer; -import io.quarkus.jaeger.runtime.ReporterFactory; -import io.quarkus.jaeger.runtime.ZipkinReporterFactoryImpl; - -public class QuarkusJaegerTracerTest { - - @Test - @SuppressWarnings("unchecked") - public void withZipkinCompatibilityMode() { - - try (MockedStatic mockedStaticConfiguration = Mockito.mockStatic(Configuration.class); - MockedStatic mockedStaticCDI = Mockito.mockStatic(CDI.class)) { - - CDI mockedCDI = (CDI) Mockito.mock(CDI.class); - - mockedStaticCDI.when(() -> CDI.current()).thenReturn(mockedCDI); - - Instance instanceCDI = Mockito.mock(Instance.class); - Mockito.when(instanceCDI.isAmbiguous()).thenReturn(false); - Mockito.when(instanceCDI.isUnsatisfied()).thenReturn(false); - Mockito.when(instanceCDI.get()).thenReturn(new ZipkinReporterFactoryImpl()); - Mockito.when(mockedCDI.select(ReporterFactory.class, Default.Literal.INSTANCE)).thenReturn(instanceCDI); - - Configuration mockedInstanceConfiguration = Mockito.mock(Configuration.class); - Builder mockedBuilder = Mockito.mock(Builder.class); - Tracer mockedTracer = Mockito.mock(JaegerTracer.class); - - mockedStaticConfiguration.when(() -> Configuration.fromEnv()).thenReturn(mockedInstanceConfiguration); - mockedStaticConfiguration.when(() -> mockedInstanceConfiguration.withMetricsFactory(Mockito.any())) - .thenReturn(mockedInstanceConfiguration); - mockedStaticConfiguration.when(() -> mockedInstanceConfiguration.getTracerBuilder()) - .thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.withScopeManager(Mockito.any())) - .thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.withReporter(Mockito.any())).thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.build()).thenReturn(mockedTracer); - - QuarkusJaegerTracer tracer = new QuarkusJaegerTracer(); - tracer.setZipkinCompatibilityMode(true); - tracer.setEndpoint("http://localhost"); - tracer.toString(); - tracer.close(); - - ArgumentCaptor argument = ArgumentCaptor.forClass(Reporter.class); - Mockito.verify(mockedBuilder).withReporter(argument.capture()); - assertEquals(ZipkinV2Reporter.class, argument.getValue().getClass()); - } - - } - - @Test - public void withoutZipkinCompatibilityMode() { - try (MockedStatic mockedStaticConfiguration = Mockito.mockStatic(Configuration.class)) { - Configuration mockedInstanceConfiguration = Mockito.mock(Configuration.class); - Builder mockedBuilder = Mockito.mock(Builder.class); - Tracer mockedTracer = Mockito.mock(JaegerTracer.class); - - mockedStaticConfiguration.when(() -> Configuration.fromEnv()).thenReturn(mockedInstanceConfiguration); - mockedStaticConfiguration.when(() -> mockedInstanceConfiguration.withMetricsFactory(Mockito.any())) - .thenReturn(mockedInstanceConfiguration); - mockedStaticConfiguration.when(() -> mockedInstanceConfiguration.getTracerBuilder()) - .thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.withScopeManager(Mockito.any())) - .thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.withReporter(Mockito.any())).thenReturn(mockedBuilder); - mockedStaticConfiguration.when(() -> mockedBuilder.build()).thenReturn(mockedTracer); - - QuarkusJaegerTracer tracer = new QuarkusJaegerTracer(); - tracer.toString(); - tracer.close(); - - ArgumentCaptor argument = ArgumentCaptor.forClass(Reporter.class); - Mockito.verify(mockedBuilder).withReporter(argument.capture()); - assertNull(argument.getValue()); - } - } - -} diff --git a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/SamplerManagerConfigurationTest.java b/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/SamplerManagerConfigurationTest.java deleted file mode 100644 index 4670994e413038..00000000000000 --- a/extensions/jaeger/deployment/src/test/java/io/quarkus/jaeger/test/SamplerManagerConfigurationTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.quarkus.jaeger.test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.jaegertracing.Configuration.SamplerConfiguration; -import io.quarkus.test.QuarkusUnitTest; - -/** - * Tests verifying configuration of a remote sampler manager. - * - */ -public class SamplerManagerConfigurationTest { - - @RegisterExtension - static final QuarkusUnitTest TEST = new QuarkusUnitTest().withEmptyApplication() - .overrideConfigKey("quarkus.jaeger.service-name", "my-service") - .overrideConfigKey("quarkus.jaeger.sampler-manager-host-port", "my-jaeger-host:5778"); - - /** - * Verifies that the {@code JAEGER_SAMPLER_MANAGER_HOST_PORT} system property is set to the - * host name and port specified in the {@code quarkus.jaeger.sampler-manager-host-port} property. - */ - @Test - void testSamplerManagerHostIsSetCorrectly() { - SamplerConfiguration config = SamplerConfiguration.fromEnv(); - assertEquals("my-jaeger-host:5778", config.getManagerHostPort()); - } -} diff --git a/extensions/jaeger/deployment/src/test/resources/application-metrics-enabled.properties b/extensions/jaeger/deployment/src/test/resources/application-metrics-enabled.properties deleted file mode 100644 index 2169673f845b3b..00000000000000 --- a/extensions/jaeger/deployment/src/test/resources/application-metrics-enabled.properties +++ /dev/null @@ -1 +0,0 @@ -quarkus.jaeger.metrics.enabled=true \ No newline at end of file diff --git a/extensions/jaeger/pom.xml b/extensions/jaeger/pom.xml deleted file mode 100644 index ce8b0cf8de313b..00000000000000 --- a/extensions/jaeger/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - quarkus-extensions-parent - io.quarkus - 999-SNAPSHOT - ../pom.xml - - 4.0.0 - - quarkus-jaeger-parent - Quarkus - Jaeger - pom - - deployment - runtime - - diff --git a/extensions/jaeger/runtime/pom.xml b/extensions/jaeger/runtime/pom.xml deleted file mode 100644 index 3fb5faa0535264..00000000000000 --- a/extensions/jaeger/runtime/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - quarkus-jaeger-parent - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - quarkus-jaeger - Quarkus - Jaeger - Runtime - Trace your services with Jaeger - - - io.quarkus - quarkus-core - - - io.jaegertracing - jaeger-core - - - io.jaegertracing - jaeger-thrift - - - io.quarkus - quarkus-arc - - - io.jaegertracing - jaeger-zipkin - true - - - - org.eclipse.angus - angus-activation - - - jakarta.annotation - jakarta.annotation-api - - - org.graalvm.sdk - graal-sdk - provided - - - io.quarkus - quarkus-smallrye-metrics - true - - - io.micrometer - micrometer-core - true - - - - - - - io.quarkus - quarkus-extension-maven-plugin - - - - io.quarkus.jaeger.deployment.JaegerEnabled - io.quarkus.opentracing - - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerBuildTimeConfig.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerBuildTimeConfig.java deleted file mode 100644 index e63255fc5d5c27..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerBuildTimeConfig.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConfigRoot; - -/** - * The Jaeger build time configuration. - */ -@ConfigRoot -public class JaegerBuildTimeConfig { - /** - * Defines if the Jaeger extension is enabled. - */ - @ConfigItem(defaultValue = "true") - public boolean enabled; - - /** - * Whether metrics are published in case a metrics extension is present. - */ - @ConfigItem(name = "metrics.enabled", defaultValue = "false") - public boolean metricsEnabled; - -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerConfig.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerConfig.java deleted file mode 100644 index 8982c215804ae4..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerConfig.java +++ /dev/null @@ -1,128 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import java.math.BigDecimal; -import java.net.InetSocketAddress; -import java.net.URI; -import java.time.Duration; -import java.util.Optional; -import java.util.OptionalInt; - -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConfigPhase; -import io.quarkus.runtime.annotations.ConfigRoot; - -/** - * The Jaeger configuration. - */ -@ConfigRoot(phase = ConfigPhase.RUN_TIME) -public class JaegerConfig { - - /** - * The traces endpoint, in case the client should connect directly to the Collector, - * like http://jaeger-collector:14268/api/traces - */ - @ConfigItem - public Optional endpoint; - - /** - * Authentication Token to send as "Bearer" to the endpoint - */ - @ConfigItem - public Optional authToken; - - /** - * Username to send as part of "Basic" authentication to the endpoint - */ - @ConfigItem - public Optional user; - - /** - * Password to send as part of "Basic" authentication to the endpoint - */ - @ConfigItem - public Optional password; - - /** - * The hostname and port for communicating with agent via UDP - */ - @ConfigItem - public Optional agentHostPort; - - /** - * Whether the reporter should also log the spans - */ - @ConfigItem - public Optional reporterLogSpans; - - /** - * The reporter's maximum queue size - */ - @ConfigItem - public OptionalInt reporterMaxQueueSize; - - /** - * The reporter's flush interval - */ - @ConfigItem - public Optional reporterFlushInterval; - - /** - * The sampler type (const, probabilistic, ratelimiting or remote) - */ - @ConfigItem - public Optional samplerType; - - /** - * The sampler parameter (number) - */ - @ConfigItem - public Optional samplerParam; - - /** - * The host name and port when using the remote controlled sampler - */ - @ConfigItem - public Optional samplerManagerHostPort; - - /** - * The service name - */ - @ConfigItem - public Optional serviceName; - - /** - * A comma separated list of name = value tracer level tags, which get added to all reported - * spans. The value can also refer to an environment variable using the format ${envVarName:default}, - * where the :default is optional, and identifies a value to be used if the environment variable - * cannot be found - */ - @ConfigItem - public Optional tags; - - /** - * Comma separated list of formats to use for propagating the trace context. Defaults to the - * standard Jaeger format. Valid values are jaeger and b3 - */ - @ConfigItem - public Optional propagation; - - /** - * The sender factory class name - */ - @ConfigItem - public Optional senderFactory; - - /** - * Whether the trace context should be logged. - */ - @ConfigItem(defaultValue = "true") - public Boolean logTraceContext; - - /** - * Whether the registration of tracer as the global tracer should be disabled. - * This setting should only be turned on in tests that need to install a mock tracer. - */ - @ConfigItem(defaultValue = "false") - public Boolean disableTracerRegistration; - -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java deleted file mode 100644 index 5a9f6ae128608b..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java +++ /dev/null @@ -1,116 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import java.text.NumberFormat; -import java.util.Optional; -import java.util.OptionalInt; -import java.util.function.Function; - -import org.jboss.logging.Logger; - -import io.jaegertracing.internal.metrics.NoopMetricsFactory; -import io.jaegertracing.spi.MetricsFactory; -import io.opentracing.util.GlobalTracer; -import io.quarkus.runtime.ApplicationConfig; -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class JaegerDeploymentRecorder { - private static final Logger log = Logger.getLogger(JaegerDeploymentRecorder.class); - private static final Optional UNKNOWN_SERVICE_NAME = Optional.of("quarkus/unknown"); - private static final QuarkusJaegerTracer quarkusTracer = new QuarkusJaegerTracer(); - - public static String jaegerVersion; - - public void setJaegerVersion(String version) { - jaegerVersion = version; - } - - /* RUNTIME_INIT */ - public void registerTracerWithoutMetrics(JaegerConfig jaeger, ApplicationConfig appConfig, - ZipkinConfig zipkinConfig) { - registerTracer(jaeger, appConfig, new NoopMetricsFactory(), zipkinConfig); - } - - /* RUNTIME_INIT */ - public void registerTracerWithMpMetrics(JaegerConfig jaeger, ApplicationConfig appConfig, - ZipkinConfig zipkinConfig) { - registerTracer(jaeger, appConfig, new QuarkusJaegerMpMetricsFactory(), zipkinConfig); - } - - /* RUNTIME_INIT */ - public void registerTracerWithMicrometerMetrics(JaegerConfig jaeger, ApplicationConfig appConfig, - ZipkinConfig zipkinConfig) { - registerTracer(jaeger, appConfig, new QuarkusJaegerMicrometerFactory(), zipkinConfig); - } - - private synchronized void registerTracer(JaegerConfig jaeger, ApplicationConfig appConfig, - MetricsFactory metricsFactory, ZipkinConfig zipkinConfig) { - if (!jaeger.serviceName.isPresent()) { - if (appConfig.name.isPresent()) { - jaeger.serviceName = appConfig.name; - } else { - jaeger.serviceName = UNKNOWN_SERVICE_NAME; - } - } - initTracerConfig(jaeger, zipkinConfig); - quarkusTracer.setMetricsFactory(metricsFactory); - quarkusTracer.reset(); - // register Quarkus tracer to GlobalTracer. - // Usually the tracer will be registered only here, although consumers - // could register a different tracer in the code which runs before this class. - // This is also used in tests. - if (!GlobalTracer.isRegistered() && !jaeger.disableTracerRegistration) { - log.debugf("Registering tracer to GlobalTracer %s", quarkusTracer); - GlobalTracer.register(quarkusTracer); - } - } - - private void initTracerConfig(JaegerConfig jaeger, ZipkinConfig zipkinConfig) { - initTracerProperty("JAEGER_ENDPOINT", jaeger.endpoint, uri -> uri.toString()); - if (jaeger.endpoint.isPresent()) { - quarkusTracer.setEndpoint(jaeger.endpoint.get().toString()); - } - initTracerProperty("JAEGER_AUTH_TOKEN", jaeger.authToken, token -> token); - initTracerProperty("JAEGER_USER", jaeger.user, user -> user); - initTracerProperty("JAEGER_PASSWORD", jaeger.password, pw -> pw); - initTracerProperty("JAEGER_AGENT_HOST", jaeger.agentHostPort, address -> address.getHostString()); - initTracerProperty("JAEGER_AGENT_PORT", jaeger.agentHostPort, address -> String.valueOf(address.getPort())); - initTracerProperty("JAEGER_REPORTER_LOG_SPANS", jaeger.reporterLogSpans, log -> log.toString()); - initTracerProperty("JAEGER_REPORTER_MAX_QUEUE_SIZE", jaeger.reporterMaxQueueSize, size -> size.toString()); - initTracerProperty("JAEGER_REPORTER_FLUSH_INTERVAL", jaeger.reporterFlushInterval, - duration -> String.valueOf(duration.toMillis())); - initTracerProperty("JAEGER_SAMPLER_TYPE", jaeger.samplerType, type -> type); - initTracerProperty("JAEGER_SAMPLER_PARAM", jaeger.samplerParam, param -> NumberFormat.getInstance().format(param)); - initTracerProperty("JAEGER_SAMPLER_MANAGER_HOST_PORT", jaeger.samplerManagerHostPort, - hostPort -> String.format("%s:%d", hostPort.getHostString(), hostPort.getPort())); - initTracerProperty("JAEGER_SERVICE_NAME", jaeger.serviceName, name -> name); - initTracerProperty("JAEGER_TAGS", jaeger.tags, tags -> tags.toString()); - initTracerProperty("JAEGER_PROPAGATION", jaeger.propagation, format -> format.toString()); - initTracerProperty("JAEGER_SENDER_FACTORY", jaeger.senderFactory, sender -> sender); - quarkusTracer.setLogTraceContext(jaeger.logTraceContext); - quarkusTracer.setZipkinCompatibilityMode(zipkinConfig.compatibilityMode); - } - - private void initTracerProperty(String property, Optional value, Function accessor) { - if (value.isPresent()) { - System.setProperty(property, accessor.apply(value.get())); - } - } - - private void initTracerProperty(String property, OptionalInt value, Function accessor) { - if (value.isPresent()) { - System.setProperty(property, accessor.apply(Integer.valueOf(value.getAsInt()))); - } - } - - public static Class getClassForName(String className) { - Class clazz = null; - try { - clazz = Class.forName(className, false, Thread.currentThread().getContextClassLoader()); - } catch (ClassNotFoundException e) { - // Ignore exception - } - log.debugf("getClass: TCCL: %s ## %s : %s", Thread.currentThread().getContextClassLoader(), className, (clazz != null)); - return clazz; - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScope.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScope.java deleted file mode 100644 index 386f4d86278444..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScope.java +++ /dev/null @@ -1,67 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import org.jboss.logging.MDC; - -import io.jaegertracing.internal.JaegerSpanContext; -import io.opentracing.Scope; -import io.opentracing.Span; - -/** - * Scope that sets span context into MDC. - */ -public class MDCScope implements Scope { - - /** - * MDC keys - */ - private static final String TRACE_ID = "traceId"; - private static final String SPAN_ID = "spanId"; - private static final String PARENT_ID = "parentId"; - private static final String SAMPLED = "sampled"; - - private final Scope wrapped; - private final Object originalTraceId; - private final Object originalSpanId; - private final Object originalParentId; - private final Object originalSampled; - - public MDCScope(Scope scope, Span span) { - this.wrapped = scope; - this.originalTraceId = MDC.get(TRACE_ID); - this.originalSpanId = MDC.get(SPAN_ID); - this.originalParentId = MDC.get(PARENT_ID); - this.originalSampled = MDC.get(SAMPLED); - if (span.context() instanceof JaegerSpanContext) { - putContext((JaegerSpanContext) span.context()); - } - } - - @Override - public void close() { - wrapped.close(); - MDC.remove(TRACE_ID); - MDC.remove(SPAN_ID); - MDC.remove(PARENT_ID); - MDC.remove(SAMPLED); - - if (originalTraceId != null) { - MDC.put(TRACE_ID, originalTraceId); - } - if (originalSpanId != null) { - MDC.put(SPAN_ID, originalSpanId); - } - if (originalParentId != null) { - MDC.put(PARENT_ID, originalParentId); - } - if (originalSampled != null) { - MDC.put(SAMPLED, originalSampled); - } - } - - protected void putContext(JaegerSpanContext spanContext) { - MDC.put(TRACE_ID, spanContext.getTraceId()); - MDC.put(SPAN_ID, Long.toHexString(spanContext.getSpanId())); - MDC.put(PARENT_ID, Long.toHexString(spanContext.getParentId())); - MDC.put(SAMPLED, Boolean.toString(spanContext.isSampled())); - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScopeManager.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScopeManager.java deleted file mode 100644 index 43da14644d9014..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/MDCScopeManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import io.opentracing.Scope; -import io.opentracing.ScopeManager; -import io.opentracing.Span; - -public class MDCScopeManager implements ScopeManager { - - private final ScopeManager wrapped; - - public MDCScopeManager(ScopeManager scopeManager) { - this.wrapped = scopeManager; - } - - @Override - public Scope activate(Span span) { - return new MDCScope(wrapped.activate(span), span); - } - - @Override - public Span activeSpan() { - return wrapped.activeSpan(); - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMicrometerFactory.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMicrometerFactory.java deleted file mode 100644 index 43d2c2843ee670..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMicrometerFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import io.jaegertracing.internal.metrics.Counter; -import io.jaegertracing.internal.metrics.Gauge; -import io.jaegertracing.internal.metrics.Timer; -import io.jaegertracing.spi.MetricsFactory; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Metrics; -import io.micrometer.core.instrument.Tag; - -public class QuarkusJaegerMicrometerFactory implements MetricsFactory { - MeterRegistry registry = Metrics.globalRegistry; - - @Override - public Counter createCounter(String name, Map tags) { - return new Counter() { - private final io.micrometer.core.instrument.Counter counter = registry.counter(name, translateTags(tags)); - - @Override - public void inc(long amount) { - counter.increment(amount); - } - }; - } - - @Override - public Timer createTimer(String name, Map tags) { - return new Timer() { - private final io.micrometer.core.instrument.Timer timer = registry.timer(name, translateTags(tags)); - - @Override - public void durationMicros(long amount) { - timer.record(amount, TimeUnit.MICROSECONDS); - } - }; - } - - @Override - public Gauge createGauge(String name, Map tags) { - return new Gauge() { - private final Iterable tagList = translateTags(tags); - - @Override - public void update(long amount) { - registry.gauge(name, tagList, amount); - } - }; - } - - private Iterable translateTags(Map tags) { - final List tagList = new ArrayList(tags.size()); - for (Map.Entry tag : tags.entrySet()) { - tagList.add(Tag.of(tag.getKey(), tag.getValue())); - } - return tagList; - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMpMetricsFactory.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMpMetricsFactory.java deleted file mode 100644 index c28c9dacff158f..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMpMetricsFactory.java +++ /dev/null @@ -1,137 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - -import org.eclipse.microprofile.metrics.Metadata; -import org.eclipse.microprofile.metrics.MetricID; -import org.eclipse.microprofile.metrics.MetricRegistry; -import org.eclipse.microprofile.metrics.MetricType; -import org.eclipse.microprofile.metrics.Tag; - -import io.jaegertracing.internal.metrics.Counter; -import io.jaegertracing.internal.metrics.Gauge; -import io.jaegertracing.internal.metrics.Timer; -import io.jaegertracing.spi.MetricsFactory; -import io.smallrye.metrics.MetricRegistries; - -public class QuarkusJaegerMpMetricsFactory implements MetricsFactory { - - Map map = new HashMap<>(); - MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.VENDOR); - - /** RUNTIME_INIT from JaegerProcessor */ - QuarkusJaegerMpMetricsFactory() { - registry.counter(meta("jaeger_tracer_baggage_restrictions_updates", MetricType.COUNTER), - new Tag("result", "err")); - registry.counter(meta("jaeger_tracer_baggage_restrictions_updates", MetricType.COUNTER), - new Tag("result", "ok")); - registry.counter(meta("jaeger_tracer_baggage_truncations", MetricType.COUNTER)); - registry.counter(meta("jaeger_tracer_baggage_updates", MetricType.COUNTER), - new Tag("result", "err")); - registry.counter(meta("jaeger_tracer_baggage_updates", MetricType.COUNTER), - new Tag("result", "ok")); - registry.counter(meta("jaeger_tracer_finished_spans", MetricType.COUNTER)); - registry.counter(meta("jaeger_tracer_reporter_spans", MetricType.COUNTER), - new Tag("result", "dropped")); - registry.counter(meta("jaeger_tracer_reporter_spans", MetricType.COUNTER), - new Tag("result", "err")); - registry.counter(meta("jaeger_tracer_reporter_spans", MetricType.COUNTER), - new Tag("result", "ok")); - registry.counter(meta("jaeger_tracer_sampler_queries", MetricType.COUNTER), - new Tag("result", "err")); - registry.counter(meta("jaeger_tracer_sampler_queries", MetricType.COUNTER), - new Tag("result", "ok")); - registry.counter(meta("jaeger_tracer_sampler_updates", MetricType.COUNTER), - new Tag("result", "ok")); - registry.counter(meta("jaeger_tracer_sampler_updates", MetricType.COUNTER), - new Tag("result", "err")); - registry.counter(meta("jaeger_tracer_span_context_decoding_errors", MetricType.COUNTER)); - registry.counter(meta("jaeger_tracer_started_spans", MetricType.COUNTER), - new Tag("sampled", "n")); - registry.counter(meta("jaeger_tracer_started_spans", MetricType.COUNTER), - new Tag("sampled", "y")); - registry.counter(meta("jaeger_tracer_traces", MetricType.COUNTER), - new Tag("sampled", "y"), new Tag("state", "joined")); - registry.counter(meta("jaeger_tracer_traces", MetricType.COUNTER), - new Tag("sampled", "y"), new Tag("state", "started")); - registry.counter(meta("jaeger_tracer_traces", MetricType.COUNTER), - new Tag("sampled", "n"), new Tag("state", "joined")); - registry.counter(meta("jaeger_tracer_traces", MetricType.COUNTER), - new Tag("sampled", "n"), new Tag("state", "started")); - - registry.register(meta("jaeger_tracer_reporter_queue_length", MetricType.GAUGE), - new JaegerGauge()); - } - - @Override - public Counter createCounter(final String name, final Map tags) { - org.eclipse.microprofile.metrics.Counter counter = registry.counter(name, toTagArray(tags)); - - return new Counter() { - @Override - public void inc(long delta) { - counter.inc(delta); - } - }; - } - - @Override - public Timer createTimer(final String name, final Map tags) { - org.eclipse.microprofile.metrics.Timer timer = registry.timer(name, toTagArray(tags)); - return new Timer() { - @Override - public void durationMicros(long time) { - timer.update(Duration.of(time, ChronoUnit.MICROS)); - } - }; - } - - @Override - public Gauge createGauge(final String name, final Map tags) { - JaegerGauge gauge = getGauge(name, tags); - return new Gauge() { - @Override - public void update(long amount) { - gauge.update(amount); - } - }; - } - - JaegerGauge getGauge(final String name, final Map tags) { - MetricID id = new MetricID(name, toTagArray(tags)); - return map.computeIfAbsent(id, x -> new JaegerGauge()); - } - - private Tag[] toTagArray(Map tags) { - return tags.entrySet().stream() - .map(entry -> new Tag(entry.getKey(), entry.getValue())) - .toArray(Tag[]::new); - } - - static Metadata meta(String name, MetricType type) { - return Metadata.builder() - .withName(name) - .withDisplayName(name) - .withType(type) - .withUnit("none") - .withDescription(name) - .build(); - } - - public static class JaegerGauge implements org.eclipse.microprofile.metrics.Gauge { - private AtomicLong value = new AtomicLong(); - - public void update(long value) { - this.value.set(value); - } - - @Override - public Long getValue() { - return value.get(); - } - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java deleted file mode 100644 index e912d406b49e29..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java +++ /dev/null @@ -1,166 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import jakarta.enterprise.inject.Default; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.spi.CDI; - -import org.jboss.logging.Logger; - -import io.jaegertracing.Configuration; -import io.jaegertracing.internal.JaegerTracer; -import io.jaegertracing.spi.MetricsFactory; -import io.jaegertracing.spi.Reporter; -import io.opentracing.Scope; -import io.opentracing.ScopeManager; -import io.opentracing.Span; -import io.opentracing.SpanContext; -import io.opentracing.Tracer; -import io.opentracing.propagation.Format; -import io.opentracing.util.ThreadLocalScopeManager; - -public class QuarkusJaegerTracer implements Tracer { - - private volatile JaegerTracer tracer; - - private boolean logTraceContext; - private MetricsFactory metricsFactory; - private boolean zipkinCompatibilityMode = false; - private String endpoint = null; - - private static final Logger log = Logger.getLogger(QuarkusJaegerTracer.class); - - private final ScopeManager scopeManager = new ScopeManager() { - - volatile ScopeManager delegate; - - @Override - public Scope activate(Span span) { - return sm().activate(span); - } - - @Override - public Span activeSpan() { - if (delegate == null) { - return null; - } - return sm().activeSpan(); - } - - ScopeManager sm() { - if (delegate == null) { - synchronized (this) { - if (delegate == null) { - delegate = getScopeManager(); - } - } - } - return delegate; - } - }; - - void setLogTraceContext(boolean logTraceContext) { - this.logTraceContext = logTraceContext; - } - - void setMetricsFactory(MetricsFactory metricsFactory) { - this.metricsFactory = metricsFactory; - } - - @Override - public String toString() { - return tracer().toString(); - } - - synchronized void reset() { - if (tracer != null) { - tracer.close(); - } - tracer = null; - } - - private Tracer tracer() { - if (tracer == null) { - synchronized (this) { - if (tracer == null) { - tracer = Configuration.fromEnv() - .withMetricsFactory(metricsFactory) - .getTracerBuilder() - .withScopeManager(scopeManager) - .withReporter(createReporter()) - .build(); - } - } - } - return tracer; - } - - private Reporter createReporter() { - Reporter reporter = null; - if (zipkinCompatibilityMode) { - Instance registries = CDI.current().select(ReporterFactory.class, - Default.Literal.INSTANCE); - ReporterFactory factory = null; - if (registries.isAmbiguous()) { - factory = registries.iterator().next(); - log.warnf("Multiple reporters present, using %s", factory.getClass().getName()); - } else if (!registries.isUnsatisfied()) { - factory = registries.get(); - } - if (factory != null) { - reporter = factory.createReporter(endpoint); - } - } - return reporter; - } - - private ScopeManager getScopeManager() { - ScopeManager scopeManager = new ThreadLocalScopeManager(); - if (logTraceContext) { - scopeManager = new MDCScopeManager(scopeManager); - } - return scopeManager; - } - - @Override - public SpanBuilder buildSpan(String operationName) { - return tracer().buildSpan(operationName); - } - - @Override - public void inject(SpanContext spanContext, Format format, C carrier) { - tracer().inject(spanContext, format, carrier); - } - - @Override - public SpanContext extract(Format format, C carrier) { - return tracer().extract(format, carrier); - } - - @Override - public void close() { - tracer.close(); - } - - @Override - public ScopeManager scopeManager() { - return scopeManager; - } - - @Override - public Span activeSpan() { - return tracer().activeSpan(); - } - - @Override - public Scope activateSpan(final Span span) { - return tracer.activateSpan(span); - } - - public void setZipkinCompatibilityMode(boolean zipkinCompatibilityMode) { - this.zipkinCompatibilityMode = zipkinCompatibilityMode; - } - - public void setEndpoint(String endpoint) { - this.endpoint = endpoint; - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ReporterFactory.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ReporterFactory.java deleted file mode 100644 index d061a6f69b26a9..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ReporterFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import io.jaegertracing.spi.Reporter; - -public interface ReporterFactory { - - Reporter createReporter(String endpoint); - -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinConfig.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinConfig.java deleted file mode 100644 index 5a1f2039ecfc6a..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConfigPhase; -import io.quarkus.runtime.annotations.ConfigRoot; - -/** - * The Zipkin Jaeger configuration. - */ -@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED, name = "jaeger.zipkin") -public class ZipkinConfig { - - /** - * Whether jaeger should run in zipkin compatibility mode - */ - @ConfigItem(defaultValue = "false") - public Boolean compatibilityMode; -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterFactoryImpl.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterFactoryImpl.java deleted file mode 100644 index dbc5d3ba58151a..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterFactoryImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import io.jaegertracing.spi.Reporter; -import io.jaegertracing.zipkin.ZipkinV2Reporter; -import zipkin2.reporter.AsyncReporter; -import zipkin2.reporter.urlconnection.URLConnectionSender; - -public class ZipkinReporterFactoryImpl implements ReporterFactory { - - public Reporter createReporter(String endpoint) { - - return new ZipkinV2Reporter(AsyncReporter.create(URLConnectionSender.create(endpoint))); - - } - -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterProvider.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterProvider.java deleted file mode 100644 index 0ece5c46cb821d..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/ZipkinReporterProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.quarkus.jaeger.runtime; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Singleton; - -@Singleton -public class ZipkinReporterProvider { - @Produces - @Singleton - public ReporterFactory reporter() { - return new ZipkinReporterFactoryImpl(); - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_JaegerTracer.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_JaegerTracer.java deleted file mode 100644 index c02ebe61e04599..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_JaegerTracer.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.quarkus.jaeger.runtime.graal; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -import io.quarkus.jaeger.runtime.JaegerDeploymentRecorder; - -@TargetClass(className = "io.jaegertracing.internal.JaegerTracer") -public final class Target_JaegerTracer { - - @Substitute - private static String getVersionFromProperties() { - return JaegerDeploymentRecorder.jaegerVersion; - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_LoggingReporter.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_LoggingReporter.java deleted file mode 100644 index 979757c0e5f1b5..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_LoggingReporter.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.quarkus.jaeger.runtime.graal; - -import org.jboss.logging.Logger; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -import io.jaegertracing.internal.JaegerSpan; -import io.jaegertracing.spi.Reporter; - -@Substitute -@TargetClass(className = "io.jaegertracing.internal.reporters.LoggingReporter") -final public class Target_LoggingReporter implements Reporter { - - private static final Logger LOG = Logger.getLogger(Target_LoggingReporter.class); - - @Substitute - public Target_LoggingReporter() { - - } - - @Substitute - @Override - public void report(JaegerSpan span) { - LOG.infof("Span reported: %s", span); - } - - @Substitute - @Override - public void close() { - - } - -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_Metrics.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_Metrics.java deleted file mode 100644 index aca42cdda2ead2..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_Metrics.java +++ /dev/null @@ -1,165 +0,0 @@ -package io.quarkus.jaeger.runtime.graal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import com.oracle.svm.core.annotate.Alias; -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -import io.jaegertracing.internal.metrics.Counter; -import io.jaegertracing.internal.metrics.Gauge; -import io.jaegertracing.spi.MetricsFactory; - -// TODO: Determine if there is a more automated way we can configure the metrics -// from the annotations. -@TargetClass(className = "io.jaegertracing.internal.metrics.Metrics") -public final class Target_Metrics { - - @Alias - public Counter traceStartedSampled; - - @Alias - public Counter traceStartedNotSampled; - - @Alias - public Counter tracesJoinedSampled; - - @Alias - public Counter tracesJoinedNotSampled; - - @Alias - public Counter spansStartedSampled; - - @Alias - public Counter spansStartedNotSampled; - - @Alias - public Counter spansFinished; - - @Alias - public Counter decodingErrors; - - @Alias - public Counter reporterSuccess; - - @Alias - public Counter reporterFailure; - - @Alias - public Counter reporterDropped; - - @Alias - public Gauge reporterQueueLength; - - @Alias - public Counter samplerRetrieved; - - @Alias - public Counter samplerQueryFailure; - - @Alias - public Counter samplerUpdated; - - @Alias - public Counter samplerParsingFailure; - - @Alias - public Counter baggageUpdateSuccess; - - @Alias - public Counter baggageUpdateFailure; - - @Alias - public Counter baggageTruncate; - - @Alias - public Counter baggageRestrictionsUpdateSuccess; - - @Alias - public Counter baggageRestrictionsUpdateFailure; - - @Substitute - private void createMetrics(MetricsFactory factory, String metricsPrefix) { - Map tags = new HashMap(); - tags.put("state", "started"); - tags.put("sampled", "y"); - traceStartedSampled = factory.createCounter(metricsPrefix + "traces", tags); - - tags = new HashMap(); - tags.put("state", "started"); - tags.put("sampled", "n"); - traceStartedNotSampled = factory.createCounter(metricsPrefix + "traces", tags); - - tags = new HashMap(); - tags.put("state", "joined"); - tags.put("sampled", "y"); - tracesJoinedSampled = factory.createCounter(metricsPrefix + "traces", tags); - - tags = new HashMap(); - tags.put("state", "joined"); - tags.put("sampled", "n"); - tracesJoinedNotSampled = factory.createCounter(metricsPrefix + "traces", tags); - - tags = new HashMap(); - tags.put("sampled", "y"); - spansStartedSampled = factory.createCounter(metricsPrefix + "started_spans", tags); - - tags = new HashMap(); - tags.put("sampled", "n"); - spansStartedNotSampled = factory.createCounter(metricsPrefix + "started_spans", tags); - - spansFinished = factory.createCounter(metricsPrefix + "finished_spans", Collections.emptyMap()); - - decodingErrors = factory.createCounter(metricsPrefix + "span_context_decoding_errors", Collections.emptyMap()); - - tags = new HashMap(); - tags.put("result", "ok"); - reporterSuccess = factory.createCounter(metricsPrefix + "reporter_spans", tags); - - tags = new HashMap(); - tags.put("result", "err"); - reporterFailure = factory.createCounter(metricsPrefix + "reporter_spans", tags); - - tags = new HashMap(); - tags.put("result", "dropped"); - reporterDropped = factory.createCounter(metricsPrefix + "reporter_spans", tags); - - reporterQueueLength = factory.createGauge(metricsPrefix + "reporter_queue_length", Collections.emptyMap()); - - tags = new HashMap(); - tags.put("result", "ok"); - samplerRetrieved = factory.createCounter(metricsPrefix + "sampler_queries", tags); - - tags = new HashMap(); - tags.put("result", "err"); - samplerQueryFailure = factory.createCounter(metricsPrefix + "sampler_queries", tags); - - tags = new HashMap(); - tags.put("result", "ok"); - samplerUpdated = factory.createCounter(metricsPrefix + "sampler_updates", tags); - - tags = new HashMap(); - tags.put("result", "err"); - samplerParsingFailure = factory.createCounter(metricsPrefix + "sampler_updates", tags); - - tags = new HashMap(); - tags.put("result", "ok"); - baggageUpdateSuccess = factory.createCounter(metricsPrefix + "baggage_updates", tags); - - tags = new HashMap(); - tags.put("result", "err"); - baggageUpdateFailure = factory.createCounter(metricsPrefix + "baggage_updates", tags); - - baggageTruncate = factory.createCounter(metricsPrefix + "baggage_truncations", Collections.emptyMap()); - - tags = new HashMap(); - tags.put("result", "ok"); - baggageRestrictionsUpdateSuccess = factory.createCounter(metricsPrefix + "baggage_restrictions_updates", tags); - - tags = new HashMap(); - tags.put("result", "err"); - baggageRestrictionsUpdateFailure = factory.createCounter(metricsPrefix + "baggage_restrictions_updates", tags); - } -} diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_SenderResolver.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_SenderResolver.java deleted file mode 100644 index 0c71ec82a50719..00000000000000 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/graal/Target_SenderResolver.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.quarkus.jaeger.runtime.graal; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -import io.jaegertracing.Configuration; -import io.jaegertracing.spi.Sender; -import io.jaegertracing.thrift.internal.senders.ThriftSenderFactory; - -@TargetClass(className = "io.jaegertracing.internal.senders.SenderResolver") -public final class Target_SenderResolver { - - @Substitute - public static Sender resolve(Configuration.SenderConfiguration senderConfiguration) { - return new ThriftSenderFactory().getSender(senderConfiguration); - } -} diff --git a/extensions/jaeger/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jaeger/runtime/src/main/resources/META-INF/quarkus-extension.yaml deleted file mode 100644 index 4a0f1d0a38eb63..00000000000000 --- a/extensions/jaeger/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -artifact: ${project.groupId}:${project.artifactId}:${project.version} -name: "Jaeger" -metadata: - keywords: - - "tracing" - - "distributed-tracing" - - "jaeger" - categories: - - "observability" - unlisted: true - status: "deprecated" - config: - - "quarkus.jaeger." diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 3cbffb9edac477..37ea59286d6024 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -276,7 +276,6 @@ public void build( .produce(ReflectiveClassBuildItem.builder(StickyAssignor.class.getName()).build()); handleAvro(reflectiveClass, proxies, serviceProviders, sslNativeSupport, capabilities); - handleOpenTracing(reflectiveClass, capabilities); } @@ -317,18 +316,6 @@ void checkBoostrapServers(KafkaRecorder recorder, Capabilities capabilities) { } } - private void handleOpenTracing(BuildProducer reflectiveClass, Capabilities capabilities) { - //opentracing contrib kafka interceptors: https://github.com/opentracing-contrib/java-kafka-client - if (!capabilities.isPresent(Capability.OPENTRACING) - || !QuarkusClassLoader.isClassPresentAtRuntime("io.opentracing.contrib.kafka.TracingProducerInterceptor")) { - return; - } - - reflectiveClass.produce(ReflectiveClassBuildItem.builder("io.opentracing.contrib.kafka.TracingProducerInterceptor", - "io.opentracing.contrib.kafka.TracingConsumerInterceptor").methods() - .build()); - } - private void handleAvro(BuildProducer reflectiveClass, BuildProducer proxies, BuildProducer serviceProviders, diff --git a/extensions/mongodb-client/deployment/pom.xml b/extensions/mongodb-client/deployment/pom.xml index 0b0278fa0db2c9..0c505687946125 100644 --- a/extensions/mongodb-client/deployment/pom.xml +++ b/extensions/mongodb-client/deployment/pom.xml @@ -91,27 +91,6 @@ quarkus-resteasy-deployment test - - io.quarkus - quarkus-smallrye-opentracing-deployment - test - - - io.opentracing.contrib - opentracing-mongo-common - test - - - io.opentracing - opentracing-mock - test - - - io.opentracing - opentracing-util - test-jar - test - diff --git a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientBuildTimeConfig.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientBuildTimeConfig.java index 1d4ea4fe1a8bd7..8bb10a921b7dbe 100644 --- a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientBuildTimeConfig.java +++ b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientBuildTimeConfig.java @@ -18,12 +18,6 @@ public class MongoClientBuildTimeConfig { @ConfigItem(name = "metrics.enabled") public boolean metricsEnabled; - /** - * Whether tracing spans of driver commands are sent in case the smallrye-opentracing extension is present. - */ - @ConfigItem(name = "tracing.enabled") - public boolean tracingEnabled; - /** * If set to true, the default clients will always be created even if there are no injection points that use them */ diff --git a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java index 744b77a5cfeab4..99da47258cee07 100644 --- a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java +++ b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java @@ -73,13 +73,11 @@ import io.quarkus.mongodb.runtime.MongodbConfig; import io.quarkus.mongodb.runtime.dns.MongoDnsClient; import io.quarkus.mongodb.runtime.dns.MongoDnsClientProvider; -import io.quarkus.mongodb.tracing.MongoTracingCommandListener; import io.quarkus.runtime.metrics.MetricsFactory; import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem; import io.quarkus.vertx.deployment.VertxBuildItem; public class MongoClientProcessor { - private static final String MONGODB_TRACING_COMMAND_LISTENER = MongoTracingCommandListener.class.getName(); private static final DotName MONGO_CLIENT_ANNOTATION = DotName.createSimple(MongoClientName.class.getName()); private static final DotName MONGO_CLIENT = DotName.createSimple(MongoClient.class.getName()); @@ -152,9 +150,6 @@ CommandListenerBuildItem collectCommandListeners(CombinedIndexBuildItem indexBui List names = commandListenerClasses.stream() .map(ci -> ci.name().toString()) .collect(Collectors.toList()); - if (buildTimeConfig.tracingEnabled && capabilities.isPresent(Capability.OPENTRACING)) { - names.add(MONGODB_TRACING_COMMAND_LISTENER); - } return new CommandListenerBuildItem(names); } diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTracingCommandListenerTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTracingCommandListenerTest.java deleted file mode 100644 index 48fe208fdce7a4..00000000000000 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTracingCommandListenerTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package io.quarkus.mongodb; - -import static org.assertj.core.api.Assertions.assertThat; - -import jakarta.inject.Inject; - -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import com.mongodb.client.MongoClient; - -import io.opentracing.mock.MockSpan; -import io.opentracing.mock.MockTracer; -import io.opentracing.util.GlobalTracer; -import io.opentracing.util.GlobalTracerTestUtil; -import io.quarkus.mongodb.tracing.MongoTracingCommandListener; -import io.quarkus.test.QuarkusUnitTest; - -/** - * Test the inclusion and config of the {@link MongoTracingCommandListener}. - * - * @see io.quarkus.smallrye.opentracing.deployment.TracingTest - */ -public class MongoTracingCommandListenerTest extends MongoTestBase { - - @Inject - MongoClient client; - - @RegisterExtension - static final QuarkusUnitTest config = new QuarkusUnitTest() - .setArchiveProducer( - () -> ShrinkWrap.create(JavaArchive.class).addClasses(MongoTestBase.class)) - .withConfigurationResource("application-tracing-mongo.properties"); - - static MockTracer mockTracer = new MockTracer(); - static { - GlobalTracer.register(mockTracer); - } - - @BeforeEach - public void before() { - mockTracer.reset(); - } - - @AfterAll - public static void afterAll() { - GlobalTracerTestUtil.resetGlobalTracer(); - } - - @AfterEach - void cleanup() { - if (client != null) { - client.close(); - } - } - - @Test - void testClientInitialization() { - assertThat(mockTracer.finishedSpans()).isEmpty(); - - assertThat(client.listDatabaseNames().first()).isNotEmpty(); - - assertThat(mockTracer.finishedSpans()).hasSize(1); - MockSpan span = mockTracer.finishedSpans().get(0); - assertThat(span.operationName()).isEqualTo("listDatabases"); - } - -} diff --git a/extensions/mongodb-client/deployment/src/test/resources/application-tracing-mongo.properties b/extensions/mongodb-client/deployment/src/test/resources/application-tracing-mongo.properties deleted file mode 100644 index c5790c171979eb..00000000000000 --- a/extensions/mongodb-client/deployment/src/test/resources/application-tracing-mongo.properties +++ /dev/null @@ -1,9 +0,0 @@ -quarkus.mongodb.connection-string=mongodb://localhost:27018 -quarkus.mongodb.tracing.enabled=true - - -quarkus.jaeger.enabled=true -quarkus.jaeger.disable-tracer-registration=true -quarkus.jaeger.service-name=tracing-test -quarkus.jaeger.sampler-param=1 -quarkus.jaeger.sampler-type=const diff --git a/extensions/mongodb-client/runtime/pom.xml b/extensions/mongodb-client/runtime/pom.xml index 0d32b10af9339b..c4b13424e4a020 100644 --- a/extensions/mongodb-client/runtime/pom.xml +++ b/extensions/mongodb-client/runtime/pom.xml @@ -72,17 +72,6 @@ true - - io.quarkus - quarkus-smallrye-opentracing - true - - - io.opentracing.contrib - opentracing-mongo-common - true - - org.graalvm.sdk graal-sdk diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/tracing/MongoTracingCommandListener.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/tracing/MongoTracingCommandListener.java deleted file mode 100644 index e218eab5960cab..00000000000000 --- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/tracing/MongoTracingCommandListener.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.quarkus.mongodb.tracing; - -import org.jboss.logging.Logger; - -import com.mongodb.event.CommandFailedEvent; -import com.mongodb.event.CommandListener; -import com.mongodb.event.CommandStartedEvent; -import com.mongodb.event.CommandSucceededEvent; - -import io.opentracing.contrib.mongo.common.TracingCommandListener; -import io.opentracing.util.GlobalTracer; - -/** - * Command Listener for Mongo client delegated to {@link TracingCommandListener}. - * - */ -public class MongoTracingCommandListener implements CommandListener { - - private static final Logger LOGGER = Logger.getLogger(MongoTracingCommandListener.class); - - private final TracingCommandListener delegate; - - public MongoTracingCommandListener() { - this.delegate = new TracingCommandListener.Builder(GlobalTracer.get()).build(); - LOGGER.debug("TracingCommandListener Delegate created"); - } - - @Override - public void commandStarted(CommandStartedEvent event) { - LOGGER.trace("commandStarted event " + event.getCommandName()); - delegate.commandStarted(event); - } - - @Override - public void commandFailed(CommandFailedEvent event) { - LOGGER.trace("commandFailed event " + event.getCommandName()); - delegate.commandFailed(event); - } - - @Override - public void commandSucceeded(CommandSucceededEvent event) { - LOGGER.trace("commandSucceeded event " + event.getCommandName()); - delegate.commandSucceeded(event); - } - -} diff --git a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/tracing/TracerProcessor.java b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/tracing/TracerProcessor.java index 35641cf858a209..63337d717d8f0f 100644 --- a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/tracing/TracerProcessor.java +++ b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/tracing/TracerProcessor.java @@ -26,7 +26,6 @@ import io.quarkus.arc.processor.DotNames; import io.quarkus.builder.Version; import io.quarkus.deployment.Capabilities; -import io.quarkus.deployment.Capability; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.BuildSteps; @@ -36,7 +35,6 @@ import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.opentelemetry.runtime.tracing.TracerRecorder; import io.quarkus.opentelemetry.runtime.tracing.cdi.TracerProducer; -import io.quarkus.runtime.configuration.ConfigurationException; import io.quarkus.vertx.http.deployment.spi.FrameworkEndpointsBuildItem; import io.quarkus.vertx.http.deployment.spi.StaticResourcesBuildItem; @@ -55,12 +53,6 @@ UnremovableBeanBuildItem ensureProducersAreRetained( Capabilities capabilities, BuildProducer additionalBeans) { - if (capabilities.isPresent(Capability.OPENTRACING) || - capabilities.isPresent(Capability.SMALLRYE_OPENTRACING)) { - throw new ConfigurationException("The OpenTelemetry extension tracer can not be used in " + - "conjunction with either the SmallRye OpenTracing or Jaeger extensions."); - } - additionalBeans.produce(AdditionalBeanBuildItem.builder() .setUnremovable() .addBeanClass(TracerProducer.class) diff --git a/extensions/pom.xml b/extensions/pom.xml index 5734b8bde14df6..acc804301bc046 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -47,9 +47,7 @@ smallrye-health smallrye-metrics - smallrye-opentracing smallrye-fault-tolerance - jaeger micrometer micrometer-registry-prometheus opentelemetry diff --git a/extensions/resteasy-classic/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java b/extensions/resteasy-classic/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java index 2cac5fa7164d7d..4e64a18cec1328 100644 --- a/extensions/resteasy-classic/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java +++ b/extensions/resteasy-classic/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java @@ -136,20 +136,6 @@ NativeImageProxyDefinitionBuildItem addProxy() { return new NativeImageProxyDefinitionBuildItem(ResteasyConfiguration.class.getName()); } - @BuildStep - void registerRestClientListenerForTracing( - Capabilities capabilities, - BuildProducer resource, - BuildProducer reflectiveClass) { - if (capabilities.isPresent(Capability.SMALLRYE_OPENTRACING)) { - resource.produce(new NativeImageResourceBuildItem( - "META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientListener")); - reflectiveClass - .produce(ReflectiveClassBuildItem.builder("io.smallrye.opentracing.SmallRyeRestClientListener") - .methods().fields().build()); - } - } - @BuildStep @Record(ExecutionTime.STATIC_INIT) void setup(BuildProducer feature, diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java index 04fd0a2d54494a..00e1e0fe5a6219 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java @@ -83,7 +83,6 @@ import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.GeneratedClassBuildItem; -import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.gizmo.ClassCreator; @@ -165,20 +164,6 @@ void setUpDefaultMediaType(BuildProducer con } } - @BuildStep - void registerRestClientListenerForTracing( - Capabilities capabilities, - BuildProducer resource, - BuildProducer reflectiveClass) { - if (capabilities.isPresent(Capability.SMALLRYE_OPENTRACING)) { - resource.produce(new NativeImageResourceBuildItem( - "META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientListener")); - reflectiveClass - .produce(ReflectiveClassBuildItem.builder("io.smallrye.opentracing.SmallRyeRestClientListener") - .build()); - } - } - @BuildStep @Record(ExecutionTime.STATIC_INIT) void setupAdditionalBeans(BuildProducer additionalBeans, diff --git a/extensions/smallrye-opentracing/deployment/pom.xml b/extensions/smallrye-opentracing/deployment/pom.xml deleted file mode 100644 index 8d5b5a09f82142..00000000000000 --- a/extensions/smallrye-opentracing/deployment/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - quarkus-smallrye-opentracing-parent - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - quarkus-smallrye-opentracing-deployment - Quarkus - SmallRye OpenTracing - Deployment - - - - io.quarkus - quarkus-resteasy-common-spi - - - io.quarkus - quarkus-undertow-spi - - - io.quarkus - quarkus-resteasy-reactive-spi-deployment - - - io.quarkus - quarkus-arc-deployment - - - io.quarkus - quarkus-smallrye-opentracing - - - io.quarkus - quarkus-jaeger-deployment - - - io.quarkus - quarkus-jsonp-deployment - - - - io.quarkus - quarkus-resteasy-jackson-deployment - test - - - io.quarkus - quarkus-rest-client-deployment - test - - - io.quarkus - quarkus-smallrye-fault-tolerance-deployment - test - - - io.quarkus - quarkus-hibernate-orm-deployment - test - - - io.quarkus - quarkus-agroal-deployment - test - - - io.quarkus - quarkus-jdbc-h2-deployment - test - - - io.quarkus - quarkus-junit5-internal - test - - - io.rest-assured - rest-assured - test - - - io.opentracing - opentracing-mock - test - - - io.opentracing - opentracing-util - test-jar - test - - - org.awaitility - awaitility - test - - - io.opentracing.contrib - opentracing-jdbc - test - - - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - - diff --git a/extensions/smallrye-opentracing/deployment/src/main/java/io/quarkus/smallrye/opentracing/deployment/SmallRyeOpenTracingProcessor.java b/extensions/smallrye-opentracing/deployment/src/main/java/io/quarkus/smallrye/opentracing/deployment/SmallRyeOpenTracingProcessor.java deleted file mode 100644 index 23687250ed9e12..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/main/java/io/quarkus/smallrye/opentracing/deployment/SmallRyeOpenTracingProcessor.java +++ /dev/null @@ -1,84 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import java.lang.reflect.Method; - -import jakarta.enterprise.inject.spi.ObserverMethod; -import jakarta.servlet.DispatcherType; - -import io.opentracing.Tracer; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; -import io.quarkus.arc.deployment.UnremovableBeanBuildItem; -import io.quarkus.deployment.Capabilities; -import io.quarkus.deployment.Capability; -import io.quarkus.deployment.Feature; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.FeatureBuildItem; -import io.quarkus.deployment.builditem.nativeimage.ReflectiveMethodBuildItem; -import io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem; -import io.quarkus.resteasy.reactive.spi.CustomContainerResponseFilterBuildItem; -import io.quarkus.resteasy.reactive.spi.DynamicFeatureBuildItem; -import io.quarkus.resteasy.reactive.spi.WriterInterceptorBuildItem; -import io.quarkus.smallrye.opentracing.runtime.QuarkusSmallRyeTracingDynamicFeature; -import io.quarkus.smallrye.opentracing.runtime.QuarkusSmallRyeTracingStandaloneContainerResponseFilter; -import io.quarkus.smallrye.opentracing.runtime.QuarkusSmallRyeTracingStandaloneVertxDynamicFeature; -import io.quarkus.smallrye.opentracing.runtime.TracerProducer; -import io.quarkus.undertow.deployment.FilterBuildItem; -import io.smallrye.opentracing.contrib.interceptor.OpenTracingInterceptor; -import io.smallrye.opentracing.contrib.jaxrs2.server.SpanFinishingFilter; - -public class SmallRyeOpenTracingProcessor { - - @BuildStep - AdditionalBeanBuildItem registerBeans(BuildProducer unremovableBeans) { - // Some components obtain the tracer via CDI.current().select(Tracer.class) - // E.g. io.quarkus.smallrye.opentracing.runtime.QuarkusSmallRyeTracingDynamicFeature and io.smallrye.graphql.cdi.tracing.TracingService - unremovableBeans.produce(UnremovableBeanBuildItem.beanTypes(Tracer.class)); - return new AdditionalBeanBuildItem(OpenTracingInterceptor.class, TracerProducer.class); - } - - @BuildStep - ReflectiveMethodBuildItem registerMethod() throws Exception { - Method isAsync = ObserverMethod.class.getMethod("isAsync"); - return new ReflectiveMethodBuildItem(isAsync); - } - - @BuildStep - void setupFilter( - BuildProducer additionalBeans, - BuildProducer providers, - BuildProducer filterProducer, - BuildProducer feature, - BuildProducer customResponseFilters, - BuildProducer dynamicFeatures, - BuildProducer writerInterceptors, - Capabilities capabilities) { - - feature.produce(new FeatureBuildItem(Feature.SMALLRYE_OPENTRACING)); - - additionalBeans.produce(new AdditionalBeanBuildItem(QuarkusSmallRyeTracingDynamicFeature.class)); - providers.produce(new ResteasyJaxrsProviderBuildItem(QuarkusSmallRyeTracingDynamicFeature.class.getName())); - - if (capabilities.isPresent(Capability.SERVLET)) { - FilterBuildItem filterInfo = FilterBuildItem.builder("tracingFilter", SpanFinishingFilter.class.getName()) - .setAsyncSupported(true) - .addFilterUrlMapping("*", DispatcherType.FORWARD) - .addFilterUrlMapping("*", DispatcherType.INCLUDE) - .addFilterUrlMapping("*", DispatcherType.REQUEST) - .addFilterUrlMapping("*", DispatcherType.ASYNC) - .addFilterUrlMapping("*", DispatcherType.ERROR) - .build(); - filterProducer.produce(filterInfo); - } else if (capabilities.isPresent(Capability.RESTEASY)) { - providers.produce( - new ResteasyJaxrsProviderBuildItem(QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.class.getName())); - } else if (capabilities.isPresent(Capability.RESTEASY_REACTIVE)) { - customResponseFilters.produce(new CustomContainerResponseFilterBuildItem( - QuarkusSmallRyeTracingStandaloneContainerResponseFilter.class.getName())); - dynamicFeatures.produce(new DynamicFeatureBuildItem(QuarkusSmallRyeTracingDynamicFeature.class.getName())); - writerInterceptors.produce( - new WriterInterceptorBuildItem.Builder( - QuarkusSmallRyeTracingStandaloneContainerResponseFilter.class.getName()).build()); - } - } -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Fruit.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Fruit.java deleted file mode 100644 index dfe69588a107f2..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Fruit.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import jakarta.persistence.Cacheable; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.NamedQuery; -import jakarta.persistence.QueryHint; -import jakarta.persistence.SequenceGenerator; -import jakarta.persistence.Table; - -@Entity -@Table(name = "known_fruits") -@NamedQuery(name = "Fruits.findAll", query = "SELECT f FROM Fruit f ORDER BY f.name", hints = @QueryHint(name = "org.hibernate.cacheable", value = "true")) -@Cacheable -public class Fruit { - - @Id - @SequenceGenerator(name = "fruitsSequence", sequenceName = "known_fruits_id_seq", allocationSize = 1, initialValue = 10) - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fruitsSequence") - private Integer id; - - @Column(length = 40, unique = true) - private String name; - - public Fruit() { - } - - public Fruit(String name) { - this.name = name; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/RestService.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/RestService.java deleted file mode 100644 index 0589f77db28305..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/RestService.java +++ /dev/null @@ -1,35 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import java.util.List; -import java.util.concurrent.CompletionStage; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -@Path("/") -public interface RestService { - - @GET - @Path("/hello") - Response hello(); - - @GET - @Path("/cdi") - Response cdi(); - - @GET - @Path("/restClient") - Response restClient(); - - @GET - @Path("/faultTolerance") - CompletionStage faultTolerance(); - - @GET - @Path("/jpa") - @Produces(MediaType.APPLICATION_JSON) - List jpa(); -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Service.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Service.java deleted file mode 100644 index 5cf5fe0d47a545..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/Service.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import java.time.temporal.ChronoUnit; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.persistence.EntityManager; - -import org.eclipse.microprofile.faulttolerance.Asynchronous; -import org.eclipse.microprofile.faulttolerance.Fallback; -import org.eclipse.microprofile.faulttolerance.Retry; -import org.eclipse.microprofile.faulttolerance.Timeout; -import org.eclipse.microprofile.opentracing.Traced; - -import io.opentracing.Tracer; - -@ApplicationScoped -public class Service { - - @Inject - Tracer tracer; - - @Inject - EntityManager em; - - @Traced - public void foo() { - } - - // @Asynchronous methods (and their fallback methods) shouldn't be @Traced - // because https://github.com/eclipse/microprofile-opentracing/issues/189 - @Asynchronous - @Fallback(fallbackMethod = "fallback") - @Timeout(value = 20L, unit = ChronoUnit.MILLIS) - @Retry(delay = 10L, maxRetries = 2) - public CompletionStage faultTolerance() { - tracer.buildSpan("ft").start().finish(); - throw new RuntimeException(); - } - - public CompletionStage fallback() { - tracer.buildSpan("fallback").start().finish(); - return CompletableFuture.completedFuture("fallback"); - } - - @Traced - public List getFruits() { - return em.createNamedQuery("Fruits.findAll", Fruit.class).getResultList(); - } -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TestResource.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TestResource.java deleted file mode 100644 index 1edb36a5409c05..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TestResource.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import java.util.List; -import java.util.concurrent.CompletionStage; - -import jakarta.inject.Inject; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.UriInfo; - -import org.eclipse.microprofile.rest.client.RestClientBuilder; - -@Path("/") -public class TestResource implements RestService { - - @Inject - Service service; - - @Context - private UriInfo uri; - - @Override - public Response hello() { - return Response.ok().build(); - } - - @Override - public Response cdi() { - service.foo(); - return Response.ok().build(); - } - - @Override - public Response restClient() { - RestService client = RestClientBuilder.newBuilder() - .baseUri(uri.getBaseUri()) - .build(RestService.class); - client.hello(); - return Response.ok().build(); - } - - @Override - public CompletionStage faultTolerance() { - return service.faultTolerance(); - } - - public List jpa() { - return service.getFruits(); - } -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java deleted file mode 100644 index bc06afbff985a9..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package io.quarkus.smallrye.opentracing.deployment; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.awaitility.Awaitility; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.opentracing.mock.MockSpan; -import io.opentracing.mock.MockTracer; -import io.opentracing.util.GlobalTracer; -import io.opentracing.util.GlobalTracerTestUtil; -import io.quarkus.test.QuarkusUnitTest; -import io.restassured.RestAssured; -import io.restassured.parsing.Parser; - -public class TracingTest { - - @RegisterExtension - static final QuarkusUnitTest config = new QuarkusUnitTest() - .withApplicationRoot((jar) -> jar - .addClass(TestResource.class) - .addClass(Service.class) - .addClass(RestService.class) - .addClass(Fruit.class) - .addAsResource("application.properties") - .addAsResource("import.sql") - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")); - - static MockTracer mockTracer = new MockTracer(); - static { - GlobalTracer.registerIfAbsent(mockTracer); - } - - @BeforeEach - public void before() { - mockTracer.reset(); - } - - @AfterAll - public static void afterAll() { - GlobalTracerTestUtil.resetGlobalTracer(); - } - - @Test - public void testSingleServerRequest() { - try { - RestAssured.defaultParser = Parser.TEXT; - RestAssured.when().get("/hello") - .then() - .statusCode(200); - Assertions.assertEquals(1, mockTracer.finishedSpans().size()); - Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello", - mockTracer.finishedSpans().get(0).operationName()); - } finally { - RestAssured.reset(); - } - } - - @Test - public void testCDI() { - try { - RestAssured.defaultParser = Parser.TEXT; - RestAssured.when().get("/cdi") - .then() - .statusCode(200); - Assertions.assertEquals(2, mockTracer.finishedSpans().size()); - Assertions.assertEquals("io.quarkus.smallrye.opentracing.deployment.Service.foo", - mockTracer.finishedSpans().get(0).operationName()); - Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.cdi", - mockTracer.finishedSpans().get(1).operationName()); - } finally { - RestAssured.reset(); - } - } - - @Test - public void testMPRestClient() { - try { - RestAssured.defaultParser = Parser.TEXT; - RestAssured.when().get("/restClient") - .then() - .statusCode(200); - Assertions.assertEquals(3, mockTracer.finishedSpans().size()); - Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello", - mockTracer.finishedSpans().get(0).operationName()); - Assertions.assertEquals("GET", mockTracer.finishedSpans().get(1).operationName()); - Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.restClient", - mockTracer.finishedSpans().get(2).operationName()); - } finally { - RestAssured.reset(); - } - } - - @Test - public void testContextPropagationInFaultTolerance() { - try { - RestAssured.defaultParser = Parser.TEXT; - RestAssured.when().get("/faultTolerance") - .then() - .statusCode(200) - .body(equalTo("fallback")); - Awaitility.await().atMost(5, TimeUnit.SECONDS) - .until(() -> mockTracer.finishedSpans().size() == 5); - List spans = mockTracer.finishedSpans(); - - Assertions.assertEquals(5, spans.size()); - for (MockSpan mockSpan : spans) { - Assertions.assertEquals(spans.get(0).context().traceId(), mockSpan.context().traceId()); - } - - // if timeout occurs, subsequent retries/fallback can be interleaved with the execution that timed out, - // resulting in varying span order - Assertions.assertEquals(3, countSpansWithOperationName(spans, "ft")); - Assertions.assertEquals(1, countSpansWithOperationName(spans, "fallback")); - Assertions.assertEquals(1, countSpansWithOperationName(spans, - "GET:io.quarkus.smallrye.opentracing.deployment.TestResource.faultTolerance")); - } finally { - RestAssured.reset(); - } - } - - private long countSpansWithOperationName(List spans, String operationName) { - return spans.stream().filter(span -> span.operationName().equals(operationName)).count(); - } - - @Test - public void testJPA() { - try { - RestAssured.defaultParser = Parser.JSON; - RestAssured.when().get("/jpa") - .then() - .statusCode(200) - .body("", hasSize(3)) - .body("name[0]", equalTo("Apple")) - .body("name[1]", equalTo("Banana")) - .body("name[2]", equalTo("Cherry")); - List spans = mockTracer.finishedSpans(); - - Assertions.assertEquals(3, spans.size()); - for (MockSpan mockSpan : spans) { - Assertions.assertEquals(spans.get(0).context().traceId(), mockSpan.context().traceId()); - } - MockSpan firstSpan = mockTracer.finishedSpans().get(0); - Assertions.assertEquals("Query", firstSpan.operationName()); - Assertions.assertTrue(firstSpan.tags().containsKey("db.statement")); - Assertions.assertTrue(firstSpan.tags().get("db.statement").toString().contains("known_fruits")); - Assertions.assertEquals("io.quarkus.smallrye.opentracing.deployment.Service.getFruits", - mockTracer.finishedSpans().get(1).operationName()); - Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.jpa", - mockTracer.finishedSpans().get(2).operationName()); - } finally { - RestAssured.reset(); - } - } -} diff --git a/extensions/smallrye-opentracing/deployment/src/test/resources/application.properties b/extensions/smallrye-opentracing/deployment/src/test/resources/application.properties deleted file mode 100644 index c474a0d75442b8..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -quarkus.datasource.db-kind=h2 -quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver -quarkus.datasource.jdbc.url=jdbc:tracing:h2:mem:test -quarkus.datasource.jdbc.max-size=8 - -quarkus.hibernate-orm.database.generation=drop-and-create -#quarkus.hibernate-orm.log.sql=true -quarkus.hibernate-orm.sql-load-script=import.sql - -quarkus.jaeger.disable-tracer-registration=true - diff --git a/extensions/smallrye-opentracing/deployment/src/test/resources/import.sql b/extensions/smallrye-opentracing/deployment/src/test/resources/import.sql deleted file mode 100644 index 2fffc825cfd97c..00000000000000 --- a/extensions/smallrye-opentracing/deployment/src/test/resources/import.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO known_fruits(id, name) VALUES (1, 'Cherry'); -INSERT INTO known_fruits(id, name) VALUES (2, 'Apple'); -INSERT INTO known_fruits(id, name) VALUES (3, 'Banana'); diff --git a/extensions/smallrye-opentracing/pom.xml b/extensions/smallrye-opentracing/pom.xml deleted file mode 100644 index e7c787b9a7fb1a..00000000000000 --- a/extensions/smallrye-opentracing/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - quarkus-extensions-parent - io.quarkus - 999-SNAPSHOT - ../pom.xml - - 4.0.0 - - quarkus-smallrye-opentracing-parent - Quarkus - SmallRye OpenTracing - pom - - deployment - runtime - - diff --git a/extensions/smallrye-opentracing/runtime/pom.xml b/extensions/smallrye-opentracing/runtime/pom.xml deleted file mode 100644 index 991ad47e2eba5c..00000000000000 --- a/extensions/smallrye-opentracing/runtime/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - quarkus-smallrye-opentracing-parent - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - quarkus-smallrye-opentracing - Quarkus - SmallRye OpenTracing - Runtime - Trace your services with SmallRye OpenTracing - - - org.eclipse.microprofile.config - microprofile-config-api - - - org.eclipse.microprofile.opentracing - microprofile-opentracing-api - - - io.smallrye - smallrye-opentracing - - - javax.inject - javax.inject - - - - - - jakarta.ws.rs - jakarta.ws.rs-api - - - io.smallrye - smallrye-fault-tolerance-tracing-propagation - - - * - * - - - - - jakarta.inject - jakarta.inject-api - - - io.quarkus - quarkus-arc - - - io.quarkus - quarkus-jaeger - - - io.quarkus - quarkus-resteasy - true - - - io.quarkus - quarkus-resteasy-reactive - true - - - io.quarkus - quarkus-jsonp - - - jakarta.servlet - jakarta.servlet-api - - - - - - - io.quarkus - quarkus-extension-maven-plugin - - - io.quarkus.smallrye.opentracing - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/FilterUtil.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/FilterUtil.java deleted file mode 100644 index 0449b4932a1b1a..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/FilterUtil.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import java.util.HashMap; -import java.util.Map; - -import io.opentracing.Span; -import io.opentracing.tag.Tags; - -final class FilterUtil { - - private FilterUtil() { - } - - static void addExceptionLogs(Span span, Throwable throwable) { - Tags.ERROR.set(span, true); - if (throwable != null) { - Map errorLogs = new HashMap<>(2); - errorLogs.put("event", Tags.ERROR.getKey()); - errorLogs.put("error.object", throwable); - span.log(errorLogs); - } - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingDynamicFeature.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingDynamicFeature.java deleted file mode 100644 index bc115097f088bc..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingDynamicFeature.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import jakarta.enterprise.inject.spi.CDI; -import jakarta.inject.Inject; -import jakarta.ws.rs.container.DynamicFeature; -import jakarta.ws.rs.container.ResourceInfo; -import jakarta.ws.rs.core.FeatureContext; -import jakarta.ws.rs.ext.Provider; - -import io.opentracing.Tracer; -import io.smallrye.opentracing.contrib.jaxrs2.server.OperationNameProvider; -import io.smallrye.opentracing.contrib.jaxrs2.server.ServerTracingDynamicFeature; - -@Provider -public class QuarkusSmallRyeTracingDynamicFeature implements DynamicFeature { - @Inject - TracingConfig tracingConfig; - - @Override - public void configure(ResourceInfo resourceInfo, FeatureContext context) { - ServerTracingDynamicFeature.Builder builder = new ServerTracingDynamicFeature.Builder( - CDI.current().select(Tracer.class).get()) - .withOperationNameProvider(OperationNameProvider.ClassNameOperationName.newBuilder()) - .withTraceSerialization(false); - - tracingConfig.skipPattern.ifPresent(builder::withSkipPattern); - if (tracingConfig.operationNameProvider.isPresent()) { - if (tracingConfig.operationNameProvider.get().equals(TracingConfig.OperationNameProvider.HTTP_PATH)) { - builder.withOperationNameProvider(OperationNameProvider.WildcardOperationName.newBuilder()); - } - } - - ServerTracingDynamicFeature serverTracing = builder.build(); - serverTracing.configure(resourceInfo, context); - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneContainerResponseFilter.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneContainerResponseFilter.java deleted file mode 100644 index ba2320371a1ad8..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneContainerResponseFilter.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import java.io.IOException; - -import jakarta.annotation.Priority; -import jakarta.interceptor.Interceptor; -import jakarta.ws.rs.Priorities; -import jakarta.ws.rs.container.ContainerRequestContext; -import jakarta.ws.rs.container.ContainerResponseContext; -import jakarta.ws.rs.ext.Provider; -import jakarta.ws.rs.ext.WriterInterceptor; -import jakarta.ws.rs.ext.WriterInterceptorContext; - -import org.jboss.resteasy.reactive.server.ServerResponseFilter; - -import io.opentracing.tag.Tags; -import io.smallrye.opentracing.contrib.jaxrs2.internal.SpanWrapper; - -@Provider -// We must close the span after everything else has finished -@Priority(Interceptor.Priority.PLATFORM_BEFORE) -public class QuarkusSmallRyeTracingStandaloneContainerResponseFilter implements WriterInterceptor { - - @ServerResponseFilter(priority = Priorities.HEADER_DECORATOR - 1) // this needs to be executed after ServerTracingFilter - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext, Throwable t) { - Object wrapperObj = requestContext.getProperty(SpanWrapper.PROPERTY_NAME); - if (!(wrapperObj instanceof SpanWrapper)) { - return; - } - SpanWrapper wrapper = (SpanWrapper) wrapperObj; - Tags.HTTP_STATUS.set(wrapper.get(), responseContext.getStatus()); - if (t != null) { - FilterUtil.addExceptionLogs(wrapper.get(), t); - } - } - - @Override - public void aroundWriteTo(WriterInterceptorContext wic) throws IOException { - try { - wic.proceed(); - } finally { - Object wrapperObj = wic.getProperty(SpanWrapper.PROPERTY_NAME); - if (wrapperObj instanceof SpanWrapper) { - SpanWrapper wrapper = (SpanWrapper) wrapperObj; - wrapper.getScope().close(); - wrapper.finish(); - } - } - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java deleted file mode 100644 index 681b78b369eede..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import java.io.IOException; - -import jakarta.enterprise.inject.spi.CDI; -import jakarta.ws.rs.container.ContainerRequestContext; -import jakarta.ws.rs.container.ContainerRequestFilter; -import jakarta.ws.rs.container.DynamicFeature; -import jakarta.ws.rs.container.ResourceInfo; -import jakarta.ws.rs.core.FeatureContext; -import jakarta.ws.rs.ext.Provider; - -import io.opentracing.tag.Tags; -import io.quarkus.vertx.http.runtime.CurrentVertxRequest; -import io.smallrye.opentracing.contrib.jaxrs2.internal.SpanWrapper; -import io.vertx.core.Handler; -import io.vertx.ext.web.RoutingContext; - -@Provider -public class QuarkusSmallRyeTracingStandaloneVertxDynamicFeature implements DynamicFeature { - - @Override - public void configure(ResourceInfo resourceInfo, FeatureContext context) { - context.register(StandaloneFilter.class); - } - - public static class StandaloneFilter implements ContainerRequestFilter { - - volatile CurrentVertxRequest currentVertxRequest; - - CurrentVertxRequest request() { - if (currentVertxRequest == null) { - currentVertxRequest = CDI.current().select(CurrentVertxRequest.class).get(); - } - return currentVertxRequest; - } - - @Override - public void filter(ContainerRequestContext requestContext) throws IOException { - RoutingContext routingContext = request().getCurrent(); - routingContext.addHeadersEndHandler(new Handler() { - @Override - public void handle(Void event) { - SpanWrapper wrapper = routingContext.get(SpanWrapper.PROPERTY_NAME); - if (wrapper != null) { - wrapper.getScope().close(); - Tags.HTTP_STATUS.set(wrapper.get(), routingContext.response().getStatusCode()); - if (routingContext.failure() != null) { - FilterUtil.addExceptionLogs(wrapper.get(), routingContext.failure()); - } - wrapper.finish(); - } - } - }); - } - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracerProducer.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracerProducer.java deleted file mode 100644 index 4af785fbacfb76..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracerProducer.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.context.Dependent; -import jakarta.enterprise.inject.Produces; - -import io.opentracing.Tracer; -import io.opentracing.util.GlobalTracer; - -/** - * Created by bob on 8/6/18. - */ -@Dependent -public class TracerProducer { - @Produces - @ApplicationScoped - Tracer tracer() { - return GlobalTracer.get(); - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfig.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfig.java deleted file mode 100644 index 64396e9dc8f635..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import java.util.Optional; - -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConfigPhase; -import io.quarkus.runtime.annotations.ConfigRoot; - -@ConfigRoot(name = "opentracing", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) -public class TracingConfig { - /** - * - */ - @ConfigItem(name = "server.skip-pattern") - public Optional skipPattern; - - /** - * - */ - @ConfigItem(name = "server.operation-name-provider", defaultValue = "class-method") - public Optional operationNameProvider; - - public enum OperationNameProvider { - HTTP_PATH, - CLASS_METHOD; - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfigRelocateConfigSourceInterceptor.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfigRelocateConfigSourceInterceptor.java deleted file mode 100644 index 9f1a0fe73a2266..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/TracingConfigRelocateConfigSourceInterceptor.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.quarkus.smallrye.opentracing.runtime; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import jakarta.annotation.Priority; - -import io.smallrye.config.ConfigSourceInterceptorContext; -import io.smallrye.config.ConfigValue; -import io.smallrye.config.Priorities; -import io.smallrye.config.RelocateConfigSourceInterceptor; - -@Priority(Priorities.LIBRARY + 600 - 5) -public class TracingConfigRelocateConfigSourceInterceptor extends RelocateConfigSourceInterceptor { - private static final Map RELOCATIONS = relocations(); - - public TracingConfigRelocateConfigSourceInterceptor() { - super(RELOCATIONS); - } - - @Override - public Iterator iterateNames(final ConfigSourceInterceptorContext context) { - final Set names = new HashSet<>(); - final Iterator namesIterator = context.iterateNames(); - while (namesIterator.hasNext()) { - final String name = namesIterator.next(); - names.add(name); - final String mappedName = RELOCATIONS.get(name); - if (mappedName != null) { - names.add(mappedName); - } - } - return names.iterator(); - } - - @Override - public Iterator iterateValues(final ConfigSourceInterceptorContext context) { - return context.iterateValues(); - } - - private static Map relocations() { - Map relocations = new HashMap<>(); - relocations.put("mp.opentracing.server.skip-pattern", "quarkus.opentracing.server.skip-pattern"); - relocations.put("quarkus.opentracing.server.skip-pattern", "mp.opentracing.server.skip-pattern"); - relocations.put("mp.opentracing.server.operation-name-provider", "quarkus.opentracing.server.operation-name-provider"); - relocations.put("quarkus.opentracing.server.operation-name-provider", "mp.opentracing.server.operation-name-provider"); - return Collections.unmodifiableMap(relocations); - } -} diff --git a/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/quarkus-extension.yaml deleted file mode 100644 index ef5bb82541cfe5..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -artifact: ${project.groupId}:${project.artifactId}:${project.version} -name: "SmallRye OpenTracing" -metadata: - keywords: - - "smallrye-opentracing" - - "opentracing" - - "tracing" - - "distributed-tracing" - - "jaeger" - guide: "https://quarkus.io/guides/opentracing" - categories: - - "observability" - status: "deprecated" - config: - - "quarkus.jaeger." - - "mp.opentracing." diff --git a/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor b/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor deleted file mode 100644 index 9a80fdce3e0e8b..00000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor +++ /dev/null @@ -1 +0,0 @@ -io.quarkus.smallrye.opentracing.runtime.TracingConfigRelocateConfigSourceInterceptor diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index b623b32388ee67..613865a7316aab 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -317,7 +317,6 @@ smallrye-metrics smallrye-graphql smallrye-graphql-client - smallrye-opentracing smallrye-stork-registration jpa-without-entity quartz diff --git a/integration-tests/smallrye-config/pom.xml b/integration-tests/smallrye-config/pom.xml index 190438f577f7f2..fed494bc780193 100644 --- a/integration-tests/smallrye-config/pom.xml +++ b/integration-tests/smallrye-config/pom.xml @@ -36,12 +36,6 @@ io.quarkus quarkus-resteasy-reactive-jackson - - - - io.quarkus - quarkus-smallrye-opentracing - io.quarkus @@ -147,19 +141,6 @@ - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-config-yaml-deployment diff --git a/integration-tests/smallrye-opentracing/pom.xml b/integration-tests/smallrye-opentracing/pom.xml deleted file mode 100644 index 9c1c6568ba67c7..00000000000000 --- a/integration-tests/smallrye-opentracing/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - quarkus-integration-tests-parent - io.quarkus - 999-SNAPSHOT - - 4.0.0 - quarkus-integration-test-smallrye-opentracing - Quarkus - Integration Tests - Smallrye Opentracing - - - - - org.hamcrest - hamcrest-core - 2.1 - - - - - - - - io.quarkus - quarkus-resteasy-reactive-jackson - - - io.quarkus - quarkus-smallrye-opentracing - - - io.opentracing.contrib - opentracing-jdbc - - - io.quarkus - quarkus-jdbc-postgresql - - - io.quarkus - quarkus-agroal - - - - - io.quarkus - quarkus-rest-client-reactive - - - - - io.opentracing - opentracing-mock - - - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - org.awaitility - awaitility - test - - - org.jboss.logging - commons-logging-jboss-logging - test - - - org.testcontainers - postgresql - test - - - org.testcontainers - junit-jupiter - test - - - - - io.quarkus - quarkus-agroal-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-jdbc-postgresql-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-resteasy-reactive-jackson-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-rest-client-reactive-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - pom - test - - - * - * - - - - - - - - - src/main/resources - true - - - - - io.quarkus - quarkus-maven-plugin - - - - build - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - native-image - - - native - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/ExporterResource.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/ExporterResource.java deleted file mode 100644 index 62373546b1dcff..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/ExporterResource.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.quarkus.it.opentracing; - -import java.util.List; -import java.util.stream.Collectors; - -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -import io.opentracing.mock.MockSpan; -import io.opentracing.mock.MockTracer; - -@Path("/export") -public class ExporterResource { - @Inject - MockTracer mockTracer; - - @GET - @Path("/clear") - public void clearExporter() { - mockTracer.reset(); - } - - @GET - public List retrieve() { - return mockTracer.finishedSpans().stream() - .filter(span -> !span.operationName().equals("GET:io.quarkus.it.opentracing.ExporterResource.clearExporter") && - !span.operationName().equals("GET:io.quarkus.it.opentracing.ExporterResource.retrieve")) - .collect(Collectors.toList()); - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/JdbcResource.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/JdbcResource.java deleted file mode 100644 index 0dd46624da87a3..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/JdbcResource.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.quarkus.it.opentracing; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.DataSource; - -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/jdbc") -public class JdbcResource { - @Inject - DataSource defaultDataSource; - - @GET - public TraceData jdbc() throws SQLException { - Connection con = defaultDataSource.getConnection(); - try (Statement stmt = con.createStatement()) { - ResultSet resultSet = stmt.executeQuery("select 1"); - resultSet.next(); - String result = resultSet.getString(1); - TraceData data = new TraceData(); - data.message = result; - return data; - } - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/MockTracerProvider.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/MockTracerProvider.java deleted file mode 100644 index 1eb5145dbca5b1..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/MockTracerProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.quarkus.it.opentracing; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Alternative; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Singleton; - -import io.opentracing.mock.MockTracer; -import io.opentracing.util.GlobalTracer; - -@ApplicationScoped -public class MockTracerProvider { - - @Produces - @Singleton - @Alternative - @Priority(1) - public MockTracer createInMemoryExporter() { - MockTracer tracer = new MockTracer(); - GlobalTracer.registerIfAbsent(tracer); - return tracer; - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/PingPongResource.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/PingPongResource.java deleted file mode 100644 index 10baa8c973e4c4..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/PingPongResource.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.quarkus.it.opentracing; - -import jakarta.inject.Inject; -import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; - -import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; -import org.eclipse.microprofile.rest.client.inject.RestClient; - -import io.smallrye.common.annotation.Blocking; -import io.smallrye.mutiny.Uni; - -@Singleton -@Path("/client") -public class PingPongResource { - @RegisterRestClient(configKey = "pingpong") - public interface PingPongRestClient { - - @Path("/client/pong/{message}") - @GET - String pingpong(@PathParam("message") String message); - - @GET - @Path("/client/pong/{message}") - Uni asyncPingpong(@PathParam("message") String message); - } - - @Inject - @RestClient - PingPongRestClient pingRestClient; - - @GET - @Path("pong/{message}") - public String pong(@PathParam("message") String message) { - return message; - } - - @GET - @Blocking - @Path("ping/{message}") - public String ping(@PathParam("message") String message) { - return pingRestClient.pingpong(message); - } - - @GET - @Path("async-ping/{message}") - public Uni asyncPing(@PathParam("message") String message) { - return pingRestClient.asyncPingpong(message); - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/SimpleResource.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/SimpleResource.java deleted file mode 100644 index 0060eb38197ff7..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/SimpleResource.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.quarkus.it.opentracing; - -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -@Path("/") -@Produces(MediaType.APPLICATION_JSON) -public class SimpleResource { - - @Inject - TracedService tracedService; - - @GET - @Path("/direct") - public TraceData directTrace() { - TraceData data = new TraceData(); - data.message = "Direct trace"; - - return data; - } - - @GET - @Path("/chained") - public TraceData chainedTrace() { - TraceData data = new TraceData(); - data.message = tracedService.call(); - - return data; - } - - @GET - @Path("/deep/path") - public TraceData deepUrlPathTrace() { - TraceData data = new TraceData(); - data.message = "Deep url path"; - - return data; - } - - @GET - @Path("/param/{paramId}") - public TraceData pathParameters(@PathParam("paramId") String paramId) { - TraceData data = new TraceData(); - data.message = "ParameterId: " + paramId; - - return data; - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TraceData.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TraceData.java deleted file mode 100644 index e847bcf1318054..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TraceData.java +++ /dev/null @@ -1,5 +0,0 @@ -package io.quarkus.it.opentracing; - -public class TraceData { - public String message; -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracedService.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracedService.java deleted file mode 100644 index ec2b2dbd17c7b8..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracedService.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.quarkus.it.opentracing; - -import jakarta.enterprise.context.ApplicationScoped; - -@ApplicationScoped -public class TracedService { - public String call() { - return "Chained trace"; - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracingProperyJdbcResource.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracingProperyJdbcResource.java deleted file mode 100644 index b6fa2ada998f70..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/TracingProperyJdbcResource.java +++ /dev/null @@ -1,87 +0,0 @@ -package io.quarkus.it.opentracing; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.DataSource; - -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/tracingpropertyjdbc") -public class TracingProperyJdbcResource { - @Inject - @io.quarkus.agroal.DataSource("postgres") - DataSource postgresDataSource; - - @Inject - @io.quarkus.agroal.DataSource("postgres2") - DataSource postgresDataSource2; - - @Inject - @io.quarkus.agroal.DataSource("postgres3") - DataSource postgresDataSource3; - - @Inject - @io.quarkus.agroal.DataSource("postgres4") - DataSource postgresDataSource4; - - @GET() - @Path("tracingenabled") - public TraceData jdbcTracingEnabled() throws SQLException { - Connection con = postgresDataSource.getConnection(); - try (Statement stmt = con.createStatement()) { - ResultSet resultSet = stmt.executeQuery("select 1"); - resultSet.next(); - String result = resultSet.getString(1); - TraceData data = new TraceData(); - data.message = result; - return data; - } - } - - @GET() - @Path("tracingdisabled") - public TraceData jdbcTracingDisabled() throws SQLException { - Connection con = postgresDataSource2.getConnection(); - try (Statement stmt = con.createStatement()) { - ResultSet resultSet = stmt.executeQuery("select 1"); - resultSet.next(); - String result = resultSet.getString(1); - TraceData data = new TraceData(); - data.message = result; - return data; - } - } - - @GET() - @Path("traceactivespanonly") - public TraceData traceActiveSpanOnly() throws SQLException { - Connection con = postgresDataSource3.getConnection(); - try (Statement stmt = con.createStatement()) { - ResultSet resultSet = stmt.executeQuery("select 1"); - resultSet.next(); - String result = resultSet.getString(1); - TraceData data = new TraceData(); - data.message = result; - return data; - } - } - - @GET() - @Path("traceignoresql") - public TraceData traceIgnoreSql() throws SQLException { - Connection con = postgresDataSource4.getConnection(); - try (Statement stmt = con.createStatement()) { - ResultSet resultSet = stmt.executeQuery("select 1"); - resultSet.next(); - String result = resultSet.getString(1); - TraceData data = new TraceData(); - data.message = result; - return data; - } - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanModuleSerializer.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanModuleSerializer.java deleted file mode 100644 index d48e38d6149e44..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanModuleSerializer.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.quarkus.it.opentracing.json; - -import jakarta.inject.Singleton; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; - -import io.opentracing.mock.MockSpan; -import io.quarkus.jackson.ObjectMapperCustomizer; - -@Singleton -public class MockSpanModuleSerializer implements ObjectMapperCustomizer { - @Override - public void customize(ObjectMapper objectMapper) { - SimpleModule simpleModule = new SimpleModule(); - simpleModule.addSerializer(MockSpan.class, new MockSpanSerializer()); - objectMapper.registerModule(simpleModule); - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanSerializer.java b/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanSerializer.java deleted file mode 100644 index 0ddcec9edfc820..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/java/io/quarkus/it/opentracing/json/MockSpanSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.quarkus.it.opentracing.json; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -import io.opentracing.mock.MockSpan; - -public class MockSpanSerializer extends StdSerializer { - - public MockSpanSerializer() { - super(MockSpan.class); - } - - @Override - public void serialize(MockSpan mockSpan, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) - throws IOException { - jsonGenerator.writeStartObject(); - - jsonGenerator.writeStringField("spanId", mockSpan.context().toSpanId()); - jsonGenerator.writeStringField("traceId", mockSpan.context().toTraceId()); - jsonGenerator.writeStringField("operation_name", mockSpan.operationName()); - - jsonGenerator.writeNumberField("parent_spanId", mockSpan.parentId()); - - mockSpan.tags().forEach((k, v) -> { - try { - jsonGenerator.writeStringField("tag_" + k, v.toString()); - } catch (IOException e) { - e.printStackTrace(); - } - }); - - mockSpan.context().baggageItems().forEach(entry -> { - try { - jsonGenerator.writeStringField("baggage_" + entry.getKey(), entry.getValue()); - } catch (IOException e) { - e.printStackTrace(); - } - }); - - jsonGenerator.writeEndObject(); - } -} diff --git a/integration-tests/smallrye-opentracing/src/main/resources/application.properties b/integration-tests/smallrye-opentracing/src/main/resources/application.properties deleted file mode 100644 index f0db68e6da5075..00000000000000 --- a/integration-tests/smallrye-opentracing/src/main/resources/application.properties +++ /dev/null @@ -1,42 +0,0 @@ -quarkus.datasource.db-kind=postgresql -quarkus.datasource.jdbc.url=jdbc:tracing:postgresql://localhost:5432/mydatabase -quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver -quarkus.datasource.username=sa -quarkus.datasource.password=sa -quarkus.rest.single-default-produces=false - -pingpong/mp-rest/url=${test.url} - -quarkus.datasource.postgres.db-kind=postgresql -quarkus.datasource.postgres.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase -quarkus.datasource.postgres.jdbc.driver=org.postgresql.Driver -quarkus.datasource.postgres.username=sa -quarkus.datasource.postgres.password=sa -quarkus.datasource.postgres.jdbc.tracing=true -quarkus.datasource.postgres.jdbc.tracing.enabled=true - -quarkus.datasource.postgres2.db-kind=postgresql -quarkus.datasource.postgres2.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase -quarkus.datasource.postgres2.jdbc.driver=org.postgresql.Driver -quarkus.datasource.postgres2.username=sa -quarkus.datasource.postgres2.password=sa -quarkus.datasource.postgres2.jdbc.tracing=true -quarkus.datasource.postgres2.jdbc.tracing.enabled=false - -quarkus.datasource.postgres3.db-kind=postgresql -quarkus.datasource.postgres3.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase -quarkus.datasource.postgres3.jdbc.driver=org.postgresql.Driver -quarkus.datasource.postgres3.username=sa -quarkus.datasource.postgres3.password=sa -quarkus.datasource.postgres3.jdbc.tracing=true -quarkus.datasource.postgres3.jdbc.tracing.enabled=true -quarkus.datasource.postgres3.jdbc.tracing.trace-with-active-span-only=true - -quarkus.datasource.postgres4.db-kind=postgresql -quarkus.datasource.postgres4.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase -quarkus.datasource.postgres4.jdbc.driver=org.postgresql.Driver -quarkus.datasource.postgres4.username=sa -quarkus.datasource.postgres4.password=sa -quarkus.datasource.postgres4.jdbc.tracing=true -quarkus.datasource.postgres4.jdbc.tracing.enabled=true -quarkus.datasource.postgres4.jdbc.tracing.ignore-for-tracing=select 1 diff --git a/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingITCase.java b/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingITCase.java deleted file mode 100644 index 619c69d90e5efa..00000000000000 --- a/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingITCase.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.quarkus.it.opentracing; - -import io.quarkus.test.junit.QuarkusIntegrationTest; - -@QuarkusIntegrationTest -public class OpenTracingITCase extends OpenTracingTestCase { -} diff --git a/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingTestCase.java b/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingTestCase.java deleted file mode 100644 index 0cb371027fe2e4..00000000000000 --- a/integration-tests/smallrye-opentracing/src/test/java/io/quarkus/it/opentracing/OpenTracingTestCase.java +++ /dev/null @@ -1,438 +0,0 @@ -package io.quarkus.it.opentracing; - -import static io.restassured.RestAssured.get; -import static io.restassured.RestAssured.given; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.equalTo; - -import java.time.Duration; -import java.util.List; -import java.util.Map; - -import org.awaitility.Awaitility; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.PostgreSQLContainer; - -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.common.mapper.TypeRef; - -@QuarkusTest -@DisabledOnOs({ OS.WINDOWS, OS.MAC }) -public class OpenTracingTestCase { - - static GenericContainer postgreSQLContainer; - - @BeforeAll - static void initPostgres() { - postgreSQLContainer = new PostgreSQLContainer(PostgreSQLContainer.IMAGE) - .withDatabaseName("mydatabase").withUsername("sa").withPassword("sa"); - postgreSQLContainer.setPortBindings(List.of("5432:5432")); - postgreSQLContainer.start(); - } - - private void resetExporter() { - given() - .when().get("/export/clear") - .then() - .statusCode(204); - } - - private List> getSpans() { - return get("/export").body().as(new TypeRef>>() { - }); - } - - @Test - void testResourceTracing() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("/direct") - .then() - .statusCode(200) - .body("message", equalTo("Direct trace")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 1); - Map spanData = getSpans().get(0); - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.SimpleResource.directTrace", spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - - @Test - void testChainedResourceTracing() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("/chained") - .then() - .statusCode(200) - .body("message", equalTo("Chained trace")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 1); - Map spanData = getSpans().get(0); - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.SimpleResource.chainedTrace", spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - - @Test - void testDeepPathNaming() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("/deep/path") - .then() - .statusCode(200) - .body("message", equalTo("Deep url path")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 1); - Map spanData = getSpans().get(0); - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.SimpleResource.deepUrlPathTrace", - spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - - @Test - void testPathParameter() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("/param/12345") - .then() - .statusCode(200) - .body("message", equalTo("ParameterId: 12345")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 1); - Map spanData = getSpans().get(0); - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.SimpleResource.pathParameters", spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - - @Test - void testClientTracing() { - resetExporter(); - - given() - .when().get("/client/ping/one") - .then() - .statusCode(200) - .body(containsString("one")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 3); - - boolean outsideServerFound = false; - boolean clientFound = false; - - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - - if (spanData.get("tag_span.kind").equals("server") - && spanData.get("operation_name").equals("GET:io.quarkus.it.opentracing.PingPongResource.ping")) { - outsideServerFound = true; - // Server Span - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.PingPongResource.ping", - spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } else if (spanData.get("tag_span.kind").equals("server") - && spanData.get("operation_name").equals("GET:io.quarkus.it.opentracing.PingPongResource.pong")) { - clientFound = true; - // Client span - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.PingPongResource.pong", - spanData.get("operation_name")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - } - - Assertions.assertTrue(outsideServerFound); - Assertions.assertTrue(clientFound); - } - - @Test - void testAsyncClientTracing() { - resetExporter(); - - given() - .when().get("/client/async-ping/one") - .then() - .statusCode(200) - .body(containsString("one")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 3); - - boolean outsideServerFound = false; - boolean clientFound = false; - - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - - if (spanData.get("tag_span.kind").equals("server") - && spanData.get("operation_name").equals("GET:io.quarkus.it.opentracing.PingPongResource.asyncPing")) { - outsideServerFound = true; - // Server Span - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.PingPongResource.asyncPing", - spanData.get("operation_name")); - Assertions.assertEquals(0, spanData.get("parent_spanId")); - - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } else if (spanData.get("tag_span.kind").equals("server") - && spanData.get("operation_name").equals("GET:io.quarkus.it.opentracing.PingPongResource.pong")) { - clientFound = true; - // Client span - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - Assertions.assertEquals("GET:io.quarkus.it.opentracing.PingPongResource.pong", - spanData.get("operation_name")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - } - } - - Assertions.assertTrue(outsideServerFound); - Assertions.assertTrue(clientFound); - } - - @Test - void testJdbcTracing() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("/jdbc") - .then() - .statusCode(200) - .body("message", equalTo("1")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 3); - - boolean resourceSpanFound = false; - boolean jdbcSpanFound = false; - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - - if (spanData.get("operation_name").equals("GET:io.quarkus.it.opentracing.JdbcResource.jdbc")) { - Assertions.assertEquals(0, spanData.get("parent_spanId")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - resourceSpanFound = true; - } else if (spanData.get("operation_name").equals("Query")) { - Assertions.assertEquals("client", spanData.get("tag_span.kind")); - Assertions.assertEquals("java-jdbc", spanData.get("tag_component")); - Assertions.assertEquals("select 1", spanData.get("tag_db.statement")); - jdbcSpanFound = true; - } - } - Assertions.assertTrue(resourceSpanFound); - Assertions.assertTrue(jdbcSpanFound); - } - - @Test - void testJdbcTracingPropertyEnabled() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("tracingpropertyjdbc/tracingenabled") - .then() - .statusCode(200) - .body("message", equalTo("1")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 3); - - boolean resourceSpanFound = false; - boolean jdbcSpanFound = false; - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - - if (spanData.get("operation_name") - .equals("GET:io.quarkus.it.opentracing.TracingProperyJdbcResource.jdbcTracingEnabled")) { - Assertions.assertEquals(0, spanData.get("parent_spanId")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - resourceSpanFound = true; - } else if (spanData.get("operation_name").equals("Query")) { - Assertions.assertEquals("client", spanData.get("tag_span.kind")); - Assertions.assertEquals("java-jdbc", spanData.get("tag_component")); - Assertions.assertEquals("select 1", spanData.get("tag_db.statement")); - jdbcSpanFound = true; - } - } - Assertions.assertTrue(resourceSpanFound); - Assertions.assertTrue(jdbcSpanFound); - } - - @Test - void testJdbcTracingPropertyDisabled() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("tracingpropertyjdbc/tracingdisabled") - .then() - .statusCode(200) - .body("message", equalTo("1")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 1); - - boolean resourceSpanFound = false; - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - - if (spanData.get("operation_name") - .equals("GET:io.quarkus.it.opentracing.TracingProperyJdbcResource.jdbcTracingDisabled")) { - Assertions.assertEquals(0, spanData.get("parent_spanId")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - resourceSpanFound = true; - } - } - Assertions.assertTrue(resourceSpanFound); - } - - @Test - void testJdbcTracingSpanOnly() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("tracingpropertyjdbc/traceactivespanonly") - .then() - .statusCode(200) - .body("message", equalTo("1")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 2); - - boolean resourceSpanFound = false; - boolean jdbcSpanFound = false; - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - - if (spanData.get("operation_name") - .equals("GET:io.quarkus.it.opentracing.TracingProperyJdbcResource.traceActiveSpanOnly")) { - Assertions.assertEquals(0, spanData.get("parent_spanId")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - resourceSpanFound = true; - } else if (spanData.get("operation_name").equals("Query")) { - Assertions.assertEquals("client", spanData.get("tag_span.kind")); - Assertions.assertEquals("java-jdbc", spanData.get("tag_component")); - Assertions.assertEquals("select 1", spanData.get("tag_db.statement")); - jdbcSpanFound = true; - } - } - Assertions.assertTrue(resourceSpanFound); - Assertions.assertTrue(jdbcSpanFound); - } - - @Test - void testJdbcTracingIgnoreSql() { - resetExporter(); - - given() - .contentType("application/json") - .when().get("tracingpropertyjdbc/traceignoresql") - .then() - .statusCode(200) - .body("message", equalTo("1")); - - Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> getSpans().size() == 3); - - boolean resourceSpanFound = false; - for (Map spanData : getSpans()) { - Assertions.assertNotNull(spanData); - Assertions.assertNotNull(spanData.get("spanId")); - Assertions.assertNotNull(spanData.get("traceId")); - - if (spanData.get("operation_name") - .equals("GET:io.quarkus.it.opentracing.TracingProperyJdbcResource.traceIgnoreSql")) { - Assertions.assertEquals(0, spanData.get("parent_spanId")); - Assertions.assertEquals("server", spanData.get("tag_span.kind")); - Assertions.assertEquals("jaxrs", spanData.get("tag_component")); - Assertions.assertEquals("GET", spanData.get("tag_http.method")); - Assertions.assertEquals("200", spanData.get("tag_http.status_code")); - resourceSpanFound = true; - } - } - Assertions.assertTrue(resourceSpanFound); - } -} diff --git a/relocations/pom.xml b/relocations/pom.xml index 375e4b9fd0ce18..0d5a530654d5cc 100644 --- a/relocations/pom.xml +++ b/relocations/pom.xml @@ -20,6 +20,10 @@ quarkus-opentelemetry-exporter-jaeger-deployment quarkus-opentelemetry-exporter-otlp quarkus-opentelemetry-exporter-otlp-deployment + quarkus-jaeger + quarkus-jaeger-deployment + quarkus-smallrye-opentracing + quarkus-smallrye-opentracing-deployment diff --git a/relocations/quarkus-jaeger-deployment/pom.xml b/relocations/quarkus-jaeger-deployment/pom.xml new file mode 100644 index 00000000000000..d914dd2d3500df --- /dev/null +++ b/relocations/quarkus-jaeger-deployment/pom.xml @@ -0,0 +1,22 @@ + + + + quarkus-relocations-parent + io.quarkus + 999-SNAPSHOT + + 4.0.0 + + quarkus-jaeger-deployment + + + + io.quarkiverse.jaeger + quarkus-jaeger-deployment + 1.0.0 + ${project.groupId}:${project.artifactId}:${project.version} was relocated to io.quarkiverse.jaeger:${project.artifactId}:1.0.0 and is not managed by io.quarkus.platform:quarkus-bom:${project.version} anymore. Please, update the groupId and add the corresponding version to the dependency declaration in your project configuration. For more information about this change, please refer to https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.6 + + + diff --git a/relocations/quarkus-jaeger/pom.xml b/relocations/quarkus-jaeger/pom.xml new file mode 100644 index 00000000000000..5b5139e08bf925 --- /dev/null +++ b/relocations/quarkus-jaeger/pom.xml @@ -0,0 +1,22 @@ + + + + quarkus-relocations-parent + io.quarkus + 999-SNAPSHOT + + 4.0.0 + + quarkus-jaeger + + + + io.quarkiverse.jaeger + quarkus-jaeger + 1.0.0 + ${project.groupId}:${project.artifactId}:${project.version} was relocated to io.quarkiverse.jaeger:${project.artifactId}:1.0.0 and is not managed by io.quarkus.platform:quarkus-bom:${project.version} anymore. Please, update the groupId and add the corresponding version to the dependency declaration in your project configuration. For more information about this change, please refer to https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.6 + + + diff --git a/relocations/quarkus-smallrye-opentracing-deployment/pom.xml b/relocations/quarkus-smallrye-opentracing-deployment/pom.xml new file mode 100644 index 00000000000000..88e6dc8b0d2254 --- /dev/null +++ b/relocations/quarkus-smallrye-opentracing-deployment/pom.xml @@ -0,0 +1,22 @@ + + + + quarkus-relocations-parent + io.quarkus + 999-SNAPSHOT + + 4.0.0 + + quarkus-smallrye-opentracing-deployment + + + + io.quarkiverse.opentracing + quarkus-smallrye-opentracing-deployment + 1.0.0 + ${project.groupId}:${project.artifactId}:${project.version} was relocated to io.quarkiverse.opentracing:${project.artifactId}:1.0.0 and is not managed by io.quarkus.platform:quarkus-bom:${project.version} anymore. Please, update the groupId and add the corresponding version to the dependency declaration in your project configuration. For more information about this change, please refer to https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.6 + + + diff --git a/relocations/quarkus-smallrye-opentracing/pom.xml b/relocations/quarkus-smallrye-opentracing/pom.xml new file mode 100644 index 00000000000000..442b37e3ad562e --- /dev/null +++ b/relocations/quarkus-smallrye-opentracing/pom.xml @@ -0,0 +1,22 @@ + + + + quarkus-relocations-parent + io.quarkus + 999-SNAPSHOT + + 4.0.0 + + quarkus-smallrye-opentracing + + + + io.quarkiverse.opentracing + quarkus-smallrye-opentracing + 1.0.0 + ${project.groupId}:${project.artifactId}:${project.version} was relocated to io.quarkiverse.opentracing:${project.artifactId}:1.0.0 and is not managed by io.quarkus.platform:quarkus-bom:${project.version} anymore. Please, update the groupId and add the corresponding version to the dependency declaration in your project configuration. For more information about this change, please refer to https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.6 + + +