From 5c7ae07febeb2e47fe8d4710fe8eea8af87fedf2 Mon Sep 17 00:00:00 2001 From: brunobat Date: Mon, 16 Sep 2024 12:48:42 +0100 Subject: [PATCH] Refactor exporters --- .../OpenTelemetryContinuousTestingTest.java | 4 +- .../OpenTelemetryDestroyerTest.java | 4 +- .../deployment/OpenTelemetryDevModeTest.java | 4 +- ...enTelemetryDevServicesDatasourcesTest.java | 4 +- .../deployment/OpenTelemetryMDCTest.java | 17 ++++--- .../deployment/OpenTelemetryResourceTest.java | 27 +++++----- .../OpenTelemetryServiceNameAppNameTest.java | 4 +- .../OpenTelemetryServiceNameBaseTest.java | 4 +- ...ryServiceNameCombinedResourceWinsTest.java | 4 +- ...tryServiceNameCombinedServiceWinsTest.java | 4 +- ...lemetryServiceNameNoResourceAttrsTest.java | 4 +- ...nTelemetryServiceNameResourceAttrTest.java | 4 +- .../common/exporter/InMemoryExporter.java | 49 +++++++++++++++++++ .../InMemoryLogRecordExporter.java | 2 +- .../InMemoryLogRecordExporterProvider.java | 3 +- .../InMemoryMetricExporter.java | 2 +- .../InMemoryMetricExporterProvider.java | 2 +- .../{ => exporter}/TestSpanExporter.java | 2 +- .../TestSpanExporterProvider.java | 2 +- .../GraphQLOpenTelemetryTest.java | 6 +-- .../GrpcOpenInstrumentationDisabledTest.java | 17 ++++--- .../GrpcOpenTelemetryTest.java | 18 +++---- .../RestClientOpenTelemetryTest.java | 18 ++++--- .../VertxClientOpenTelemetryTest.java | 18 ++++--- ...txEventBusInstrumentationDisabledTest.java | 6 +-- .../VertxHttpInstrumentationDisabledTest.java | 6 +-- .../VertxOpenTelemetryForwardedTest.java | 19 +++---- .../VertxOpenTelemetryTest.java | 6 +-- .../VertxOpenTelemetryXForwardedTest.java | 19 +++---- .../AddingSpanAttributesInterceptorTest.java | 4 +- .../interceptor/WithSpanInterceptorTest.java | 6 +-- .../deployment/logs/LoggingFrameworkTest.java | 4 +- .../deployment/logs/OtelLogsDisabledTest.java | 15 +++--- .../deployment/metrics/GaugeCdiTest.java | 13 ++--- .../deployment/metrics/MetricsTest.java | 9 ++-- ...emetryTextMapPropagatorCustomizerTest.java | 6 +-- .../traces/NonAppEndpointsDisabledTest.java | 4 +- ...nAppEndpointsDisabledWithRootPathTest.java | 4 +- ...dpointsEnabledLegacyConfigurationTest.java | 4 +- .../traces/NonAppEndpointsEnabledTest.java | 4 +- .../traces/NonAppEndpointsEqualRootPath.java | 4 +- .../OpenTelemetryCustomSamplerBeanTest.java | 4 +- .../traces/OpenTelemetryHttpCDITest.java | 6 +-- .../OpenTelemetryReactiveRoutesTest.java | 7 ++- .../traces/OpenTelemetrySamplerBeanTest.java | 4 +- .../OpenTelemetrySamplerConfigTest.java | 4 +- .../OpenTelemetrySpanSecurityEventsTest.java | 4 +- ...pi.traces.ConfigurableSpanExporterProvider | 2 +- 48 files changed, 220 insertions(+), 167 deletions(-) create mode 100644 extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryExporter.java rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/InMemoryLogRecordExporter.java (97%) rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/InMemoryLogRecordExporterProvider.java (83%) rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/InMemoryMetricExporter.java (99%) rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/InMemoryMetricExporterProvider.java (90%) rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/TestSpanExporter.java (97%) rename extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/{ => exporter}/TestSpanExporterProvider.java (90%) diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryContinuousTestingTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryContinuousTestingTest.java index bc6bf553f91d2..cb5e8024bcb56 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryContinuousTestingTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryContinuousTestingTest.java @@ -7,9 +7,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.traces.TracerRouterUT; import io.quarkus.test.ContinuousTestingTestUtils; import io.quarkus.test.ContinuousTestingTestUtils.TestStatus; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDestroyerTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDestroyerTest.java index b8b72ee86db39..c4582b0a11590 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDestroyerTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDestroyerTest.java @@ -10,8 +10,8 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.opentelemetry.OpenTelemetryDestroyer; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevModeTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevModeTest.java index b32aab8c4acac..68cf17135bd1c 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevModeTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevModeTest.java @@ -7,9 +7,9 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.opentelemetry.deployment.common.HelloResource; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.ContinuousTestingTestUtils; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevServicesDatasourcesTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevServicesDatasourcesTest.java index 2eb1130ae02af..48b33e0d9ea27 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevServicesDatasourcesTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryDevServicesDatasourcesTest.java @@ -27,8 +27,8 @@ import io.agroal.api.AgroalDataSource; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryMDCTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryMDCTest.java index 572a020cb89b7..4f8ad16b6a67b 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryMDCTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryMDCTest.java @@ -2,7 +2,7 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -28,10 +28,10 @@ import io.opentelemetry.context.Scope; import io.opentelemetry.sdk.trace.data.SpanData; import io.quarkus.arc.Unremovable; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; @@ -39,15 +39,16 @@ public class OpenTelemetryMDCTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar + .addPackage(TestSpanExporter.class.getPackage()) .addClass(MdcEntry.class) .addClass(TestMdcCapturer.class) .addClass(TestResource.class) - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, - InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties"); @Inject diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryResourceTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryResourceTest.java index f1ee913e35cd6..e036c550672da 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryResourceTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryResourceTest.java @@ -1,7 +1,7 @@ package io.quarkus.opentelemetry.deployment; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -15,6 +15,7 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -22,10 +23,8 @@ import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.sdk.metrics.data.MetricData; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; import io.smallrye.config.SmallRyeConfig; @@ -34,8 +33,7 @@ public class OpenTelemetryResourceTest { @RegisterExtension static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( () -> ShrinkWrap.create(JavaArchive.class) - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, - InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(InMemoryExporter.class.getPackage()) .addAsResource("resource-config/application.properties", "application.properties") .addAsResource( "META-INF/services-config/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider", @@ -46,9 +44,12 @@ public class OpenTelemetryResourceTest { @Inject SmallRyeConfig config; @Inject - TestSpanExporter spanExporter; - @Inject - InMemoryMetricExporter metricExporter; + InMemoryExporter exporter; + + @BeforeEach + void setup() { + exporter.reset(); + } @Test void resource() { @@ -57,7 +58,7 @@ void resource() { .statusCode(200) .body(is("hello")); - List spans = spanExporter.getFinishedSpanItems(1); + List spans = exporter.getSpanExporter().getFinishedSpanItems(1); final SpanData server = getSpanByKindAndParentId(spans, SERVER, "0000000000000000"); assertEquals("GET /hello", server.getName()); @@ -66,8 +67,8 @@ void resource() { server.getResource().getAttribute(AttributeKey.stringKey("service.instance.id"))); assertNotNull(server.getResource().getAttribute(AttributeKey.stringKey("host.name"))); - metricExporter.assertCountAtLeast(1); - List finishedMetricItems = metricExporter.getFinishedMetricItems(); + exporter.getMetricExporter().assertCountAtLeast(1); + List finishedMetricItems = exporter.getMetricExporter().getFinishedMetricItems(); } @Path("/hello") diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameAppNameTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameAppNameTest.java index e6c3d688f0ba1..b1d6c1eba8ccc 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameAppNameTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameAppNameTest.java @@ -5,8 +5,8 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetryServiceNameAppNameTest extends OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameBaseTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameBaseTest.java index 1b9f3f3d6cee4..02367d49584d2 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameBaseTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameBaseTest.java @@ -1,7 +1,7 @@ package io.quarkus.opentelemetry.deployment; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -15,7 +15,7 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; import io.restassured.RestAssured; public abstract class OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedResourceWinsTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedResourceWinsTest.java index cb40e024aeab7..2660e6e8e630d 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedResourceWinsTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedResourceWinsTest.java @@ -4,8 +4,8 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetryServiceNameCombinedResourceWinsTest extends OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedServiceWinsTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedServiceWinsTest.java index 39a3ad1aae3ba..8671ff4a74caf 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedServiceWinsTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedServiceWinsTest.java @@ -4,8 +4,8 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetryServiceNameCombinedServiceWinsTest extends OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameNoResourceAttrsTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameNoResourceAttrsTest.java index c693d9961fe86..72cc466ccaae5 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameNoResourceAttrsTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameNoResourceAttrsTest.java @@ -4,8 +4,8 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetryServiceNameNoResourceAttrsTest extends OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameResourceAttrTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameResourceAttrTest.java index c980f13dc641b..361922d365fee 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameResourceAttrTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameResourceAttrTest.java @@ -4,8 +4,8 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetryServiceNameResourceAttrTest extends OpenTelemetryServiceNameBaseTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryExporter.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryExporter.java new file mode 100644 index 0000000000000..8ca0fcd8a3be7 --- /dev/null +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryExporter.java @@ -0,0 +1,49 @@ +package io.quarkus.opentelemetry.deployment.common.exporter; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Any; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +import io.quarkus.arc.Unremovable; + +@Unremovable +@ApplicationScoped +public class InMemoryExporter { + + @Inject + @Any + Instance testSpanExporter; + + @Inject + @Any + Instance inMemoryMetricExporter; + + @Inject + @Any + Instance inMemoryLogRecordExporter; + + public void reset() { + if (testSpanExporter.isResolvable()) { + testSpanExporter.get().reset(); + } + if (inMemoryMetricExporter.isResolvable()) { + inMemoryMetricExporter.get().reset(); + } + if (inMemoryLogRecordExporter.isResolvable()) { + inMemoryLogRecordExporter.get().reset(); + } + } + + public TestSpanExporter getSpanExporter() { + return testSpanExporter.get(); + } + + public InMemoryMetricExporter getMetricExporter() { + return inMemoryMetricExporter.get(); + } + + public InMemoryLogRecordExporter getLogRecordExporter() { + return inMemoryLogRecordExporter.get(); + } +} diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporter.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporter.java similarity index 97% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporter.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporter.java index e07f6cfd506cc..c5ba99a9fc780 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporter.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporter.java @@ -1,4 +1,4 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporterProvider.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporterProvider.java similarity index 83% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporterProvider.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporterProvider.java index 9895a32ea9465..f3ecf012878ea 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryLogRecordExporterProvider.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryLogRecordExporterProvider.java @@ -1,11 +1,10 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import jakarta.enterprise.inject.spi.CDI; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider; import io.opentelemetry.sdk.logs.export.LogRecordExporter; -import io.opentelemetry.sdk.testing.exporter.InMemoryLogRecordExporter; public class InMemoryLogRecordExporterProvider implements ConfigurableLogRecordExporterProvider { @Override diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporter.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java similarity index 99% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporter.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java index 8036cd087add8..64774ae5097b9 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporter.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporter.java @@ -1,4 +1,4 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.stream.Collectors.joining; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporterProvider.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporterProvider.java similarity index 90% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporterProvider.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporterProvider.java index 6927ccb5ef4ae..0eaba72cdd6da 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/InMemoryMetricExporterProvider.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/InMemoryMetricExporterProvider.java @@ -1,4 +1,4 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import jakarta.enterprise.inject.spi.CDI; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporter.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporter.java similarity index 97% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporter.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporter.java index 533e3ca62cd5b..573816c3ed9d0 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporter.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporter.java @@ -1,4 +1,4 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.stream.Collectors.toList; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporterProvider.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporterProvider.java similarity index 90% rename from extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporterProvider.java rename to extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporterProvider.java index be3be5ecbb0c2..945149e9dc132 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/TestSpanExporterProvider.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/common/exporter/TestSpanExporterProvider.java @@ -1,4 +1,4 @@ -package io.quarkus.opentelemetry.deployment.common; +package io.quarkus.opentelemetry.deployment.common.exporter; import jakarta.enterprise.inject.spi.CDI; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java index 208fa62f82952..5cfbe711d5324 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java @@ -5,7 +5,7 @@ import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; import static io.opentelemetry.semconv.HttpAttributes.HTTP_ROUTE; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -47,8 +47,8 @@ import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenInstrumentationDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenInstrumentationDisabledTest.java index 6b1a4af1b4c82..2ce9752b2e1f0 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenInstrumentationDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenInstrumentationDisabledTest.java @@ -2,7 +2,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.api.trace.SpanKind.INTERNAL; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.Duration; @@ -30,10 +30,10 @@ import io.quarkus.opentelemetry.deployment.HelloRequest; import io.quarkus.opentelemetry.deployment.HelloRequestOrBuilder; import io.quarkus.opentelemetry.deployment.MutinyGreeterGrpc; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.smallrye.mutiny.Uni; @@ -42,8 +42,7 @@ public class GrpcOpenInstrumentationDisabledTest { @RegisterExtension static final QuarkusUnitTest TEST = new QuarkusUnitTest() .withApplicationRoot(root -> root - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) .addClasses(HelloService.class) .addClasses(GreeterGrpc.class, MutinyGreeterGrpc.class, Greeter.class, GreeterBean.class, GreeterClient.class, @@ -52,7 +51,9 @@ public class GrpcOpenInstrumentationDisabledTest { .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties") .overrideConfigKey("quarkus.grpc.clients.hello.host", "localhost") .overrideConfigKey("quarkus.grpc.clients.hello.port", "9001") diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java index 89371d8692ff4..ae4fa1eafb10f 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GrpcOpenTelemetryTest.java @@ -10,7 +10,7 @@ import static io.opentelemetry.semconv.SemanticAttributes.RPC_SYSTEM; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static io.quarkus.opentelemetry.runtime.config.build.OTelBuildConfig.INSTRUMENTATION_NAME; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -58,11 +58,10 @@ import io.quarkus.opentelemetry.deployment.StreamingClient; import io.quarkus.opentelemetry.deployment.StreamingGrpc; import io.quarkus.opentelemetry.deployment.StreamingProto; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.smallrye.common.annotation.Blocking; import io.smallrye.mutiny.Multi; @@ -71,8 +70,7 @@ public class GrpcOpenTelemetryTest { @RegisterExtension static final QuarkusUnitTest TEST = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, SemconvResolver.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) .addClasses(HelloService.class) .addClasses(GreeterGrpc.class, MutinyGreeterGrpc.class, Greeter.class, GreeterBean.class, GreeterClient.class, @@ -85,7 +83,9 @@ public class GrpcOpenTelemetryTest { .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties") .overrideConfigKey("quarkus.grpc.clients.greeter.host", "localhost") .overrideConfigKey("quarkus.grpc.clients.greeter.port", "9001") diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/RestClientOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/RestClientOpenTelemetryTest.java index 2c42cb42e89d8..b64bb7b955b86 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/RestClientOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/RestClientOpenTelemetryTest.java @@ -10,7 +10,7 @@ import static io.opentelemetry.semconv.UrlAttributes.URL_FULL; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertTarget; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -36,23 +36,25 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.quarkus.test.common.http.TestHTTPResource; public class RestClientOpenTelemetryTest { @RegisterExtension static final QuarkusUnitTest TEST = new QuarkusUnitTest().withApplicationRoot((jar) -> jar - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, SemconvResolver.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) + .addClasses(SemconvResolver.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties") .overrideConfigKey("quarkus.rest-client.client.url", "${test.url}"); diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxClientOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxClientOpenTelemetryTest.java index 6e2b092a30fac..dba76e4c4a489 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxClientOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxClientOpenTelemetryTest.java @@ -10,7 +10,7 @@ import static io.opentelemetry.semconv.UrlAttributes.URL_FULL; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertTarget; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static java.util.stream.Collectors.toSet; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -29,11 +29,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.runtime.StartupEvent; import io.quarkus.test.QuarkusUnitTest; import io.quarkus.test.common.http.TestHTTPResource; @@ -49,12 +49,14 @@ public class VertxClientOpenTelemetryTest { @RegisterExtension static final QuarkusUnitTest TEST = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, SemconvResolver.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) + .addClasses(SemconvResolver.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties"); @Inject diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxEventBusInstrumentationDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxEventBusInstrumentationDisabledTest.java index 8956b57879970..39a8e8e9b186c 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxEventBusInstrumentationDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxEventBusInstrumentationDisabledTest.java @@ -2,7 +2,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.api.trace.SpanKind.INTERNAL; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -20,9 +20,9 @@ import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.quarkus.vertx.ConsumeEvent; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxHttpInstrumentationDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxHttpInstrumentationDisabledTest.java index eb8cc3eb05375..2702bbb01c559 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxHttpInstrumentationDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxHttpInstrumentationDisabledTest.java @@ -2,7 +2,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.api.trace.SpanKind.INTERNAL; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -20,9 +20,9 @@ import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; import io.vertx.core.eventbus.EventBus; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryForwardedTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryForwardedTest.java index b9f70c472a4a3..543180671045b 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryForwardedTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryForwardedTest.java @@ -3,7 +3,7 @@ import static io.opentelemetry.api.trace.SpanKind.SERVER; import static io.opentelemetry.semconv.ClientAttributes.CLIENT_ADDRESS; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import java.util.List; @@ -15,12 +15,12 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; @@ -28,13 +28,14 @@ public class VertxOpenTelemetryForwardedTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar - .addClass(TracerRouter.class) - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, SemconvResolver.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) + .addClasses(TracerRouter.class, SemconvResolver.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties"); @Inject diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryTest.java index 0468b7b7561df..2f24182ed118f 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryTest.java @@ -13,7 +13,7 @@ import static io.opentelemetry.semconv.UserAgentAttributes.USER_AGENT_ORIGINAL; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertTarget; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static io.restassured.RestAssured.given; import static io.vertx.core.http.HttpMethod.GET; import static java.net.HttpURLConnection.HTTP_NOT_FOUND; @@ -45,10 +45,10 @@ import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.samplers.Sampler; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryXForwardedTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryXForwardedTest.java index cbcea7e09c1f7..b9db3084f10fd 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryXForwardedTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/VertxOpenTelemetryXForwardedTest.java @@ -3,7 +3,7 @@ import static io.opentelemetry.api.trace.SpanKind.SERVER; import static io.opentelemetry.semconv.ClientAttributes.CLIENT_ADDRESS; import static io.quarkus.opentelemetry.deployment.common.SemconvResolver.assertSemanticAttribute; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import java.util.List; @@ -15,12 +15,12 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; import io.quarkus.opentelemetry.deployment.common.SemconvResolver; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; @@ -28,13 +28,14 @@ public class VertxOpenTelemetryXForwardedTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar - .addClass(TracerRouter.class) - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class, SemconvResolver.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(TestSpanExporter.class.getPackage()) + .addClasses(TracerRouter.class, SemconvResolver.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), - "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider")) + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider") + .addAsResource(new StringAsset(InMemoryLogRecordExporterProvider.class.getCanonicalName()), + "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider")) .withConfigurationResource("application-default.properties"); @Inject diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/AddingSpanAttributesInterceptorTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/AddingSpanAttributesInterceptorTest.java index eec6fb9ebd107..9022f3bd1f0b9 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/AddingSpanAttributesInterceptorTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/AddingSpanAttributesInterceptorTest.java @@ -24,8 +24,8 @@ import io.opentelemetry.instrumentation.annotations.SpanAttribute; import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class AddingSpanAttributesInterceptorTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/WithSpanInterceptorTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/WithSpanInterceptorTest.java index a27ffefde3dc1..21d52be12c819 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/WithSpanInterceptorTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/interceptor/WithSpanInterceptorTest.java @@ -4,7 +4,7 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL; import static io.opentelemetry.api.trace.SpanKind.SERVER; import static io.opentelemetry.api.trace.StatusCode.ERROR; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static java.net.HttpURLConnection.HTTP_OK; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -34,8 +34,8 @@ import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.internal.data.ExceptionEventData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.runtime.StartupEvent; import io.quarkus.test.QuarkusUnitTest; import io.smallrye.config.SmallRyeConfig; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/LoggingFrameworkTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/LoggingFrameworkTest.java index 952d82bb35a5f..d1a2ad2bb8cfa 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/LoggingFrameworkTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/LoggingFrameworkTest.java @@ -17,8 +17,8 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.sdk.logs.data.LogRecordData; -import io.quarkus.opentelemetry.deployment.common.InMemoryLogRecordExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryLogRecordExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryLogRecordExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class LoggingFrameworkTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/OtelLogsDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/OtelLogsDisabledTest.java index 477d6818ca4f7..661793f1e470e 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/OtelLogsDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/logs/OtelLogsDisabledTest.java @@ -1,18 +1,18 @@ package io.quarkus.opentelemetry.deployment.logs; -import io.opentelemetry.sdk.logs.export.LogRecordExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryLogRecordExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryLogRecordExporterProvider; -import io.quarkus.test.QuarkusUnitTest; +import static org.assertj.core.api.Assertions.assertThat; + import jakarta.enterprise.inject.Instance; import jakarta.inject.Inject; + import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.sdk.logs.export.LogRecordExporter; +import io.quarkus.test.QuarkusUnitTest; public class OtelLogsDisabledTest { @RegisterExtension @@ -20,11 +20,10 @@ public class OtelLogsDisabledTest { .setArchiveProducer( () -> ShrinkWrap.create(JavaArchive.class) .add(new StringAsset( - "quarkus.otel.logs.enabled=false\n" + - "quarkus.otel.traces.enabled=false\n"), + "quarkus.otel.logs.enabled=false\n" + + "quarkus.otel.traces.enabled=false\n"), "application.properties")); - @Inject Instance logRecordExporter; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/GaugeCdiTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/GaugeCdiTest.java index ae133ff6a805d..410405ed89d86 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/GaugeCdiTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/GaugeCdiTest.java @@ -14,11 +14,10 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.Meter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class GaugeCdiTest { @@ -26,10 +25,8 @@ public class GaugeCdiTest { static final QuarkusUnitTest TEST = new QuarkusUnitTest() .setArchiveProducer( () -> ShrinkWrap.create(JavaArchive.class) - .addClass(TestUtil.class) - .addClass(MeterBean.class) - .addClasses(TestSpanExporter.class, TestSpanExporterProvider.class) - .addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class) + .addPackage(InMemoryMetricExporter.class.getPackage()) + .addClasses(TestUtil.class, MeterBean.class) .addAsResource(new StringAsset(TestSpanExporterProvider.class.getCanonicalName()), "META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider") .addAsResource(new StringAsset(InMemoryMetricExporterProvider.class.getCanonicalName()), diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/MetricsTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/MetricsTest.java index 9c6ed9e2191bc..be800fc789b23 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/MetricsTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/metrics/MetricsTest.java @@ -26,10 +26,10 @@ import io.opentelemetry.api.metrics.LongUpDownCounter; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.sdk.metrics.data.MetricData; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporter; -import io.quarkus.opentelemetry.deployment.common.InMemoryMetricExporterProvider; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.InMemoryMetricExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class MetricsTest { @@ -44,6 +44,7 @@ public class MetricsTest { .add(new StringAsset( "quarkus.otel.metrics.enabled=true\n" + "quarkus.otel.traces.exporter=none\n" + + "quarkus.otel.logs.exporter=none\n" + "quarkus.otel.metrics.exporter=in-memory\n" + "quarkus.otel.metric.export.interval=300ms\n"), "application.properties")); diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/propagation/OpenTelemetryTextMapPropagatorCustomizerTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/propagation/OpenTelemetryTextMapPropagatorCustomizerTest.java index abb2a1c762f9d..884e8b37ecb3d 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/propagation/OpenTelemetryTextMapPropagatorCustomizerTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/propagation/OpenTelemetryTextMapPropagatorCustomizerTest.java @@ -1,6 +1,6 @@ package io.quarkus.opentelemetry.deployment.propagation; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -26,8 +26,8 @@ import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.opentelemetry.runtime.propagation.TextMapPropagatorCustomizer; import io.quarkus.test.QuarkusUnitTest; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledTest.java index cd0a044062461..030774ab627a1 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledWithRootPathTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledWithRootPathTest.java index 48589c7abb23b..3fc10021927c1 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledWithRootPathTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsDisabledWithRootPathTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledLegacyConfigurationTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledLegacyConfigurationTest.java index 8d8b7fef27720..ddc869fc4552e 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledLegacyConfigurationTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledLegacyConfigurationTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledTest.java index 8e36d68c90cbb..88c0a742d0595 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEnabledTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEqualRootPath.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEqualRootPath.java index 0ce7116abdbee..2eb9744bf66c1 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEqualRootPath.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/NonAppEndpointsEqualRootPath.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryCustomSamplerBeanTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryCustomSamplerBeanTest.java index 9196e280c3dbc..debfbfb273ead 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryCustomSamplerBeanTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryCustomSamplerBeanTest.java @@ -23,10 +23,10 @@ import io.opentelemetry.sdk.trace.data.LinkData; import io.opentelemetry.sdk.trace.samplers.Sampler; import io.opentelemetry.sdk.trace.samplers.SamplingResult; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; import io.quarkus.opentelemetry.deployment.common.TracerRouter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java index f8bd9be6817e5..fc18cf713aadd 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryHttpCDITest.java @@ -2,8 +2,8 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; import static io.quarkus.opentelemetry.deployment.common.TestUtil.assertStringAttribute; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -25,9 +25,9 @@ import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.semconv.SemanticAttributes; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java index fd9b3088e43e7..7c38b4be2fb61 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetryReactiveRoutesTest.java @@ -1,8 +1,8 @@ package io.quarkus.opentelemetry.deployment.traces; import static io.opentelemetry.api.trace.SpanKind.SERVER; -import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId; import static io.quarkus.opentelemetry.deployment.common.TestUtil.assertStringAttribute; +import static io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter.getSpanByKindAndParentId; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -10,7 +10,6 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import jakarta.ws.rs.GET; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; @@ -20,9 +19,9 @@ import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.semconv.SemanticAttributes; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; import io.quarkus.vertx.web.Route; import io.restassured.RestAssured; diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerBeanTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerBeanTest.java index d155ed7d7fb21..a06325e671e40 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerBeanTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySamplerBeanTest.java @@ -15,9 +15,9 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.sdk.trace.samplers.Sampler; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetrySamplerBeanTest { 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 0ff64298d64b4..86218be707ce6 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 @@ -12,9 +12,9 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.sdk.trace.samplers.Sampler; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; import io.quarkus.opentelemetry.deployment.common.TestUtil; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.test.QuarkusUnitTest; public class OpenTelemetrySamplerConfigTest { diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySpanSecurityEventsTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySpanSecurityEventsTest.java index 41c2648e11c50..fa5ea90a7d1f6 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySpanSecurityEventsTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/traces/OpenTelemetrySpanSecurityEventsTest.java @@ -19,8 +19,8 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.opentelemetry.api.common.AttributeKey; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; -import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporter; +import io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider; import io.quarkus.opentelemetry.runtime.tracing.security.SecurityEventUtil; import io.quarkus.security.spi.runtime.AbstractSecurityEvent; import io.quarkus.security.spi.runtime.AuthenticationFailureEvent; diff --git a/extensions/opentelemetry/deployment/src/test/resources/META-INF/services-config/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider b/extensions/opentelemetry/deployment/src/test/resources/META-INF/services-config/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider index 22df19ff96e60..d3b519fdda27c 100644 --- a/extensions/opentelemetry/deployment/src/test/resources/META-INF/services-config/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider +++ b/extensions/opentelemetry/deployment/src/test/resources/META-INF/services-config/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider @@ -1 +1 @@ -io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider \ No newline at end of file +io.quarkus.opentelemetry.deployment.common.exporter.TestSpanExporterProvider \ No newline at end of file