diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 5c92e5a20767f..d6121d1e8d23e 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.1 2.1.12 @@ -56,7 +55,6 @@ 4.0.0 3.6.2 2.5.1 - 3.0.3 6.2.6 4.3.1 2.1.0 @@ -1229,16 +1227,6 @@ quarkus-infinispan-client-deployment ${project.version} - - io.quarkus - quarkus-jaeger - ${project.version} - - - io.quarkus - quarkus-jaeger-deployment - ${project.version} - io.quarkus quarkus-jdbc-db2 @@ -1606,16 +1594,6 @@ quarkus-smallrye-graphql-client-deployment ${project.version} - - io.quarkus - quarkus-smallrye-opentracing - ${project.version} - - - io.quarkus - quarkus-smallrye-opentracing-deployment - ${project.version} - io.quarkus quarkus-smallrye-stork @@ -3389,52 +3367,6 @@ angus-activation ${angus-activation.version} - - io.jaegertracing - jaeger-core - ${jaeger.version} - - - io.jaegertracing - jaeger-thrift - ${jaeger.version} - - - org.apache.tomcat.embed - tomcat-embed-core - - - - javax.annotation - javax.annotation-api - - - - - org.apache.tomcat - tomcat-annotations-api - - - - - io.jaegertracing - jaeger-zipkin - ${jaeger.version} - - - commons-logging - commons-logging - - - javax.annotation - javax.annotation-api - - - org.apache.tomcat.embed - tomcat-embed-core - - - com.h2database h2 @@ -3955,22 +3887,6 @@ smallrye-graphql-client-implementation-vertx ${smallrye-graphql.version} - - io.smallrye - smallrye-opentracing - ${smallrye-opentracing.version} - - - org.eclipse.microprofile.config - microprofile-config-api - - - - - io.smallrye - smallrye-opentracing-contrib - ${smallrye-opentracing.version} - io.smallrye smallrye-fault-tolerance @@ -6274,6 +6190,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/devtools/bom-descriptor-json/pom.xml b/devtools/bom-descriptor-json/pom.xml index cbdbc050e4dfc..02d144586d3ca 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 dbf502dbfae57..97ca57313cc60 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/extensions/jaeger/deployment/pom.xml b/extensions/jaeger/deployment/pom.xml deleted file mode 100644 index 5b8ad53ce4b32..0000000000000 --- 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 cb3ad4f399dc1..0000000000000 --- 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 8f6b2e781b589..0000000000000 --- 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 838ed596dfd69..0000000000000 --- 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 f22d6af0c82b0..0000000000000 --- 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 a6400b1e1db24..0000000000000 --- 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 3e0c864aeee0a..0000000000000 --- 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 e3a9302a3dafb..0000000000000 --- 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 1302b401001b8..0000000000000 --- 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 4670994e41303..0000000000000 --- 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 2169673f845b3..0000000000000 --- 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 ce8b0cf8de313..0000000000000 --- 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 3fb5faa053526..0000000000000 --- 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 e63255fc5d5c2..0000000000000 --- 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 8982c215804ae..0000000000000 --- 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 5a9f6ae128608..0000000000000 --- 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 386f4d8627844..0000000000000 --- 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 43da14644d901..0000000000000 --- 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 43d2c2843ee67..0000000000000 --- 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 c28c9dacff158..0000000000000 --- 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 e912d406b49e2..0000000000000 --- 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 d061a6f69b26a..0000000000000 --- 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 5a1f2039ecfc6..0000000000000 --- 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 dbc5d3ba58151..0000000000000 --- 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 0ece5c46cb821..0000000000000 --- 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 c02ebe61e0459..0000000000000 --- 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 979757c0e5f1b..0000000000000 --- 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 aca42cdda2ead..0000000000000 --- 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 0c71ec82a5071..0000000000000 --- 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 4a0f1d0a38eb6..0000000000000 --- 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/mongodb-client/deployment/pom.xml b/extensions/mongodb-client/deployment/pom.xml index 0b0278fa0db2c..0c50568794612 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/MongoClientProcessor.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java index 744b77a5cfeab..99da47258cee0 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 48fe208fdce7a..0000000000000 --- 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/runtime/pom.xml b/extensions/mongodb-client/runtime/pom.xml index 0d32b10af9339..c4b13424e4a02 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 e218eab5960ca..0000000000000 --- 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/pom.xml b/extensions/pom.xml index 5734b8bde14df..acc804301bc04 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/smallrye-opentracing/deployment/pom.xml b/extensions/smallrye-opentracing/deployment/pom.xml deleted file mode 100644 index 8d5b5a09f8214..0000000000000 --- 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 23687250ed9e1..0000000000000 --- 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 dfe69588a107f..0000000000000 --- 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 0589f77db2830..0000000000000 --- 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 5cf5fe0d47a54..0000000000000 --- 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 1edb36a5409c0..0000000000000 --- 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 bc06afbff985a..0000000000000 --- 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 c474a0d75442b..0000000000000 --- 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 2fffc825cfd97..0000000000000 --- 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 e7c787b9a7fb1..0000000000000 --- 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 991ad47e2eba5..0000000000000 --- 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 0449b4932a1b1..0000000000000 --- 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 bc115097f088b..0000000000000 --- 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 ba2320371a1ad..0000000000000 --- 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 681b78b369eed..0000000000000 --- 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 4af785fbacfb7..0000000000000 --- 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 64396e9dc8f63..0000000000000 --- 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 9f1a0fe73a226..0000000000000 --- 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 ef5bb82541cfe..0000000000000 --- 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 9a80fdce3e0e8..0000000000000 --- a/extensions/smallrye-opentracing/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor +++ /dev/null @@ -1 +0,0 @@ -io.quarkus.smallrye.opentracing.runtime.TracingConfigRelocateConfigSourceInterceptor diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 4ffed18b7049f..9e2a87421bd04 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -316,7 +316,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 190438f577f7f..fed494bc78019 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 9c1c6568ba67c..0000000000000 --- 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 62373546b1dcf..0000000000000 --- 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 0dd46624da87a..0000000000000 --- 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 1eb5145dbca5b..0000000000000 --- 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 10baa8c973e4c..0000000000000 --- 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 0060eb38197ff..0000000000000 --- 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 e847bcf131805..0000000000000 --- 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 ec2b2dbd17c7b..0000000000000 --- 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 b6fa2ada998f7..0000000000000 --- 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 d48e38d6149e4..0000000000000 --- 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 0ddcec9edfc82..0000000000000 --- 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 f0db68e6da507..0000000000000 --- 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 619c69d90e5ef..0000000000000 --- 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 0cb371027fe2e..0000000000000 --- 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 375e4b9fd0ce1..0d5a530654d5c 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 0000000000000..d914dd2d3500d --- /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 0000000000000..5b5139e08bf92 --- /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 0000000000000..88e6dc8b0d225 --- /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 0000000000000..442b37e3ad562 --- /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 + + +