From 95fea0b5da08c9ec968bfb8e3b42c621ce4412cb Mon Sep 17 00:00:00 2001 From: Ales Justin Date: Thu, 17 Oct 2024 12:50:53 +0200 Subject: [PATCH] Add SimpleSpanProcessor support --- .../_includes/opentelemetry-config.adoc | 8 +++ .../deployment/OpenTelemetryProcessor.java | 1 + .../exporter/otlp/OtlpExporterProcessor.java | 11 +++-- .../OpenTelemetryDisabledSdkTest.java | 6 +-- .../otlp/OtlpTraceExporterDisabledTest.java | 6 +-- .../OpenTelemetrySamplerConfigTest.java | 4 +- ...uredOpenTelemetrySdkBuilderCustomizer.java | 49 ++++++++++++++++++- .../runtime/config/build/OTelBuildConfig.java | 11 +++++ .../exporter/otlp/OTelExporterRecorder.java | 39 +++++++++------ ...essor.java => LateBoundSpanProcessor.java} | 15 +++--- ...RemoveableLateBoundBatchSpanProcessor.java | 16 ------ .../RemoveableLateBoundSpanProcessor.java | 16 ++++++ .../vertx/exporter/SimpleProfile.java | 12 +++++ .../SimpleGrpcNoTLSNoCompressionTest.java | 15 ++++++ .../SimpleGrpcNoTLSWithCompressionTest.java | 16 ++++++ .../SimpleGrpcWithTLSNoCompressionTest.java | 16 ++++++ .../SimpleGrpcWithTLSWithCompressionTest.java | 19 +++++++ ...ithTLSWithTrustAllWithCompressionTest.java | 32 ++++++++++++ .../SimpleHttpNoTLSNoCompressionTest.java | 16 ++++++ .../SimpleHttpNoTLSWithCompressionTest.java | 19 +++++++ .../SimpleHttpWithTLSNoCompressionTest.java | 19 +++++++ .../SimpleHttpWithTLSWithCompressionTest.java | 20 ++++++++ ...thTLSWithCompressionUsingRegistryTest.java | 21 ++++++++ ...ithTLSWithTrustAllWithCompressionTest.java | 33 +++++++++++++ 24 files changed, 368 insertions(+), 52 deletions(-) rename extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/{LateBoundBatchSpanProcessor.java => LateBoundSpanProcessor.java} (84%) delete mode 100644 extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundBatchSpanProcessor.java create mode 100644 extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundSpanProcessor.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/SimpleProfile.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSNoCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSWithCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSNoCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithTrustAllWithCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSNoCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSWithCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSNoCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionUsingRegistryTest.java create mode 100644 integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithTrustAllWithCompressionTest.java diff --git a/docs/src/main/asciidoc/_includes/opentelemetry-config.adoc b/docs/src/main/asciidoc/_includes/opentelemetry-config.adoc index cf4dcfff15f79..8eb3b1ba481e2 100644 --- a/docs/src/main/asciidoc/_includes/opentelemetry-config.adoc +++ b/docs/src/main/asciidoc/_includes/opentelemetry-config.adoc @@ -34,3 +34,11 @@ quarkus.otel.exporter.otlp.logs.endpoint=http://logs-uri:4317 // <3> <1> The endpoint for the traces exporter. <2> The endpoint for the metrics exporter. <3> The endpoint for the logs exporter. + +If you need that your spans and logs to be exported directly as they finish +(e.g. in a serverless environment / application), you can set this property to `true`. +This replaces the default batching of data. +[source,properties] +---- +quarkus.otel.simple=true +---- diff --git a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/OpenTelemetryProcessor.java b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/OpenTelemetryProcessor.java index 5d34b1c7c4e69..4b1846f90a857 100644 --- a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/OpenTelemetryProcessor.java +++ b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/OpenTelemetryProcessor.java @@ -96,6 +96,7 @@ AdditionalBeanBuildItem ensureProducerIsRetained() { return AdditionalBeanBuildItem.builder() .setUnremovable() .addBeanClasses( + AutoConfiguredOpenTelemetrySdkBuilderCustomizer.SimpleLogRecordProcessorCustomizer.class, AutoConfiguredOpenTelemetrySdkBuilderCustomizer.TracingResourceCustomizer.class, AutoConfiguredOpenTelemetrySdkBuilderCustomizer.SamplerCustomizer.class, AutoConfiguredOpenTelemetrySdkBuilderCustomizer.TracerProviderCustomizer.class, diff --git a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpExporterProcessor.java b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpExporterProcessor.java index e33d6271665b4..6fc49278641f0 100644 --- a/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpExporterProcessor.java +++ b/extensions/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpExporterProcessor.java @@ -28,7 +28,7 @@ import io.quarkus.opentelemetry.runtime.config.runtime.exporter.OtlpExporterConfigBuilder; import io.quarkus.opentelemetry.runtime.config.runtime.exporter.OtlpExporterRuntimeConfig; import io.quarkus.opentelemetry.runtime.exporter.otlp.OTelExporterRecorder; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundBatchSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundSpanProcessor; import io.quarkus.tls.TlsConfigurationRegistry; import io.quarkus.tls.TlsRegistryBuildItem; import io.quarkus.vertx.core.deployment.CoreVertxBuildItem; @@ -84,7 +84,8 @@ void config(BuildProducer runTimeConfigBuilderPro @BuildStep(onlyIf = OtlpExporterProcessor.OtlpTracingExporterEnabled.class) @Record(ExecutionTime.RUNTIME_INIT) @Consume(TlsRegistryBuildItem.class) - void createBatchSpanProcessor(OTelExporterRecorder recorder, + void createSpanProcessor(OTelExporterRecorder recorder, + OTelBuildConfig oTelBuildConfig, OTelRuntimeConfig otelRuntimeConfig, OtlpExporterRuntimeConfig exporterRuntimeConfig, CoreVertxBuildItem vertxBuildItem, @@ -95,7 +96,7 @@ void createBatchSpanProcessor(OTelExporterRecorder recorder, return; } syntheticBeanBuildItemBuildProducer.produce(SyntheticBeanBuildItem - .configure(LateBoundBatchSpanProcessor.class) + .configure(LateBoundSpanProcessor.class) .types(SpanProcessor.class) .setRuntimeInit() .scope(Singleton.class) @@ -103,8 +104,8 @@ void createBatchSpanProcessor(OTelExporterRecorder recorder, .addInjectionPoint(ParameterizedType.create(DotName.createSimple(Instance.class), new Type[] { ClassType.create(DotName.createSimple(SpanExporter.class.getName())) }, null)) .addInjectionPoint(ClassType.create(DotName.createSimple(TlsConfigurationRegistry.class))) - .createWith(recorder.batchSpanProcessorForOtlp(otelRuntimeConfig, exporterRuntimeConfig, - vertxBuildItem.getVertx())) + .createWith(recorder.spanProcessorForOtlp(oTelBuildConfig, otelRuntimeConfig, + exporterRuntimeConfig, vertxBuildItem.getVertx())) .done()); } diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDisabledSdkTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDisabledSdkTest.java index a547f90bef18f..5c7faccb33257 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDisabledSdkTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDisabledSdkTest.java @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig; import io.quarkus.opentelemetry.runtime.config.runtime.OTelRuntimeConfig; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundBatchSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundSpanProcessor; import io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.HttpInstrumenterVertxTracer; import io.quarkus.test.QuarkusUnitTest; import io.vertx.core.spi.observability.HttpRequest; @@ -26,7 +26,7 @@ public class OpenTelemetryDisabledSdkTest { .overrideConfigKey("quarkus.otel.sdk.disabled", "true"); @Inject - LateBoundBatchSpanProcessor batchSpanProcessor; + LateBoundSpanProcessor spanProcessor; @Inject OpenTelemetry openTelemetry; @@ -40,7 +40,7 @@ public class OpenTelemetryDisabledSdkTest { @Test void testNoTracer() { // The OTel API doesn't provide a clear way to check if a tracer is an effective NOOP tracer. - Assertions.assertTrue(batchSpanProcessor.isDelegateNull(), "BatchSpanProcessor delegate must not be set"); + Assertions.assertTrue(spanProcessor.isDelegateNull(), "SpanProcessor delegate must not be set"); } @Test diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpTraceExporterDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpTraceExporterDisabledTest.java index 7d9e074025c18..1a0372f194396 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpTraceExporterDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/exporter/otlp/OtlpTraceExporterDisabledTest.java @@ -11,7 +11,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.sdk.metrics.export.MetricExporter; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundBatchSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundSpanProcessor; import io.quarkus.test.QuarkusUnitTest; public class OtlpTraceExporterDisabledTest { @@ -25,7 +25,7 @@ public class OtlpTraceExporterDisabledTest { OpenTelemetry openTelemetry; @Inject - Instance lateBoundBatchSpanProcessorInstance; + Instance lateBoundSpanProcessorInstance; @Inject Instance metricExporters; @@ -33,7 +33,7 @@ public class OtlpTraceExporterDisabledTest { @Test void testOpenTelemetryButNoBatchSpanProcessor() { assertNotNull(openTelemetry); - assertFalse(lateBoundBatchSpanProcessorInstance.isResolvable()); + assertFalse(lateBoundSpanProcessorInstance.isResolvable()); assertFalse(metricExporters.isResolvable()); } } diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerConfigTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerConfigTest.java index 86218be707ce6..f9c9e4c174772 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerConfigTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerConfigTest.java @@ -3,6 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.lang.reflect.InvocationTargetException; +import java.util.Locale; import jakarta.inject.Inject; @@ -36,6 +37,7 @@ public class OpenTelemetrySamplerConfigTest { void test() throws NoSuchFieldException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Sampler sampler = TestUtil.getSampler(openTelemetry); - assertEquals(String.format("TraceIdRatioBased{%.6f}", 0.5d), sampler.getDescription()); + // Fix the locale to ROOT, so we don't get 0,500000 + assertEquals(String.format(Locale.ROOT, "TraceIdRatioBased{%.6f}", 0.5d), sampler.getDescription()); } } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/AutoConfiguredOpenTelemetrySdkBuilderCustomizer.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/AutoConfiguredOpenTelemetrySdkBuilderCustomizer.java index e601962c7b01c..eac3ccb8c1e89 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/AutoConfiguredOpenTelemetrySdkBuilderCustomizer.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/AutoConfiguredOpenTelemetrySdkBuilderCustomizer.java @@ -18,6 +18,10 @@ import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.common.Clock; +import io.opentelemetry.sdk.logs.LogRecordProcessor; +import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; +import io.opentelemetry.sdk.logs.export.LogRecordExporter; +import io.opentelemetry.sdk.logs.export.SimpleLogRecordProcessor; import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.IdGenerator; @@ -27,7 +31,7 @@ import io.quarkus.arc.All; import io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig; import io.quarkus.opentelemetry.runtime.config.runtime.OTelRuntimeConfig; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.RemoveableLateBoundBatchSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.RemoveableLateBoundSpanProcessor; import io.quarkus.opentelemetry.runtime.propagation.TextMapPropagatorCustomizer; import io.quarkus.opentelemetry.runtime.tracing.DelayedAttributes; import io.quarkus.opentelemetry.runtime.tracing.DropTargetsSampler; @@ -39,6 +43,47 @@ public interface AutoConfiguredOpenTelemetrySdkBuilderCustomizer { void customize(AutoConfiguredOpenTelemetrySdkBuilder builder); + @Singleton + final class SimpleLogRecordProcessorCustomizer implements AutoConfiguredOpenTelemetrySdkBuilderCustomizer { + private SimpleLogRecordProcessorBiFunction biFunction; + + public SimpleLogRecordProcessorCustomizer( + OTelBuildConfig oTelBuildConfig, + Instance ilre) { + if (oTelBuildConfig.simple() && ilre.isResolvable()) { + LogRecordProcessor lrp = SimpleLogRecordProcessor.create(ilre.get()); + this.biFunction = new SimpleLogRecordProcessorBiFunction(lrp); + } + } + + @Override + public void customize(AutoConfiguredOpenTelemetrySdkBuilder builder) { + if (biFunction != null) { + builder.addLogRecordProcessorCustomizer(biFunction); + } + } + } + + class SimpleLogRecordProcessorBiFunction + implements BiFunction { + + private final LogRecordProcessor logRecordProcessor; + + public SimpleLogRecordProcessorBiFunction(LogRecordProcessor logRecordProcessor) { + this.logRecordProcessor = logRecordProcessor; + } + + @Override + public LogRecordProcessor apply(LogRecordProcessor lrp, ConfigProperties cp) { + // only change batch lrp, leave others + if (lrp instanceof BatchLogRecordProcessor) { + return logRecordProcessor; + } else { + return lrp; + } + } + } + @Singleton final class TracingResourceCustomizer implements AutoConfiguredOpenTelemetrySdkBuilderCustomizer { @@ -174,7 +219,7 @@ public SdkTracerProviderBuilder apply(SdkTracerProviderBuilder tracerProviderBui spanProcessors.stream().filter(new Predicate() { @Override public boolean test(SpanProcessor sp) { - return !(sp instanceof RemoveableLateBoundBatchSpanProcessor); + return !(sp instanceof RemoveableLateBoundSpanProcessor); } }) .forEach(tracerProviderBuilder::addSpanProcessor); diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/build/OTelBuildConfig.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/build/OTelBuildConfig.java index c724ea9d640e7..bd47ccc601ec8 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/build/OTelBuildConfig.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/build/OTelBuildConfig.java @@ -37,6 +37,17 @@ public interface OTelBuildConfig { @WithDefault("true") boolean enabled(); + /** + * Should we use simple processor for spans and log records. + * This will disable batch processing and the exporter will send + * telemetry data right away. + * This is recommended for serverless applications. + *

+ * Defaults to false. + */ + @WithDefault("false") + boolean simple(); + /** * Trace exporter configurations. */ diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OTelExporterRecorder.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OTelExporterRecorder.java index 65f80415778bd..57cd1f9d2253e 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OTelExporterRecorder.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OTelExporterRecorder.java @@ -36,8 +36,12 @@ import io.opentelemetry.sdk.metrics.internal.aggregator.AggregationUtil; import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; import io.opentelemetry.sdk.trace.export.BatchSpanProcessorBuilder; +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessorBuilder; import io.opentelemetry.sdk.trace.export.SpanExporter; import io.quarkus.arc.SyntheticCreationalContext; +import io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig; +import io.quarkus.opentelemetry.runtime.config.runtime.BatchSpanProcessorConfig; import io.quarkus.opentelemetry.runtime.config.runtime.OTelRuntimeConfig; import io.quarkus.opentelemetry.runtime.config.runtime.exporter.*; import io.quarkus.opentelemetry.runtime.exporter.otlp.logs.NoopLogRecordExporter; @@ -48,8 +52,8 @@ import io.quarkus.opentelemetry.runtime.exporter.otlp.metrics.VertxHttpMetricsExporter; import io.quarkus.opentelemetry.runtime.exporter.otlp.sender.VertxGrpcSender; import io.quarkus.opentelemetry.runtime.exporter.otlp.sender.VertxHttpSender; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundBatchSpanProcessor; -import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.RemoveableLateBoundBatchSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.LateBoundSpanProcessor; +import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.RemoveableLateBoundSpanProcessor; import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.VertxGrpcSpanExporter; import io.quarkus.opentelemetry.runtime.exporter.otlp.tracing.VertxHttpSpanExporter; import io.quarkus.runtime.annotations.Recorder; @@ -68,23 +72,24 @@ public class OTelExporterRecorder { public static final String BASE2EXPONENTIAL_AGGREGATION_NAME = AggregationUtil .aggregationName(Aggregation.base2ExponentialBucketHistogram()); - public Function, LateBoundBatchSpanProcessor> batchSpanProcessorForOtlp( + public Function, LateBoundSpanProcessor> spanProcessorForOtlp( + OTelBuildConfig oTelBuildConfig, OTelRuntimeConfig otelRuntimeConfig, OtlpExporterRuntimeConfig exporterRuntimeConfig, Supplier vertx) { URI baseUri = getTracesUri(exporterRuntimeConfig); // do the creation and validation here in order to preserve backward compatibility return new Function<>() { @Override - public LateBoundBatchSpanProcessor apply( - SyntheticCreationalContext context) { + public LateBoundSpanProcessor apply( + SyntheticCreationalContext context) { if (otelRuntimeConfig.sdkDisabled() || baseUri == null) { - return RemoveableLateBoundBatchSpanProcessor.INSTANCE; + return RemoveableLateBoundSpanProcessor.INSTANCE; } // Only create the OtlpGrpcSpanExporter if an endpoint was set in runtime config and was properly validated at startup Instance spanExporters = context.getInjectedReference(new TypeLiteral<>() { }); if (!spanExporters.isUnsatisfied()) { - return RemoveableLateBoundBatchSpanProcessor.INSTANCE; + return RemoveableLateBoundSpanProcessor.INSTANCE; } try { @@ -93,15 +98,21 @@ public LateBoundBatchSpanProcessor apply( var spanExporter = createSpanExporter(exporterRuntimeConfig, vertx.get(), baseUri, tlsConfigurationRegistry); - BatchSpanProcessorBuilder processorBuilder = BatchSpanProcessor.builder(spanExporter); + if (oTelBuildConfig.simple()) { + SimpleSpanProcessorBuilder processorBuilder = SimpleSpanProcessor.builder(spanExporter); + return new LateBoundSpanProcessor(processorBuilder.build()); + } else { + BatchSpanProcessorBuilder processorBuilder = BatchSpanProcessor.builder(spanExporter); - processorBuilder.setScheduleDelay(otelRuntimeConfig.bsp().scheduleDelay()); - processorBuilder.setMaxQueueSize(otelRuntimeConfig.bsp().maxQueueSize()); - processorBuilder.setMaxExportBatchSize(otelRuntimeConfig.bsp().maxExportBatchSize()); - processorBuilder.setExporterTimeout(otelRuntimeConfig.bsp().exportTimeout()); - // processorBuilder.setMeterProvider() // TODO add meter provider to span processor. + BatchSpanProcessorConfig bspc = otelRuntimeConfig.bsp(); + processorBuilder.setScheduleDelay(bspc.scheduleDelay()); + processorBuilder.setMaxQueueSize(bspc.maxQueueSize()); + processorBuilder.setMaxExportBatchSize(bspc.maxExportBatchSize()); + processorBuilder.setExporterTimeout(bspc.exportTimeout()); + // processorBuilder.setMeterProvider() // TODO add meter provider to span processor. - return new LateBoundBatchSpanProcessor(processorBuilder.build()); + return new LateBoundSpanProcessor(processorBuilder.build()); + } } catch (IllegalArgumentException iae) { throw new IllegalStateException("Unable to install OTLP Exporter", iae); } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundBatchSpanProcessor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundSpanProcessor.java similarity index 84% rename from extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundBatchSpanProcessor.java rename to extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundSpanProcessor.java index 90318940e3497..94663996276c0 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundBatchSpanProcessor.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/LateBoundSpanProcessor.java @@ -7,20 +7,19 @@ import io.opentelemetry.sdk.trace.ReadWriteSpan; import io.opentelemetry.sdk.trace.ReadableSpan; import io.opentelemetry.sdk.trace.SpanProcessor; -import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; /** - * Class to facilitate a delay in when the worker thread inside {@link BatchSpanProcessor} + * Class to facilitate a delay in when the worker thread inside {@link SpanProcessor} * is started, enabling Quarkus to instantiate a {@link io.opentelemetry.api.trace.TracerProvider} - * during static initialization and set a {@link BatchSpanProcessor} delegate during runtime initialization. + * during static initialization and set a {@link SpanProcessor} delegate during runtime initialization. */ -public class LateBoundBatchSpanProcessor implements SpanProcessor { - private static final Logger log = Logger.getLogger(LateBoundBatchSpanProcessor.class); +public class LateBoundSpanProcessor implements SpanProcessor { + private static final Logger log = Logger.getLogger(LateBoundSpanProcessor.class); private boolean warningLogged = false; - private BatchSpanProcessor delegate; + private SpanProcessor delegate; - public LateBoundBatchSpanProcessor(BatchSpanProcessor delegate) { + public LateBoundSpanProcessor(SpanProcessor delegate) { this.delegate = delegate; } @@ -104,7 +103,7 @@ private void resetDelegate() { */ private void logDelegateNotFound() { if (!warningLogged) { - log.warn("No BatchSpanProcessor delegate specified, no action taken."); + log.warn("No SpanProcessor delegate specified, no action taken."); warningLogged = true; } } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundBatchSpanProcessor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundBatchSpanProcessor.java deleted file mode 100644 index d8654e5ff634e..0000000000000 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundBatchSpanProcessor.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.quarkus.opentelemetry.runtime.exporter.otlp.tracing; - -import io.quarkus.opentelemetry.runtime.AutoConfiguredOpenTelemetrySdkBuilderCustomizer.TracerProviderCustomizer; - -/** - * The only point in having this class is to allow {@link TracerProviderCustomizer} - * to easily ignore the configured {@link LateBoundBatchSpanProcessor}. - */ -public final class RemoveableLateBoundBatchSpanProcessor extends LateBoundBatchSpanProcessor { - - public static final RemoveableLateBoundBatchSpanProcessor INSTANCE = new RemoveableLateBoundBatchSpanProcessor(); - - private RemoveableLateBoundBatchSpanProcessor() { - super(null); - } -} diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundSpanProcessor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundSpanProcessor.java new file mode 100644 index 0000000000000..9d04b984d7d51 --- /dev/null +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/tracing/RemoveableLateBoundSpanProcessor.java @@ -0,0 +1,16 @@ +package io.quarkus.opentelemetry.runtime.exporter.otlp.tracing; + +import io.quarkus.opentelemetry.runtime.AutoConfiguredOpenTelemetrySdkBuilderCustomizer.TracerProviderCustomizer; + +/** + * The only point in having this class is to allow {@link TracerProviderCustomizer} + * to easily ignore the configured {@link LateBoundSpanProcessor}. + */ +public final class RemoveableLateBoundSpanProcessor extends LateBoundSpanProcessor { + + public static final RemoveableLateBoundSpanProcessor INSTANCE = new RemoveableLateBoundSpanProcessor(); + + private RemoveableLateBoundSpanProcessor() { + super(null); + } +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/SimpleProfile.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/SimpleProfile.java new file mode 100644 index 0000000000000..b0ea9d04a013e --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/SimpleProfile.java @@ -0,0 +1,12 @@ +package io.quarkus.it.opentelemetry.vertx.exporter; + +import java.util.Map; + +import io.quarkus.test.junit.QuarkusTestProfile; + +public final class SimpleProfile implements QuarkusTestProfile { + @Override + public Map getConfigOverrides() { + return Map.of("quarkus.otel.simple", "true"); + } +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSNoCompressionTest.java new file mode 100644 index 0000000000000..0c82fae42e1ef --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSNoCompressionTest.java @@ -0,0 +1,15 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.grpc; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleGrpcNoTLSNoCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSWithCompressionTest.java new file mode 100644 index 0000000000000..407fd02c01fa7 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcNoTLSWithCompressionTest.java @@ -0,0 +1,16 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.grpc; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableCompression", value = "true"), restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleGrpcNoTLSWithCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSNoCompressionTest.java new file mode 100644 index 0000000000000..8c003fdacf795 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSNoCompressionTest.java @@ -0,0 +1,16 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.grpc; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableTLS", value = "true"), restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleGrpcWithTLSNoCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithCompressionTest.java new file mode 100644 index 0000000000000..b764521146882 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithCompressionTest.java @@ -0,0 +1,19 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.grpc; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { + @ResourceArg(name = "enableTLS", value = "true"), + @ResourceArg(name = "enableCompression", value = "true") +}, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleGrpcWithTLSWithCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithTrustAllWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithTrustAllWithCompressionTest.java new file mode 100644 index 0000000000000..45ce4303120f3 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/SimpleGrpcWithTLSWithTrustAllWithCompressionTest.java @@ -0,0 +1,32 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.grpc; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.QuarkusTestProfile; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@TestProfile(SimpleGrpcWithTLSWithTrustAllWithCompressionTest.Profile.class) +public class SimpleGrpcWithTLSWithTrustAllWithCompressionTest extends AbstractExporterTest { + + public static class Profile implements QuarkusTestProfile { + @Override + public Map getConfigOverrides() { + return Map.of("quarkus.tls.trust-all", "true", "quarkus.otel.simple", "true"); + } + + @Override + public List testResources() { + return Collections.singletonList( + new TestResourceEntry( + OtelCollectorLifecycleManager.class, + Map.of("enableTLS", "true", "enableCompression", "true", "preventTrustCert", "true"))); + } + } + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSNoCompressionTest.java new file mode 100644 index 0000000000000..f623ed071d58b --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSNoCompressionTest.java @@ -0,0 +1,16 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "protocol", value = "http/protobuf"), restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleHttpNoTLSNoCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSWithCompressionTest.java new file mode 100644 index 0000000000000..8fbc960b5e9be --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpNoTLSWithCompressionTest.java @@ -0,0 +1,19 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { + @ResourceArg(name = "enableCompression", value = "true"), + @ResourceArg(name = "protocol", value = "http/protobuf") +}, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleHttpNoTLSWithCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSNoCompressionTest.java new file mode 100644 index 0000000000000..a5fb15970a28c --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSNoCompressionTest.java @@ -0,0 +1,19 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { + @ResourceArg(name = "enableTLS", value = "true"), + @ResourceArg(name = "protocol", value = "http/protobuf") +}, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleHttpWithTLSNoCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionTest.java new file mode 100644 index 0000000000000..77188c2cf61f5 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionTest.java @@ -0,0 +1,20 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { + @ResourceArg(name = "enableTLS", value = "true"), + @ResourceArg(name = "enableCompression", value = "true"), + @ResourceArg(name = "protocol", value = "http/protobuf") +}, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleHttpWithTLSWithCompressionTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionUsingRegistryTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionUsingRegistryTest.java new file mode 100644 index 0000000000000..31a896345339f --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithCompressionUsingRegistryTest.java @@ -0,0 +1,21 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.it.opentelemetry.vertx.exporter.SimpleProfile; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { + @ResourceArg(name = "enableTLS", value = "true"), + @ResourceArg(name = "enableCompression", value = "true"), + @ResourceArg(name = "protocol", value = "http/protobuf"), + @ResourceArg(name = "tlsRegistryName", value = "otel") +}, restrictToAnnotatedClass = true) +@TestProfile(SimpleProfile.class) +public class SimpleHttpWithTLSWithCompressionUsingRegistryTest extends AbstractExporterTest { + +} diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithTrustAllWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithTrustAllWithCompressionTest.java new file mode 100644 index 0000000000000..887ab7c133df4 --- /dev/null +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/SimpleHttpWithTLSWithTrustAllWithCompressionTest.java @@ -0,0 +1,33 @@ +package io.quarkus.it.opentelemetry.vertx.exporter.http; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; +import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.QuarkusTestProfile; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@TestProfile(SimpleHttpWithTLSWithTrustAllWithCompressionTest.Profile.class) +public class SimpleHttpWithTLSWithTrustAllWithCompressionTest extends AbstractExporterTest { + + public static class Profile implements QuarkusTestProfile { + @Override + public Map getConfigOverrides() { + return Map.of("quarkus.tls.trust-all", "true", "quarkus.otel.simple", "true"); + } + + @Override + public List testResources() { + return Collections.singletonList( + new TestResourceEntry( + OtelCollectorLifecycleManager.class, + Map.of("enableTLS", "true", "enableCompression", "true", "preventTrustCert", "true", "protocol", + "http/protobuf"))); + } + } + +}