diff --git a/.github/native-tests.json b/.github/native-tests.json index add0cc7c6e1d3f..d137a6435f5a11 100644 --- a/.github/native-tests.json +++ b/.github/native-tests.json @@ -111,7 +111,7 @@ { "category": "Misc3", "timeout": 80, - "test-modules": "kubernetes-client, openshift-client, kubernetes-service-binding-jdbc, smallrye-config, smallrye-graphql, smallrye-graphql-client, smallrye-metrics, smallrye-opentracing", + "test-modules": "kubernetes-client, openshift-client, kubernetes-service-binding-jdbc, smallrye-config, smallrye-graphql, smallrye-graphql-client, smallrye-metrics", "os-name": "ubuntu-latest" }, { diff --git a/.github/workflows/develocity-publish-build-scans.yml b/.github/workflows/develocity-publish-build-scans.yml index a285e66a8445be..6bafd0273332af 100644 --- a/.github/workflows/develocity-publish-build-scans.yml +++ b/.github/workflows/develocity-publish-build-scans.yml @@ -34,10 +34,4 @@ jobs: - name: Push to summary if: ${{ contains(fromJson(steps.extract-preapproved-developers.outputs.preapproved-developpers).preapproved-developers, github.event.workflow_run.actor.login) }} run: | - echo -n "Pull request: " >> ${GITHUB_STEP_SUMMARY} - cat pr-number.out >> ${GITHUB_STEP_SUMMARY} - echo >> ${GITHUB_STEP_SUMMARY} - echo >> ${GITHUB_STEP_SUMMARY} - echo "| Job | Status | Build scan |" >> ${GITHUB_STEP_SUMMARY} - echo "|---|---|---|" >> ${GITHUB_STEP_SUMMARY} - cat publication.out >> ${GITHUB_STEP_SUMMARY} + cat build-metadata.json >> ${GITHUB_STEP_SUMMARY} diff --git a/bom/application/pom.xml b/bom/application/pom.xml index d0eacdaee242f2..d375a8d52a98e7 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 @@ -73,7 +71,7 @@ 4.0.1 2.0.1 2.1.0 - 2.1.2 + 2.1.3 3.0.0 2.0.1 3.1.0 @@ -174,7 +172,7 @@ 4.24.0 2.2 6.0.0 - 4.11.0 + 4.11.1 1.8.0 0.34.1 3.25.5 @@ -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/core/deployment/src/main/java/io/quarkus/deployment/builditem/WebSocketLogHandlerBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/WebSocketLogHandlerBuildItem.java deleted file mode 100644 index 15927c1abc17fd..00000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/WebSocketLogHandlerBuildItem.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.quarkus.deployment.builditem; - -import java.util.Optional; -import java.util.logging.Handler; - -import org.wildfly.common.Assert; - -import io.quarkus.builder.item.SimpleBuildItem; -import io.quarkus.runtime.RuntimeValue; - -/** - * A build item for adding the dev stream log. - */ -public final class WebSocketLogHandlerBuildItem extends SimpleBuildItem { - private final RuntimeValue> handlerValue; - - /** - * Construct a new instance. - * - * @param handlerValue the handler value to add to the run time configuration - */ - public WebSocketLogHandlerBuildItem(final RuntimeValue> handlerValue) { - this.handlerValue = Assert.checkNotNullParam("handlerValue", handlerValue); - } - - /** - * Get the handler value. - * - * @return the handler value - */ - public RuntimeValue> getHandlerValue() { - return handlerValue; - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java index 346e3adf46bd75..5e0259026cafb0 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java @@ -72,7 +72,6 @@ import io.quarkus.deployment.builditem.ShutdownListenerBuildItem; import io.quarkus.deployment.builditem.StreamingLogHandlerBuildItem; import io.quarkus.deployment.builditem.SystemPropertyBuildItem; -import io.quarkus.deployment.builditem.WebSocketLogHandlerBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; @@ -229,7 +228,6 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(RecorderContext context, LoggingSe CombinedIndexBuildItem combinedIndexBuildItem, LogCategoryMinLevelDefaultsBuildItem categoryMinLevelDefaults, Optional streamingLogStreamHandlerBuildItem, - Optional wsLogStreamHandlerBuildItem, List handlerBuildItems, List namedHandlerBuildItems, List consoleFormatItems, @@ -258,11 +256,6 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(RecorderContext context, LoggingSe if (bannerBuildItem != null) { possibleSupplier = bannerBuildItem.getBannerSupplier(); } - // Old Dev UI Log Stream - RuntimeValue> wsDevUiLogHandler = null; - if (wsLogStreamHandlerBuildItem.isPresent()) { - wsDevUiLogHandler = wsLogStreamHandlerBuildItem.get().getHandlerValue(); - } // New Dev UI Log Stream RuntimeValue> streamingDevUiLogHandler = null; @@ -297,7 +290,7 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(RecorderContext context, LoggingSe shutdownListenerBuildItemBuildProducer.produce(new ShutdownListenerBuildItem( recorder.initializeLogging(log, buildLog, discoveredLogComponents, categoryMinLevelDefaults.content, alwaysEnableLogStream, - wsDevUiLogHandler, streamingDevUiLogHandler, handlers, namedHandlers, + streamingDevUiLogHandler, handlers, namedHandlers, possibleConsoleFormatters, possibleFileFormatters, possibleSyslogFormatters, possibleSupplier, launchModeBuildItem.getLaunchMode(), true))); LogConfig logConfig = new LogConfig(); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java index 031abef44544bc..a96468ab8b83ae 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java @@ -16,9 +16,9 @@ public final class ArtifactResultBuildItem extends MultiBuildItem { private final Path path; private final String type; - private final Map metadata; + private final Map metadata; - public ArtifactResultBuildItem(Path path, String type, Map metadata) { + public ArtifactResultBuildItem(Path path, String type, Map metadata) { this.path = path; this.type = type; this.metadata = metadata; @@ -32,7 +32,7 @@ public String getType() { return type; } - public Map getMetadata() { + public Map getMetadata() { return metadata; } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 06dc22675293c1..ad00129f0f4661 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -176,7 +176,7 @@ OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig ArtifactResultBuildItem jarOutput(JarBuildItem jarBuildItem) { if (jarBuildItem.getLibraryDir() != null) { return new ArtifactResultBuildItem(jarBuildItem.getPath(), PackageConfig.JAR, - Collections.singletonMap("library-dir", jarBuildItem.getLibraryDir())); + Collections.singletonMap("library-dir", jarBuildItem.getLibraryDir().toString())); } else { return new ArtifactResultBuildItem(jarBuildItem.getPath(), PackageConfig.JAR, Collections.emptyMap()); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 77ad5a2dc78ebd..33027514c089dc 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -10,11 +10,9 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -89,12 +87,8 @@ void nativeImageFeatures(BuildProducer features) { @BuildStep(onlyIf = NativeBuild.class) ArtifactResultBuildItem result(NativeImageBuildItem image) { NativeImageBuildItem.GraalVMVersion graalVMVersion = image.getGraalVMInfo(); - Map graalVMInfoProps = new HashMap<>(); - graalVMInfoProps.put("graalvm.version.full", graalVMVersion.getFullVersion()); - graalVMInfoProps.put("graalvm.version.version", graalVMVersion.getVersion()); - graalVMInfoProps.put("graalvm.version.javaVersion", "" + graalVMVersion.getJavaVersion()); - graalVMInfoProps.put("graalvm.version.distribution", graalVMVersion.getDistribution()); - return new ArtifactResultBuildItem(image.getPath(), PackageConfig.NATIVE, graalVMInfoProps); + return new ArtifactResultBuildItem(image.getPath(), PackageConfig.BuiltInType.NATIVE.getValue(), + graalVMVersion.toMap()); } @BuildStep(onlyIf = NativeSourcesBuild.class) diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java index ecba0b08bbfbee..d6df9bc896645b 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java @@ -228,12 +228,10 @@ private void writeArtifactResultMetadataFile(BuildSystemTargetBuildItem outputTa if (lastResult.getPath() != null) { properties.put("path", outputTargetBuildItem.getOutputDirectory().relativize(lastResult.getPath()).toString()); } - Map metadata = lastResult.getMetadata(); + Map metadata = lastResult.getMetadata(); if (metadata != null) { - for (Map.Entry entry : metadata.entrySet()) { - if (entry.getValue() instanceof String) { - properties.put("metadata." + entry.getKey(), entry.getValue()); - } + for (Map.Entry entry : metadata.entrySet()) { + properties.put("metadata." + entry.getKey(), entry.getValue()); } } try (FileOutputStream fos = new FileOutputStream(quarkusArtifactMetadataPath.toFile())) { diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java index 418fe3a1c9e6dd..6b37b15685d7dc 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java @@ -80,7 +80,7 @@ public static void handleFailedStart(RuntimeValue>> ba new LoggingSetupRecorder(new RuntimeValue<>(consoleRuntimeConfig)).initializeLogging(config, buildConfig, DiscoveredLogComponents.ofEmpty(), Collections.emptyMap(), - false, null, null, + false, null, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), @@ -92,7 +92,6 @@ public ShutdownListener initializeLogging(LogConfig config, LogBuildTimeConfig b DiscoveredLogComponents discoveredLogComponents, final Map categoryDefaultMinLevels, final boolean enableWebStream, - final RuntimeValue> wsDevUiConsoleHandler, final RuntimeValue> streamingDevUiConsoleHandler, final List>> additionalHandlers, final List>> additionalNamedHandlers, @@ -184,22 +183,6 @@ public void close() throws SecurityException { } if ((launchMode.isDevOrTest() || enableWebStream) - && wsDevUiConsoleHandler != null - && wsDevUiConsoleHandler.getValue().isPresent()) { - - Handler handler = wsDevUiConsoleHandler.getValue().get(); - handler.setErrorManager(errorManager); - handler.setFilter(new LogCleanupFilter(filterElements, shutdownNotifier)); - - if (possibleBannerSupplier != null && possibleBannerSupplier.getValue().isPresent()) { - Supplier bannerSupplier = possibleBannerSupplier.getValue().get(); - String header = "\n" + bannerSupplier.get(); - handler.publish(new LogRecord(Level.INFO, header)); - } - handlers.add(handler); - } - - if ((launchMode.isDevOrTest()) && streamingDevUiConsoleHandler != null && streamingDevUiConsoleHandler.getValue().isPresent()) { 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/datasource.adoc b/docs/src/main/asciidoc/datasource.adoc index 5c427dc8c425e4..bdc6a62dd18267 100644 --- a/docs/src/main/asciidoc/datasource.adoc +++ b/docs/src/main/asciidoc/datasource.adoc @@ -561,10 +561,11 @@ For more information, see the link:https://db.apache.org/derby/docs/10.8/devguid Example:: `jdbc:h2:tcp://localhost/~/test`, `jdbc:h2:mem:myDB` -H2 is an embedded database that can run as a server, based on a file, or run completely in memory. +H2 is a database that can run in embedded or server mode. +It can use a file storage or run entirely in memory. All of these options are available as listed above. -For more information, see the link:https://h2database.com/html/features.html?highlight=url&search=url#database_url[official documentation]. +For more information, see the link:https://h2database.com/html/features.html#database_url[official documentation]. ==== MariaDB @@ -592,7 +593,7 @@ hostDescription:: `[:] or address=(host=)[(port= - 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/security-oidc-code-flow-authentication-tutorial.adoc b/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc index 9ae22c5fe98e39..750c18e1eb83af 100644 --- a/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc +++ b/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc @@ -18,7 +18,7 @@ To learn more about the OIDC authorization code flow mechanism, see xref:securit To learn about how well-known social providers such as Apple, Facebook, GitHub, Google, Mastodon, Microsoft, Twitch, Twitter (X), and Spotify can be used with Quarkus OIDC, see xref:security-openid-connect-providers.adoc[Configuring Well-Known OpenID Connect Providers]. See also, xref:security-authentication-mechanisms.adoc#other-supported-authentication-mechanisms[Authentication mechanisms in Quarkus]. -If you want to protect your service applications by using OIDC Bearer token authentication, see xref:security-oidc-bearer-token-authentication-concept.adoc[OIDC Bearer token authentication]. +If you want to protect your service applications by using OIDC Bearer token authentication, see xref:security-oidc-bearer-token-authentication.adoc[OIDC Bearer token authentication]. == Prerequisites @@ -177,7 +177,7 @@ The `quarkus.oidc.application-type` property is set to `web-app` in order to tel Finally, the `quarkus.http.auth.permission.authenticated` permission is set to tell Quarkus about the paths you want to protect. In this case, all paths are being protected by a policy that ensures that only `authenticated` users are allowed to access. -For more information, see xref:security-authorization-of-web-endpoints-reference.adoc[Security Authorization Guide]. +For more information, see xref:security-authorize-web-endpoints-reference.adoc[Security Authorization Guide]. === Start and configure the Keycloak server @@ -274,4 +274,3 @@ After you have completed this tutorial, explore xref:security-oidc-bearer-token- * xref:security-oidc-auth0-tutorial.adoc[Protect Quarkus web application by using Auth0 OpenID Connect provider] * https://openid.net/connect/[OpenID Connect] * https://tools.ietf.org/html/rfc7519[JSON Web Token] - diff --git a/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc b/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc index 75b5aad3acc2de..7d65dd79d7d2e8 100644 --- a/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc +++ b/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc @@ -268,7 +268,7 @@ quarkus.oidc.tls.trust-store-password=${trust-store-password} ==== Introspection endpoint authentication -Some OIDC providers require authenticating to its introspection endpoint by using Basic authentication and with credentials that are different to the `client_id` and `client_secret`. +Some OIDC providers require authenticating to its introspection endpoint by using Basic authentication and with credentials that are different from the `client_id` and `client_secret`. If you have previously configured security authentication to support either the`client_secret_basic` or `client_secret_post` client authentication methods as described in the <> section, you might need to apply the additional configuration, as follows. If the tokens have to be introspected and the introspection endpoint-specific authentication mechanism is required, then you can configure `quarkus-oidc`, as follows: @@ -282,7 +282,8 @@ quarkus.oidc.introspection-credentials.secret=introspection-user-secret [[oidc-client-filters]] ==== OIDC request customization -You can customize OIDC requests made by Quarkus to the OIDC provider by registering one or more `OidcRequestFiler` implementations which can update or add new request headers, please see xref:security-openid-connect-client-reference#oidc-client-filters[Client request customization] for more information. +You can customize OIDC requests made by Quarkus to the OIDC provider by registering one or more `OidcRequestFiler` implementations, which can update or add new request headers. +For more information, see xref:security-openid-connect-client-reference#oidc-client-filters[Client request customization]. ==== Redirecting to and from the OIDC provider @@ -301,7 +302,7 @@ This will restore the request URL such as `http://localhost:8080/service/1`. ==== Customizing authentication requests -By default, only the `response_type` (set to `code`), `scope` (set to 'openid'), `client_id`, `redirect_uri` and `state` properties are passed as HTTP query parameters to the OpenID Connect provider's authorization endpoint when the user is redirected to it to authenticate. +By default, only the `response_type` (set to `code`), `scope` (set to `openid`), `client_id`, `redirect_uri`, and `state` properties are passed as HTTP query parameters to the OpenID Connect provider's authorization endpoint when the user is redirected to it to authenticate. You can add more properties to it with `quarkus.oidc.authentication.extra-params`. For example, some OIDC providers might choose to return the authorization code as part of the redirect URI's fragment, which would break the authentication process. @@ -398,7 +399,7 @@ public class ProtectedResource { } ---- -Note that `AccessTokenCredential` is used if the access token issued to the Quarkus `web-app` application is opaque (binary) and can not be parsed to a `JsonWebToken` or if the inner content is necessary for the application. +Note that `AccessTokenCredential` is used if the access token issued to the Quarkus `web-app` application is opaque (binary) and cannot be parsed to a `JsonWebToken` or if the inner content is necessary for the application. Injection of the `JsonWebToken` and `AccessTokenCredential` is supported in both `@RequestScoped` and `@ApplicationScoped` contexts. @@ -441,7 +442,7 @@ Additionally, a custom `SecurityIdentityAugmentor` can also be used to add the r === Ensuring validity of tokens and authentication data A core part of the authentication process is ensuring the chain of trust and validity of the information. -This is done by ensuring tokens are trustable. +This is done by ensuring tokens can be trusted. [[token-verification-introspection]] ==== Token verification and introspection @@ -459,14 +460,14 @@ If you expect the access token to contain the roles required to access the curre Code flow access tokens are not introspected unless they are expected to be the source of roles. They will however be used to get `UserInfo`. -There will be one or two remote calls with the code flow access token, if the token introspection and/or `UserInfo` are required. +There will be one or two remote calls with the code flow access token, if the token introspection, `UserInfo`, or both are required. -Please see xref:security-oidc-bearer-token-authentication.adoc#token-introspection-userinfo-cache[Token Introspection and UserInfo cache] for more information about using a default token cache or registering a custom cache implementation. +For more information about using a default token cache or registering a custom cache implementation, see xref:security-oidc-bearer-token-authentication.adoc#token-introspection-userinfo-cache[Token Introspection and UserInfo cache]. [[jwt-claim-verification]] ==== JSON web token claim verification -Please see xref:security-oidc-bearer-token-authentication.adoc#jwt-claim-verification[JSON Web Token Claim verification] section about the claim verification, including the `iss` (issuer) claim. +For information about the claim verification, including the `iss` (issuer) claim, see the xref:security-oidc-bearer-token-authentication.adoc#jwt-claim-verification[JSON Web Token Claim verification] section. It applies to ID tokens but also to access tokens in a JWT format if the `web-app` application has requested the access token verification. ==== Further security with Proof Key for Code Exchange (PKCE) @@ -484,7 +485,8 @@ quarkus.oidc.authentication.pkce-required=true quarkus.oidc.authentication.state-secret=eUk1p7UB3nFiXZGUXi0uph1Y9p34YhBU ---- -If you already have a 32-characters client secret then you do not need to set the `quarkus.oidc.authentication.pkce-secret` property unless you prefer to use a different secret key. This secret will be auto-generated if it is not configured and if the fallback to the client secret is not possible in case of the client secret being less than 16 characters long. +If you already have a 32-characters client secret then you do not need to set the `quarkus.oidc.authentication.pkce-secret` property unless you prefer to use a different secret key. +This secret will be autogenerated if it is not configured and if the fallback to the client secret is not possible in case of the client secret being less than 16 characters long. The secret key is required for encrypting a randomly generated `PKCE` `code_verifier` while the user is being redirected with the `code_challenge` query parameter to an OIDC provider to authenticate. The `code_verifier` is decrypted when the user is redirected back to Quarkus and sent to the token endpoint alongside the `code`, client secret, and other parameters to complete the code exchange. @@ -529,7 +531,7 @@ For example, if you have Quarkus services deployed on the following two domains, OIDC `CodeAuthenticationMechanism` uses the default `io.quarkus.oidc.TokenStateManager` interface implementation to keep the ID, access, and refresh tokens returned in the authorization code or refresh grant responses in an encrypted session cookie. -It makes Quarkus OIDC endpoints completely stateless and it is recommended to follow this strategy in order to achieve the best scalability results. +It makes Quarkus OIDC endpoints completely stateless and it is recommended to follow this strategy to achieve the best scalability results. See <> and <> sections of this guide for alternative approaches where tokens can be stored in the database or other server-side storage, if you prefer and have good reasons for storing the token state on the server. @@ -588,7 +590,7 @@ You can disable token encryption in the session cookie by setting `quarkus.oidc. Register a custom `io.quarkus.oidc.TokenStateManager' implementation as an `@ApplicationScoped` CDI bean if you need to customize the way the tokens are associated with the session cookie. -For example, you may want to keep the tokens in a cache cluster and have only a key stored in a session cookie. +For example, you might want to keep the tokens in a cache cluster and have only a key stored in a session cookie. Note that this approach might introduce some challenges if you need to make the tokens available across multiple microservices nodes. Here is a simple example: @@ -664,10 +666,10 @@ This extension will replace the default `io.quarkus.oidc.TokenStateManager' with OIDC Database Token State Manager is using a Reactive SQL client under the hood to avoid blocking since the authentication is likely to happen on IO thread. -Depending on your database, please include and configure exactly one xref:reactive-sql-clients.adoc[Reactive SQL client]. -Following Reactive SQL clients are supported: +Depending on your database, include and configure exactly one xref:reactive-sql-clients.adoc[Reactive SQL client]. +The following Reactive SQL clients are supported: -* Reactive MS SQL client +* Reactive Microsoft SQL client * Reactive MySQL client * Reactive PostgreSQL client * Reactive Oracle client @@ -675,7 +677,7 @@ Following Reactive SQL clients are supported: IMPORTANT: Your application is not required to switch to using the Reactive SQL client if it already uses Hibernate ORM with one of the JDBC driver extensions. -Let's say you already have application that is using the Hibernate ORM extension together with a PostgreSQL JDBC Driver and your datasource is configured like this: +For example, you already have an application that is using the Hibernate ORM extension together with a PostgreSQL JDBC Driver and your datasource is configured like this: [source, properties] ---- @@ -685,7 +687,7 @@ quarkus.datasource.password=quarkus_test quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/quarkus_test ---- -Now, if you decided to use OIDC Database Token State Manager, you need to add following dependencies and set a reactive driver URL. +Now, if you decided to use OIDC Database Token State Manager, you need to add the following dependencies and set a reactive driver URL. [source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] .pom.xml @@ -746,7 +748,8 @@ public class OidcDbTokenStateManagerEntity { Long expiresIn; } ---- -<1> The Hibernate ORM extension will only create this table for you when database schema is generated. Please refer to the xref:hibernate-orm.adoc[Hibernate ORM] guide for more information. +<1> The Hibernate ORM extension will only create this table for you when database schema is generated. +For more information, refer to the xref:hibernate-orm.adoc[Hibernate ORM] guide. <2> You can choose column length depending on the length of your tokens. ==== Logout and expiration @@ -760,13 +763,17 @@ Let's start with explicit logout operations. ===== User-initiated logout Users can request a logout by sending a request to the Quarkus endpoint logout path set with a `quarkus.oidc.logout.path` property. -For example, if the endpoint address is `https://application.com/webapp` and the `quarkus.oidc.logout.path` is set to "/logout" then the logout request has to be sent to `https://application.com/webapp/logout`. +For example, if the endpoint address is `https://application.com/webapp` and the `quarkus.oidc.logout.path` is set to "/logout", then the logout request has to be sent to `https://application.com/webapp/logout`. -This logout request will start an https://openid.net/specs/openid-connect-session-1_0.html#RPLogout[RP-Initiated Logout] and the user will be redirected to the OpenID Connect Provider to logout where a user may be asked to confirm the logout is indeed intended. +This logout request starts an https://openid.net/specs/openid-connect-session-1_0.html#RPLogout[RP-Initiated Logout]. +The user will be redirected to the OpenID Connect provider to log out, where they can be asked to confirm the logout is indeed intended. -The user will be returned to the endpoint post logout page once the logout has been completed if the `quarkus.oidc.logout.post-logout-path` property is set. For example, if the endpoint address is `https://application.com/webapp` and the `quarkus.oidc.logout.post-logout-path` is set to "/signin" then the user will be returned to `https://application.com/webapp/signin` (note this URI must be registered as a valid `post_logout_redirect_uri` in the OpenID Connect Provider). +The user will be returned to the endpoint post-logout page once the logout has been completed if the `quarkus.oidc.logout.post-logout-path` property is set. +For example, if the endpoint address is `https://application.com/webapp` and the `quarkus.oidc.logout.post-logout-path` is set to "/signin", then the user will be returned to `https://application.com/webapp/signin`. +Note, this URI must be registered as a valid `post_logout_redirect_uri` in the OpenID Connect provider. -If the `quarkus.oidc.logout.post-logout-path` is set then a `q_post_logout` cookie will be created and a matching `state` query parameter will be added to the logout redirect URI and the OpenID Connect Provider will return this `state` once the logout has been completed. It is recommended for the Quarkus `web-app` applications to check that a `state` query parameter matches the value of the `q_post_logout` cookie which can be done for example in a Jakarta REST filter. +If the `quarkus.oidc.logout.post-logout-path` is set, then a `q_post_logout` cookie will be created and a matching `state` query parameter will be added to the logout redirect URI and the OpenID Connect Provider will return this `state` once the logout has been completed. +It is recommended for the Quarkus `web-app` applications to check that a `state` query parameter matches the value of the `q_post_logout` cookie which can be done for example in a Jakarta REST filter. Note that a cookie name varies when using xref:security-openid-connect-multitenancy.adoc[OpenID Connect Multi-Tenancy]. For example, it will be named `q_post_logout_tenant_1` for a tenant with a `tenant_1` ID, and so on. @@ -792,7 +799,7 @@ quarkus.http.auth.permission.public.paths=/welcome.html quarkus.http.auth.permission.public.policy=permit ---- -You may also need to set `quarkus.oidc.authentication.cookie-path` to a path value common to all the application resources which is `/` in this example. +You might also need to set `quarkus.oidc.authentication.cookie-path` to a path value common to all the application resources which is `/` in this example. For more information, see the <> section. [NOTE] @@ -828,12 +835,13 @@ quarkus.oidc.logout.extra-params.client_id=${quarkus.oidc.client-id} [[back-channel-logout]] ===== Back-channel logout -The OIDC provider can force the logout of all applications using the authentification data: this is called back-channel logout. -In this case the OIDC will call a specific URL from each application to trigger that logout. +The OIDC provider can force the logout of all applications using the authentication data. +This is known as back-channel logout. +In this case, the OIDC will call a specific URL from each application to trigger that logout. -link:https://openid.net/specs/openid-connect-backchannel-1_0.html[Back-Channel Logout] is used by OpenID Connect providers to log out the current user from all the applications this user is currently logged in, bypassing the user agent. +link:https://openid.net/specs/openid-connect-backchannel-1_0.html[Back-channel logout] is used by OpenID Connect providers to log out the current user from all the applications this user is currently logged in, bypassing the user agent. -You can configure Quarkus to support `Back-Channel Logout` as follows: +You can configure Quarkus to support back-channel logout as follows: [source,properties] ---- @@ -854,8 +862,8 @@ For example, set `quarkus.oidc.token.age=10S` to ensure that no more than 10 sec [[front-channel-logout]] ===== Front-channel logout -link:https://openid.net/specs/openid-connect-frontchannel-1_0.html[Front-Channel Logout] can be used to logout the current user directly from the user agent (e.g. its browser). -It is like <> but the logout steps are executed by the user agent like the browser and not in the background by the OIDP provider. +You can use link:https://openid.net/specs/openid-connect-frontchannel-1_0.html[Front-channel logout] to log out the current user directly from the user agent, for example, its browser. +It is like <> but the logout steps are executed by the user agent like the browser and not in the background by the OIDC provider. This option is rarely used. You can configure Quarkus to support `Front-Channel Logout` as follows: @@ -939,7 +947,7 @@ You use the `quarkus.oidc.token.lifespan-grace` property only for taking some sm When the current authenticated user returns to the protected Quarkus endpoint and the ID token associated with the session cookie has expired, then, by default, the user is automatically redirected to the OIDC Authorization endpoint to re-authenticate. The OIDC provider might challenge the user again if the session between the user and this OIDC provider is still active, which might happen if the session is configured to last longer than the ID token. -If the `quarkus.oidc.token.refresh-expired` is set to `true`, then the expired ID token (as well as the access token) is refreshed by using the refresh token returned with the initial authorization code grant response. +If the `quarkus.oidc.token.refresh-expired` is set to `true`, then the expired ID token (and the access token) is refreshed by using the refresh token returned with the initial authorization code grant response. This refresh token might also be recycled (refreshed) itself as part of this process. As a result, the new session cookie is created and the session is extended. @@ -984,7 +992,7 @@ To support the integration with such OAuth2 servers, `quarkus-oidc` needs to be -- Even though you configure the extension to support the authorization code flows without `IdToken`, an internal `IdToken` is generated to standardize the way `quarkus-oidc` operates. You use an `IdToken` to support the authentication session and to avoid redirecting the user to the provider, such as GitHub, on every request. -In this case, the session lifespan is set to 5 minutes, which you can can extend further as described in the <> section. +In this case, the session lifespan is set to 5 minutes, which you can extend further as described in the <> section. This simplifies how you handle an application that supports multiple OIDC providers. -- @@ -1003,14 +1011,18 @@ Requiring <> involves making a remote call on every request. Therefore, you might want to consider caching `UserInfo` data. For more information, see the xref:security-oidc-bearer-token-authentication.adoc#token-introspection-userinfo-cache[Token Introspection and UserInfo cache] section of the "OpenID Connect (OIDC) Bearer token authentication" guide. -Alternatively, you may want to request that `UserInfo` is embedded into the internal generated `IdToken` with the `quarkus.oidc.cache-user-info-in-idtoken=true` property - the advantage of this approach is that by default no cached `UserInfo` state will be kept with the endpoint - instead it will be stored in a session cookie. You may also want to consider encrypting `IdToken` in this case if `UserInfo` contains sensitive data. For more information, see <>. +Alternatively, you might want to request that `UserInfo` is embedded into the internal generated `IdToken` with the `quarkus.oidc.cache-user-info-in-idtoken=true` property. +The advantage of this approach is that, by default, no cached `UserInfo` state will be kept with the endpoint - instead it will be stored in a session cookie. +You might also want to consider encrypting `IdToken` in this case if `UserInfo` contains sensitive data. +For more information, see <>. ==== OAuth2 servers might not support a well-known configuration endpoint. -In this case, you must disable the discovery and configure the authorization, token, and introspection and the userinfo endpoint paths manually. +In this case, you must disable the discovery and configure the authorization, token, and introspection and `UserInfo` endpoint paths manually. -For well-known OIDC or OAuth2 providers, like Apple, Facebook, GitHub, Google, Microsoft, Spotify, and Twitter, Quarkus can help significantly simplify your application's configuration with the `quarkus.oidc.provider` property. -Here is how you can integrate `quarkus-oidc` with GitHub after you have link:https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app[created a GitHub OAuth application]. Configure your Quarkus endpoint like this: +For well-known OIDC or OAuth2 providers, such as Apple, Facebook, GitHub, Google, Microsoft, Spotify, and Twitter, Quarkus can help significantly simplify your application's configuration with the `quarkus.oidc.provider` property. +Here is how you can integrate `quarkus-oidc` with GitHub after you have link:https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app[created a GitHub OAuth application]. +Configure your Quarkus endpoint like this: [source,properties] ---- @@ -1139,13 +1151,14 @@ public class TokenResource { Possibly a simpler alternative is to inject both `@IdToken JsonWebToken` and `UserInfo` and use `JsonWebToken` when dealing with the providers returning `IdToken` and `UserInfo` with the providers which do not return `IdToken`. -You must ensure that the callback path you enter in the GitHub OAuth application configuration matches the endpoint path where you'd like the user be redirected to after a successful GitHub authentication and application authorization, in this case it has to be set to `http:localhost:8080/github/userinfo`. +You must ensure that the callback path you enter in the GitHub OAuth application configuration matches the endpoint path where you want the user to be redirected after a successful GitHub authentication and application authorization. +In this case, it has to be set to `http:localhost:8080/github/userinfo`. === Listening to important authentication events You can register the `@ApplicationScoped` bean which will observe important OIDC authentication events. -When a user logs in for the first time, reauthenticates, or refreshes the session, the listener is updated. +When a user logs in for the first time, re-authenticates, or refreshes the session, the listener is updated. In the future, more events might be reported. For example: @@ -1177,7 +1190,7 @@ For information about Authorization Code Flow access token propagation to downst == Integration considerations -Your application secured by OIDC integrates in an environment where it can be called from single-page applications, needs to work with well-known OIDC providers, run behind HTTP Reverse Proxy, require external and internal access, etc. +Your application secured by OIDC integrates in an environment where it can be called from single-page applications, needs to work with well-known OIDC providers, run behind HTTP Reverse Proxy, require external and internal access, and so on. This section discusses these considerations. @@ -1274,11 +1287,14 @@ quarkus.oidc.token.issuer=https://accounts.google.com === Running Quarkus application behind a reverse proxy -OIDC authentication mechanism can be affected if your Quarkus application is running behind a reverse proxy/gateway/firewall when HTTP `Host` header may be reset to the internal IP address, HTTPS connection may be terminated, etc. For example, an authorization code flow `redirect_uri` parameter may be set to the internal host instead of the expected external one. +OIDC authentication mechanism can be affected if your Quarkus application is running behind a reverse proxy, gateway, or firewall when HTTP `Host` header might be reset to the internal IP address, HTTPS connection might be terminated, and so on. +For example, an authorization code flow `redirect_uri` parameter might be set to the internal host instead of the expected external one. -In such cases configuring Quarkus to recognize the original headers forwarded by the proxy will be required, for more information, see the xref:http-reference.adoc#reverse-proxy[Running behind a reverse proxy] Vert.x documentation section. +In such cases, configuring Quarkus to recognize the original headers forwarded by the proxy will be required. +For more information, see the xref:http-reference.adoc#reverse-proxy[Running behind a reverse proxy] Vert.x documentation section. -For example, if your Quarkus endpoint runs in a cluster behind Kubernetes Ingress then a redirect from the OpenID Connect Provider back to this endpoint may not work since the calculated `redirect_uri` parameter may point to the internal endpoint address. This problem can be resolved with the following configuration: +For example, if your Quarkus endpoint runs in a cluster behind Kubernetes Ingress, then a redirect from the OpenID Connect provider back to this endpoint might not work because the calculated `redirect_uri` parameter might point to the internal endpoint address. +You can resolve this problem by using the following configuration, where `X-ORIGINAL-HOST` is set by Kubernetes Ingress to represent the external endpoint address.: [source,properties] ---- @@ -1288,26 +1304,27 @@ quarkus.http.proxy.enable-forwarded-host=true quarkus.http.proxy.forwarded-host-header=X-ORIGINAL-HOST ---- -where `X-ORIGINAL-HOST` is set by Kubernetes Ingress to represent the external endpoint address. - -`quarkus.oidc.authentication.force-redirect-https-scheme` property may also be used when the Quarkus application is running behind an SSL terminating reverse proxy. +`quarkus.oidc.authentication.force-redirect-https-scheme` property can also be used when the Quarkus application is running behind an SSL terminating reverse proxy. === External and internal access to the OIDC provider -Note that the OpenID Connect Provider externally accessible authorization, logout and other endpoints may have different HTTP(S) URLs compared to the URLs auto-discovered or configured relative to `quarkus.oidc.auth-server-url` internal URL. -In such cases an issuer verification failure may be reported by the endpoint and redirects to the externally accessible Connect Provider endpoints may fail. +Note that the OpenID Connect provider externally-accessible authorization, logout, and other endpoints can have different HTTP(S) URLs compared to the URLs auto-discovered or configured relative to the `quarkus.oidc.auth-server-url` internal URL. +In such cases, the endpoint might report an issuer verification failure and redirects to the externally-accessible OIDC provider endpoints might fail. -In such cases, if you work with Keycloak then please start it with a `KEYCLOAK_FRONTEND_URL` system property set to the externally accessible base URL. -If you work with other Openid Connect providers then please check your provider's documentation. +In such cases, if you work with Keycloak, then start it with a `KEYCLOAK_FRONTEND_URL` system property set to the externally-accessible base URL. +If you work with other OpenID Connect providers, check the documentation of your provider. [[oidc-saml-broker]] -== OIDC SAML Identity broker +== OIDC SAML identity broker -If your identity provider does not implement OpenId Connect but only the legacy XML-based SAML2.0 SSO protocol, then Quarkus can not be used as a SAML 2.0 adapter, similarly to how `quarkus-oidc` is used as an OIDC adapter. +If your identity provider does not implement OpenID Connect but only the legacy XML-based SAML2.0 SSO protocol, then Quarkus cannot be used as a SAML 2.0 adapter, similarly to how `quarkus-oidc` is used as an OIDC adapter. -However, many OIDC providers such as Keycloak, Okta, Auth0, Microsoft ADFS can offer OIDC to SAML 2.0 bridges. You can create an identity broker connection to SAML 2.0 provider in your OIDC provider and use `quarkus-oidc` to authenticate your users to this SAML 2.0 provider with the OIDC provider coordinating OIDC and SAML 2.0 communications. As far as Quarkus endpoints are concerned, they can continue using the same Quarkus Security and OIDC API and annotations such as `@Authenticated`, `SecurityIdentity`, etc. +However, many OIDC providers such as Keycloak, Okta, Auth0, and Microsoft ADFS offer OIDC to SAML 2.0 bridges. +You can create an identity broker connection to a SAML 2.0 provider in your OIDC provider and use `quarkus-oidc` to authenticate your users to this SAML 2.0 provider, with the OIDC provider coordinating OIDC and SAML 2.0 communications. +As far as Quarkus endpoints are concerned, they can continue using the same Quarkus Security, OIDC API, annotations such as `@Authenticated`, `SecurityIdentity`, and so on. -For example, lets assume `Okta` is your SAML 2.0 provider and `Keycloak` is your OIDC provider. Here is a typical sequence explaining how to configure `Keycloak` to broker with the `Okta` SAML 2.0 provider. +For example, assume `Okta` is your SAML 2.0 provider and `Keycloak` is your OIDC provider. +Here is a typical sequence explaining how to configure `Keycloak` to broker with the `Okta` SAML 2.0 provider. First, create a new `SAML2` integration in your `Okta` `Dashboard/Applications`: @@ -1317,7 +1334,9 @@ For example, name it as `OktaSaml`: image::okta-saml-general-settings.png[alt=Okta SAML General Settings,role="center"] -Next, configure it to point to a Keycloak SAML broker endpoint. At this point you need to know the name of the Keycloak realm, for example, `quarkus`, and, assuming that the Keycloak SAML broker alias is `saml`, enter the endpoint address as `http:localhost:8081/realms/quarkus/broker/saml/endpoint` and Service provider (SP) entity id as `http:localhost:8081/realms/quarkus`, where `http://localhost:8081` is a Keycloak base address and `saml` is a broker alias: +Next, configure it to point to a Keycloak SAML broker endpoint. +At this point, you need to know the name of the Keycloak realm, for example, `quarkus`, and, assuming that the Keycloak SAML broker alias is `saml`, enter the endpoint address as `http:localhost:8081/realms/quarkus/broker/saml/endpoint`. +Enter the service provider (SP) entity ID as `http:localhost:8081/realms/quarkus`, where `http://localhost:8081` is a Keycloak base address and `saml` is a broker alias: image::okta-saml-configuration.png[alt=Okta SAML Configuration,role="center"] @@ -1325,7 +1344,7 @@ Next, save this SAML integration and note its Metadata URL: image::okta-saml-metadata.png[alt=Okta SAML Metadata,role="center"] -Next, add SAML Provider to Keycloak: +Next, add a SAML provider to Keycloak: First, as usual, create a new realm or import the existing realm to `Keycloak`, in this case, the realm name has to be `quarkus`. @@ -1333,20 +1352,24 @@ Now, in the `quarkus` Realm properties, navigate to `Identity Providers` and add image::keycloak-add-saml-provider.png[alt=Keycloak Add SAML Provider,role="center"] -Note the alias is set to `saml`, `Redirect URI` is `http:localhost:8081/realms/quarkus/broker/saml/endpoint` and `Service provider entity id` is `http:localhost:8081/realms/quarkus` - these are the same values you have entered when creating the Okta SAML integration in the previous step. +Note the alias is set to `saml`, `Redirect URI` is `http:localhost:8081/realms/quarkus/broker/saml/endpoint` and `Service provider entity ID` is `http:localhost:8081/realms/quarkus` - these are the same values you have entered when creating the Okta SAML integration in the previous step. + +Finally, set `Service entity descriptor` to point to the Okta SAML Integration Metadata URL you noted at the end of the previous step. -Finally, set `Service entity descriptor` to point to the Okta SAML Intregration Metadata URL you noted at the end of the previous step. +Next, if you want, you can register this Keycloak SAML Provider as a default provider by navigating to `Authentication/browser/Identity Provider Redirector config` and setting both the `Alias` and `Default Identity Provider` properties to `saml`. +If you do not configure it as a default provider then, at authentication time, Keycloak offers 2 options: -Next, if you would like, you can register this Keycloak SAML Provider as a Default Provider by navigating to `Authentication/browser/Identity Provider Redirector config` and setting both `Alias` and `Default Identity Provider` properties to `saml`. If you do not configure it as a Default Provider then, at the authentication time, Keycloak will offer 2 options - authenticate with the SAML provider, and authenticate directly to Keycloak with the name and password. +* Authenticate with the SAML provider +* Authenticate directly to Keycloak with the name and password -Now configure the Quarkus OIDC `web-app` application to point to the Keycloak `quarkus` realm, `quarkus.oidc.auth-server-url=http://localhost:8180/realms/quarkus` and you are ready to start authenticating your Quarkus users to the Okta SAML 2.0 provider using an OIDC to SAML bridge provided by Keycloak OIDC and Okta SAML 2.0 providers. +Now, configure the Quarkus OIDC `web-app` application to point to the Keycloak `quarkus` realm, `quarkus.oidc.auth-server-url=http://localhost:8180/realms/quarkus`, and you are ready to start authenticating your Quarkus users to the Okta SAML 2.0 provider by using an OIDC to SAML bridge that is provided by Keycloak OIDC and Okta SAML 2.0 providers. You can configure other OIDC providers to provide a SAML bridge similarly to how it can be done for Keycloak. [[integration-testing]] == Testing -Testing is often tricky when it comes to authentification to a separate OIDC like server. +Testing is often tricky when it comes to authentication to a separate OIDC-like server. Quarkus offers several options from mocking to a local run of an OIDC provider. Start by adding the following dependencies to your test project: @@ -1466,19 +1489,20 @@ Additionally, `OidcWiremockTestResource` set token issuer and audience to `https [[integration-testing-keycloak-devservices]] === Dev services for Keycloak -Using xref:security-openid-connect-dev-services.adoc[Dev Services for Keycloak] is recommended for the integration testing against Keycloak. -`Dev Services for Keycloak` will launch and initialize a test container: it will create a `quarkus` realm, a `quarkus-app` client (`secret` secret) and add `alice` (`admin` and `user` roles) and `bob` (`user` role) users, where all of these properties can be customized. +Using xref:security-openid-connect-dev-services.adoc[Dev Services for Keycloak] is recommended for integration testing against Keycloak. +`Dev Services for Keycloak` will start and initialize a test container: it will create a `quarkus` realm, a `quarkus-app` client (`secret` secret), and add `alice` (`admin` and `user` roles) and `bob` (`user` role) users, where all of these properties can be customized. -First, prepare `application.properties`. You can start with a completely empty `application.properties` as `Dev Services for Keycloak` will register `quarkus.oidc.auth-server-url` pointing to the running test container as well as `quarkus.oidc.client-id=quarkus-app` and `quarkus.oidc.credentials.secret=secret`. +First, prepare `application.properties`. +You can start with a completely empty `application.properties` file as `Dev Services for Keycloak` will register `quarkus.oidc.auth-server-url` pointing to the running test container as well as `quarkus.oidc.client-id=quarkus-app` and `quarkus.oidc.credentials.secret=secret`. -But if you already have all the required `quarkus-oidc` properties configured then you only need to associate `quarkus.oidc.auth-server-url` with the `prod` profile for `Dev Services for Keycloak`to start a container, for example: +However, if you already have all the required `quarkus-oidc` properties configured, then you only need to associate `quarkus.oidc.auth-server-url` with the `prod` profile for `Dev Services for Keycloak` to start a container, for example: [source,properties] ---- %prod.quarkus.oidc.auth-server-url=http://localhost:8180/realms/quarkus ---- -If a custom realm file has to be imported into Keycloak before running the tests then you can configure `Dev Services for Keycloak` as follows: +If a custom realm file has to be imported into Keycloak before running the tests, then you can configure `Dev Services for Keycloak` as follows: [source,properties] ---- @@ -1500,7 +1524,7 @@ public class CodeFlowAuthorizationTest { === Using KeycloakTestResourceLifecycleManager Use `KeycloakTestResourceLifecycleManager` for your tests only if there is a good reason not to use `Dev Services for Keycloak`. -If you need to do the integration testing against Keycloak then you are encouraged to do it with <>. +If you need to do the integration testing against Keycloak then you are encouraged to do it with <>. Start with adding the following dependency: @@ -1522,7 +1546,7 @@ testImplementation("io.quarkus:quarkus-test-keycloak-server") which provides `io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager` - an implementation of `io.quarkus.test.common.QuarkusTestResourceLifecycleManager` which starts a Keycloak container. -And configure the Maven Surefire plugin as follows: +Then, configure the Maven Surefire plugin as follows: [source,xml] ---- @@ -1543,7 +1567,7 @@ And configure the Maven Surefire plugin as follows: (and similarly the Maven Failsafe plugin when testing in native image). -And now set the configuration and write the test code the same way as it is described in the <> section. +Now, set the configuration and write the test code the same way as it is described in the <> section. The only difference is the name of `QuarkusTestResource`: [source, java] @@ -1564,7 +1588,7 @@ Default realm name is `quarkus` and client id - `quarkus-web-app` - set `keycloa [[integration-testing-security-annotation]] === TestSecurity annotation -See xref:security-oidc-bearer-token-authentication.adoc#integration-testing-security-annotation[Use TestingSecurity with injected JsonWebToken] section for more information about using `@TestSecurity` and `@OidcSecurity` annotations for testing the `web-app` application endpoint code which depends on the injected ID and access `JsonWebToken` as well as `UserInfo` and `OidcConfigurationMetadata`. +See the xref:security-oidc-bearer-token-authentication.adoc#integration-testing-security-annotation[Use TestingSecurity with injected JsonWebToken] section for more information about using `@TestSecurity` and `@OidcSecurity` annotations for testing the `web-app` application endpoint code, which depends on the injected ID and access `JsonWebToken` as well as `UserInfo` and `OidcConfigurationMetadata`. === Checking errors in the logs diff --git a/docs/src/main/asciidoc/security-proactive-authentication.adoc b/docs/src/main/asciidoc/security-proactive-authentication.adoc index 22f50c364a8e23..630cdbf278cd7f 100644 --- a/docs/src/main/asciidoc/security-proactive-authentication.adoc +++ b/docs/src/main/asciidoc/security-proactive-authentication.adoc @@ -23,7 +23,7 @@ To disable proactive authentication in Quarkus, set the following attribute in t [source,xml,options="nowrap",role="white-space-pre"] ---- -`quarkus.http.auth.proactive=false` +quarkus.http.auth.proactive=false ---- If you disable proactive authentication, the authentication process runs only when an identity is requested. @@ -42,7 +42,7 @@ You can still access `SecurityIdentity` synchronously with `public SecurityIdent The same is also valid for xref:reactive-routes.adoc[Reactive routes] if a route response is synchronous. ==== -xref:security-authorization.adoc#standard-security-annotations[Standard security annotations] on CDI beans are not supported on an I/O thread if a non-void secured method returns a value synchronously and proactive authentication is disabled because they need to access `SecurityIdentity`. +xref:security-authorize-web-endpoints-reference.adoc#standard-security-annotations[Standard security annotations] on CDI beans are not supported on an I/O thread if a non-void secured method returns a value synchronously and proactive authentication is disabled because they need to access `SecurityIdentity`. In the following example, `HelloResource` and `HelloService` are defined. Any GET request to `/hello` will run on the I/O thread and throw a `BlockingOperationNotAllowedException` exception. 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/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java index 006d92550f121f..382c20ccaa992c 100644 --- a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java +++ b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java @@ -61,6 +61,8 @@ public interface DataSourceJdbcRuntimeConfig { /** * The interval at which we check for connection leaks. */ + + @ConfigDocDefault("This feature is disabled by default.") Optional leakDetectionInterval(); /** @@ -72,6 +74,7 @@ public interface DataSourceJdbcRuntimeConfig { /** * The max lifetime of a connection. */ + @ConfigDocDefault("By default, there is no restriction on the lifespan of a connection.") Optional maxLifetime(); /** @@ -92,7 +95,7 @@ public interface DataSourceJdbcRuntimeConfig { boolean flushOnClose(); /** - * When enabled Agroal will be able to produce a warning when a connection is returned + * When enabled, Agroal will be able to produce a warning when a connection is returned * to the pool without the application having closed all open statements. * This is unrelated with tracking of open connections. * Disable for peak performance, but only when there's high confidence that @@ -112,7 +115,7 @@ public interface DataSourceJdbcRuntimeConfig { Optional validationQuerySql(); /** - * Disable pooling to prevent reuse of Connections. Use this with when an external pool manages the life-cycle + * Disable pooling to prevent reuse of Connections. Use this when an external pool manages the life-cycle * of Connections. */ @WithDefault("true") 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/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/TracerWithInvalidExtensionTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/TracerWithInvalidExtensionTest.java deleted file mode 100644 index cb7e67d871ecec..00000000000000 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/TracerWithInvalidExtensionTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.quarkus.opentelemetry.deployment; - -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.quarkus.builder.Version; -import io.quarkus.maven.dependency.Dependency; -import io.quarkus.runtime.configuration.ConfigurationException; -import io.quarkus.test.QuarkusProdModeTest; - -public class TracerWithInvalidExtensionTest { - @RegisterExtension - static final QuarkusProdModeTest config = new QuarkusProdModeTest() - .withEmptyApplication() - .setForcedDependencies(List.of(Dependency.of("io.quarkus", "quarkus-smallrye-opentracing", Version.getVersion()))) - .setExpectedException(ConfigurationException.class); - - @Test - void failStart() { - Assertions.fail("Test should not be run as deployment should fail"); - } -} 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/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java index 3099923f7efde6..6d336c2e0875ee 100644 --- a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java +++ b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java @@ -27,8 +27,8 @@ public interface DataSourceReactiveRuntimeConfig { * The datasource URLs. *

* If multiple values are set, this datasource will create a pool with a list of servers instead of a single server. - * The pool uses a round-robin load balancing when a connection is created to select different servers. - * Note: some driver may not support multiple values here. + * The pool uses round-robin load balancing for server selection during connection establishment. + * Note that certain drivers might not accommodate multiple values in this context. */ Optional> url(); 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-classic/resteasy-qute/runtime/pom.xml b/extensions/resteasy-classic/resteasy-qute/runtime/pom.xml index 5e8efa875a1e93..d04d398c5def2b 100644 --- a/extensions/resteasy-classic/resteasy-qute/runtime/pom.xml +++ b/extensions/resteasy-classic/resteasy-qute/runtime/pom.xml @@ -36,6 +36,19 @@ io.quarkus quarkus-extension-maven-plugin + + + process-resources + + extension-descriptor + + + + io.quarkus:quarkus-resteasy + + + + maven-compiler-plugin diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-qute/runtime/pom.xml b/extensions/resteasy-reactive/quarkus-resteasy-reactive-qute/runtime/pom.xml index efec1b3ef84728..bdf0e0b02cee96 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-qute/runtime/pom.xml +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-qute/runtime/pom.xml @@ -37,6 +37,19 @@ io.quarkus quarkus-extension-maven-plugin + + + process-resources + + extension-descriptor + + + + io.quarkus:quarkus-resteasy-reactive + + + + maven-compiler-plugin @@ -53,5 +66,4 @@ - 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 99f2c23cdcbcd3..49ee3402e3daff 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/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java index 640bc85b18df84..ba6aaf68ab5797 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java @@ -7,9 +7,9 @@ public class ArtifactResult { private final Path path; private final String type; - private final Map metadata; + private final Map metadata; - public ArtifactResult(Path path, String type, Map metadata) { + public ArtifactResult(Path path, String type, Map metadata) { this.path = path; this.type = type; this.metadata = metadata; @@ -23,7 +23,7 @@ public String getType() { return type; } - public Map getMetadata() { + public Map getMetadata() { return metadata; } } diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 82ecd9308c3376..0b5bf88744fa0d 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -38,7 +38,7 @@ 1.0.0 5.0.0 - 2.1.2 + 2.1.3 3.1.0 4.0.1 1.1.5 diff --git a/integration-tests/google-cloud-functions/src/test/java/io/quarkus/gcp/function/test/HttpFunctionRandomPortTestCase.java b/integration-tests/google-cloud-functions/src/test/java/io/quarkus/gcp/function/test/HttpFunctionRandomPortTestCase.java new file mode 100644 index 00000000000000..62bc600f3ff76a --- /dev/null +++ b/integration-tests/google-cloud-functions/src/test/java/io/quarkus/gcp/function/test/HttpFunctionRandomPortTestCase.java @@ -0,0 +1,31 @@ +package io.quarkus.gcp.function.test; + +import static io.restassured.RestAssured.when; +import static org.hamcrest.Matchers.is; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import io.quarkus.google.cloud.functions.test.FunctionType; +import io.quarkus.google.cloud.functions.test.WithFunction; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@WithFunction(FunctionType.HTTP) +class HttpFunctionRandomPortTestCase { + + @BeforeAll + public static void setup() { + System.setProperty("quarkus.http.test-port", "0"); + } + + @Test + public void test() { + // test the function using RestAssured + when() + .get() + .then() + .statusCode(200) + .body(is("Hello World!")); + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java index 53fb22ecfc1b73..ef72c927992f24 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java @@ -5,6 +5,9 @@ import org.junit.jupiter.api.Test; +import io.quarkus.test.junit.DisableIfBuiltWithGraalVMNewerThan; +import io.quarkus.test.junit.DisableIfBuiltWithGraalVMOlderThan; +import io.quarkus.test.junit.GraalVMVersion; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.restassured.RestAssured; @@ -56,14 +59,21 @@ public void testTargetWithoutNested() { } @Test - public void testLambdaCapturing() { - final String resourceLambda = BASE_PKG + ".ResourceLambda"; - + @DisableIfBuiltWithGraalVMNewerThan(GraalVMVersion.GRAALVM_23_1_0) + public void testLambdaCapturingPre24_0() { // Starting with GraalVM 22.1 support Lambda functions serialization // (see https://github.com/oracle/graal/issues/3756) RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda$")); } + @Test + @DisableIfBuiltWithGraalVMOlderThan(GraalVMVersion.GRAALVM_24_0_0) + public void testLambdaCapturingPost23_1() { + // Starting with GraalVM 24.0 lambda class names match the ones from HotSpot + // (see https://github.com/oracle/graal/pull/7775) + RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda/")); + } + private void assertRegistration(String expected, String queryParam) { RestAssured.given().queryParam("className", queryParam).when().get(ENDPOINT).then().body(is(expected)); } diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 436687b87d0645..3fdb4245dcf4b0 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -318,7 +318,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 + + + diff --git a/tcks/microprofile-opentracing/base/pom.xml b/tcks/microprofile-opentracing/base/pom.xml deleted file mode 100644 index 5feebe69a01871..00000000000000 --- a/tcks/microprofile-opentracing/base/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - quarkus-tck-microprofile-opentracing - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - - quarkus-tck-microprofile-opentracing-base - Quarkus - TCK - MicroProfile OpenTracing - Base - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - ${project.basedir}/src/test/resources/tck-suite.xml - - - - true - - false - - - - - org.eclipse.microprofile.opentracing:microprofile-opentracing-tck - - - - - - - - - io.quarkus - quarkus-arquillian - - - io.quarkus - quarkus-smallrye-opentracing - - - io.quarkus - quarkus-resteasy-jsonb - - - io.opentracing - opentracing-mock - - - io.quarkus - quarkus-rest-client - - - org.eclipse.microprofile.opentracing - microprofile-opentracing-tck - ${microprofile-opentracing-tck.version} - - - org.sonatype.plexus - * - - - - - - - io.quarkus - quarkus-rest-client-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-resteasy-jsonb-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - pom - test - - - * - * - - - - - diff --git a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ArquillianExtension.java b/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ArquillianExtension.java deleted file mode 100644 index ff408ac9ddf886..00000000000000 --- a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ArquillianExtension.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.quarkus.tck.opentracing; - -import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; -import org.jboss.arquillian.core.spi.LoadableExtension; - -/** - * @author Pavol Loffay - */ -public class ArquillianExtension implements LoadableExtension { - - @Override - public void register(ExtensionBuilder extensionBuilder) { - extensionBuilder.service(ApplicationArchiveProcessor.class, DeploymentProcessor.class); - } -} diff --git a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/DeploymentProcessor.java b/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/DeploymentProcessor.java deleted file mode 100644 index cde0c3eebd7675..00000000000000 --- a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/DeploymentProcessor.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.quarkus.tck.opentracing; - -import org.eclipse.microprofile.opentracing.ClientTracingRegistrarProvider; -import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; -import org.jboss.arquillian.test.spi.TestClass; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.spec.WebArchive; - -/** - * @author Pavol Loffay - * @author Jan Martiska - */ -public class DeploymentProcessor implements ApplicationArchiveProcessor { - - @Override - public void process(Archive archive, TestClass testClass) { - if (archive instanceof WebArchive) { - WebArchive war = WebArchive.class.cast(archive); - - // enable tracing on the client side - war.addAsServiceProvider(ClientTracingRegistrarProvider.class, - ResteasyClientTracingRegistrarProvider.class); - war.addClasses(ResteasyClientTracingRegistrarProvider.class); - - // override the default TracerProducer - war.addClass(MockTracerProducer.class); - - // workaround for RESTEASY-1758 - war.addClass(ExceptionMapper.class); - } - - } -} diff --git a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ExceptionMapper.java b/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ExceptionMapper.java deleted file mode 100644 index aecc605891e1dd..00000000000000 --- a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ExceptionMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.quarkus.tck.opentracing; - -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; -import jakarta.ws.rs.ext.Provider; - -/** - * Temporary fix to catch exceptions thrown in JAX-RS endpoints - * See https://issues.jboss.org/browse/RESTEASY-1758 - * - * @author Pavol Loffay - */ -@Provider -public class ExceptionMapper implements jakarta.ws.rs.ext.ExceptionMapper { - - @Override - public Response toResponse(RuntimeException exception) { - return Response.status(Status.INTERNAL_SERVER_ERROR).build(); - } -} diff --git a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/MockTracerProducer.java b/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/MockTracerProducer.java deleted file mode 100644 index 37b2718d1acf9b..00000000000000 --- a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/MockTracerProducer.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.quarkus.tck.opentracing; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Alternative; -import jakarta.enterprise.inject.Default; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Singleton; -import jakarta.interceptor.Interceptor; - -import io.opentracing.Tracer; -import io.opentracing.mock.MockTracer; - -/** - * @author Pavol Loffay - * @author Jan Martiska - */ -@ApplicationScoped -@Alternative // this needs to override io.quarkus.smallrye.opentracing.runtime.TracerProducer -@Priority(Interceptor.Priority.APPLICATION + 10) -public class MockTracerProducer { - - @Default - @Produces - @Singleton - public Tracer tracer() { - return new MockTracer(); - } -} diff --git a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ResteasyClientTracingRegistrarProvider.java b/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ResteasyClientTracingRegistrarProvider.java deleted file mode 100644 index 6ea23bcf766a54..00000000000000 --- a/tcks/microprofile-opentracing/base/src/main/java/io/quarkus/tck/opentracing/ResteasyClientTracingRegistrarProvider.java +++ /dev/null @@ -1,29 +0,0 @@ - -package io.quarkus.tck.opentracing; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import jakarta.enterprise.inject.spi.CDI; -import jakarta.ws.rs.client.ClientBuilder; - -import org.eclipse.microprofile.opentracing.ClientTracingRegistrarProvider; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; - -import io.opentracing.Tracer; -import io.opentracing.contrib.concurrent.TracedExecutorService; -import io.smallrye.opentracing.SmallRyeClientTracingFeature; - -public class ResteasyClientTracingRegistrarProvider implements ClientTracingRegistrarProvider { - - public ClientBuilder configure(ClientBuilder clientBuilder) { - return configure(clientBuilder, Executors.newFixedThreadPool(10)); - } - - public ClientBuilder configure(ClientBuilder clientBuilder, ExecutorService executorService) { - ResteasyClientBuilder resteasyClientBuilder = (ResteasyClientBuilder) clientBuilder; - Tracer tracer = CDI.current().select(Tracer.class).get(); - return resteasyClientBuilder.executorService(new TracedExecutorService(executorService, tracer)) - .register(new SmallRyeClientTracingFeature(tracer)); - } -} diff --git a/tcks/microprofile-opentracing/base/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tcks/microprofile-opentracing/base/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension deleted file mode 100644 index f8bd98c23eba73..00000000000000 --- a/tcks/microprofile-opentracing/base/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension +++ /dev/null @@ -1 +0,0 @@ -io.quarkus.tck.opentracing.ArquillianExtension \ No newline at end of file diff --git a/tcks/microprofile-opentracing/base/src/test/resources/tck-suite.xml b/tcks/microprofile-opentracing/base/src/test/resources/tck-suite.xml deleted file mode 100644 index 5cea1722f53b7d..00000000000000 --- a/tcks/microprofile-opentracing/base/src/test/resources/tck-suite.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tcks/microprofile-opentracing/pom.xml b/tcks/microprofile-opentracing/pom.xml deleted file mode 100644 index 9dc3eae41b7709..00000000000000 --- a/tcks/microprofile-opentracing/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - quarkus-tck-parent - io.quarkus - 999-SNAPSHOT - ../pom.xml - - 4.0.0 - - quarkus-tck-microprofile-opentracing - pom - Quarkus - TCK - MicroProfile OpenTracing Parent - - - 3.0 - - - - base - rest-client - - - diff --git a/tcks/microprofile-opentracing/rest-client/pom.xml b/tcks/microprofile-opentracing/rest-client/pom.xml deleted file mode 100644 index 21455c3a85cae9..00000000000000 --- a/tcks/microprofile-opentracing/rest-client/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - quarkus-tck-microprofile-opentracing - io.quarkus - 999-SNAPSHOT - - 4.0.0 - - - quarkus-tck-microprofile-opentracing-rest-client - Quarkus - TCK - MicroProfile OpenTracing - REST Client - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - true - - false - - - - - org.eclipse.microprofile.opentracing:microprofile-opentracing-tck-rest-client - - - - - - - - - - io.quarkus - quarkus-tck-microprofile-opentracing-base - ${project.version} - - - org.eclipse.microprofile.opentracing - microprofile-opentracing-tck-rest-client - ${microprofile-opentracing-tck.version} - - - - diff --git a/tcks/microprofile-opentracing/rest-client/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tcks/microprofile-opentracing/rest-client/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension deleted file mode 100644 index f8bd98c23eba73..00000000000000 --- a/tcks/microprofile-opentracing/rest-client/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension +++ /dev/null @@ -1 +0,0 @@ -io.quarkus.tck.opentracing.ArquillianExtension \ No newline at end of file diff --git a/tcks/pom.xml b/tcks/pom.xml index d6ffca4d594891..d3d471d05ea486 100644 --- a/tcks/pom.xml +++ b/tcks/pom.xml @@ -110,7 +110,6 @@ microprofile-rest-client microprofile-rest-client-reactive microprofile-openapi - microprofile-opentracing microprofile-opentelemetry microprofile-lra resteasy-reactive diff --git a/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/CloudFunctionsInvoker.java b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/CloudFunctionsInvoker.java index 7398177930c746..efe8648db5351a 100644 --- a/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/CloudFunctionsInvoker.java +++ b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/CloudFunctionsInvoker.java @@ -11,8 +11,12 @@ class CloudFunctionsInvoker { } CloudFunctionsInvoker(FunctionType functionType, int port) { + int realPort = port == 0 ? SocketUtil.findAvailablePort() : port; + if (realPort != port) { + System.setProperty("quarkus.http.test-port", String.valueOf(realPort)); + } this.invoker = new Invoker( - port, + realPort, functionType.getTarget(), functionType.getSignatureType(), Thread.currentThread().getContextClassLoader()); diff --git a/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/SocketUtil.java b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/SocketUtil.java new file mode 100644 index 00000000000000..cc29160ef51f00 --- /dev/null +++ b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/SocketUtil.java @@ -0,0 +1,29 @@ +package io.quarkus.google.cloud.functions.test; + +import java.io.IOException; +import java.net.ServerSocket; + +// copied from the mailer extension: io.quarkus.mailer.runtime.SocketUtil +final class SocketUtil { + + private SocketUtil() { + } + + static int findAvailablePort() { + ServerSocket serverSocket = null; + try { + serverSocket = new ServerSocket(0); + return serverSocket.getLocalPort(); + } catch (Exception e) { + // return a default port + return 25347; + } finally { + if (serverSocket != null) { + try { + serverSocket.close(); + } catch (IOException e) { + } + } + } + } +} diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java index 57a48a22a72093..4304ec31ff042f 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java @@ -36,7 +36,7 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con Properties quarkusArtifactProperties = readQuarkusArtifactProperties(context); try { GraalVM.Version version = GraalVM.Version - .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.version").lines()); + .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.full").lines()); int comparison = annotationValue.getVersion().compareTo(version); if (comparison < 0) { return ConditionEvaluationResult.disabled("Native binary was built with GraalVM{version=" + version.toString() diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java index d7cf3db2398442..44eda6c744d4ab 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java @@ -36,7 +36,7 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con Properties quarkusArtifactProperties = readQuarkusArtifactProperties(context); try { GraalVM.Version version = GraalVM.Version - .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.version").lines()); + .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.full").lines()); int comparison = annotationValue.getVersion().compareTo(version); if (comparison > 0) { return ConditionEvaluationResult.disabled("Native binary was built with GraalVM{version=" + version.toString() diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java index c157cfbdb0ff2d..df95a13f166b9b 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java @@ -3,7 +3,8 @@ import io.quarkus.deployment.pkg.steps.GraalVM; public enum GraalVMVersion { - GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0); + GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0), + GRAALVM_24_0_0(GraalVM.Version.VERSION_24_0_0); private final GraalVM.Version version;