diff --git a/microprofile-fault-tolerance/pom.xml b/microprofile-fault-tolerance/pom.xml index 21877661..108d6950 100644 --- a/microprofile-fault-tolerance/pom.xml +++ b/microprofile-fault-tolerance/pom.xml @@ -146,6 +146,7 @@ cloud-server microprofile-fault-tolerance + micrometer diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/integration/metrics/MultipleMetricsExtensionTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/integration/metrics/MultipleMetricsExtensionTest.java index 86113d53..b7b6a45a 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/integration/metrics/MultipleMetricsExtensionTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/integration/metrics/MultipleMetricsExtensionTest.java @@ -108,7 +108,8 @@ public static Archive deploymentWithMPTelemetryEnabled() { */ @Deployment(name = FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER, managed = false) public static Archive deploymentWithMPTelemetryEnabledDisablingMicrometer() { - String mpConfig = "otel.metric.export.interval=100\notel.service.name=" + FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER + String mpConfig = "otel.metric.export.interval=100\notel.service.name=" + + FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER + "\notel.sdk.disabled=false\nTimeout/enabled=true\nsmallrye.faulttolerance.micrometer.disabled=true"; return ShrinkWrap.create(WebArchive.class, FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER + ".war") .addPackages(true, HelloService.class.getPackage()) @@ -124,7 +125,9 @@ public static Archive deploymentWithMPTelemetryEnabledDisablingMicrometer() { */ @Test @InSequence(0) - public void deployAll() { + public void deployAll() throws Exception { + MicroProfileTelemetryServerConfiguration.disableOpenTelemetry(); + MicrometerServerConfiguration.disableMicrometer(); deployer.deploy(FAULT_TOLERANCE_DEPLOYMENT); deployer.deploy(FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY); deployer.deploy(FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER); @@ -243,12 +246,14 @@ public void noMetricsAreCollectedWhenOnlyMPTelemetryIsAvailableButNotEnabled( @ArquillianResource @OperateOnDeployment(FAULT_TOLERANCE_DEPLOYMENT) URL deploymentUrl) throws Exception { // Remove the Micrometer extension... MicrometerServerConfiguration.disableMicrometer(); - // ... but make the MicroProfile Telemetry extension available - MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); + // ... start the OTel collector container... + OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); + otelCollector.start(); try { - // start the OTel collector container - OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); - otelCollector.start(); + // ... and make the MicroProfile Telemetry extension available + MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); + MicroProfileTelemetryServerConfiguration + .addOpenTelemetryCollectorConfiguration(otelCollector.getOtlpGrpcEndpoint()); try { // deploy an app that DOES NOT enable MP Telemetry deployer.deploy(FAULT_TOLERANCE_DEPLOYMENT); @@ -273,10 +278,10 @@ public void noMetricsAreCollectedWhenOnlyMPTelemetryIsAvailableButNotEnabled( deployer.undeploy(FAULT_TOLERANCE_DEPLOYMENT); } } finally { - otelCollector.stop(); + MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); } } finally { - MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); + otelCollector.stop(); } } @@ -294,12 +299,14 @@ public void metricsAreCollectedWhenOnlyMPTelemetryExtensionIsAvailableAndEnabled throws Exception { // Remove the Micrometer extension MicrometerServerConfiguration.disableMicrometer(); - // Make the MP Telemetry extension available - MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); + // start the OTel collector container + OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); + otelCollector.start(); try { - // start the OTel collector container - OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); - otelCollector.start(); + // Make the MP Telemetry extension available + MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); + MicroProfileTelemetryServerConfiguration + .addOpenTelemetryCollectorConfiguration(otelCollector.getOtlpGrpcEndpoint()); try { // deploy an app that enables MP Telemetry deployer.deploy(FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY); @@ -325,10 +332,10 @@ public void metricsAreCollectedWhenOnlyMPTelemetryExtensionIsAvailableAndEnabled deployer.undeploy(FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY); } } finally { - otelCollector.stop(); + MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); } } finally { - MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); + otelCollector.stop(); } } @@ -346,13 +353,15 @@ public void metricsAreCollectedWhenOnlyMPTelemetryExtensionIsAvailableAndEnabled public void metricsAreCollectedWhenBothExtensionsAreAvailableAndOnlyMPTelIsEnabled( @ArquillianResource @OperateOnDeployment(FAULT_TOLERANCE_DEPOYMENT_WITH_MP_TELEMETRY_DISABLING_MICROMETER) URL deploymentUrl) throws Exception { - // Make the MP Telemetry extension available - MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); + // start the OTel collector container + OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); + otelCollector.start(); try { - // start the OTel collector container - OpenTelemetryCollectorContainer otelCollector = OpenTelemetryCollectorContainer.getNewInstance(); - otelCollector.start(); + // Make the MP Telemetry extension available + MicroProfileTelemetryServerConfiguration.enableMicroProfileTelemetry(); try { + MicroProfileTelemetryServerConfiguration + .addOpenTelemetryCollectorConfiguration(otelCollector.getOtlpGrpcEndpoint()); // And be sure Micrometer is available too MicrometerServerConfiguration.enableMicrometer(otelCollector.getOtlpHttpEndpoint()); try { @@ -387,10 +396,10 @@ public void metricsAreCollectedWhenBothExtensionsAreAvailableAndOnlyMPTelIsEnabl MicrometerServerConfiguration.disableMicrometer(); } } finally { - otelCollector.stop(); + MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); } } finally { - MicroProfileTelemetryServerConfiguration.disableMicroProfileTelemetry(); + otelCollector.stop(); } } diff --git a/tooling-observability/src/main/java/org/jboss/eap/qe/observability/containers/OpenTelemetryCollectorContainer.java b/tooling-observability/src/main/java/org/jboss/eap/qe/observability/containers/OpenTelemetryCollectorContainer.java index fbc67d04..f961a1e5 100644 --- a/tooling-observability/src/main/java/org/jboss/eap/qe/observability/containers/OpenTelemetryCollectorContainer.java +++ b/tooling-observability/src/main/java/org/jboss/eap/qe/observability/containers/OpenTelemetryCollectorContainer.java @@ -124,7 +124,7 @@ public static synchronized OpenTelemetryCollectorContainer getInstance() { * Static method to get a unique instance of {@link OpenTelemetryCollectorContainer}. * * @param jaegerBackendContainer A {@link JaegerContainer} instance that will be used as the Jaeger backend, e.g.: - * for storing and retrieving traces. + * for storing and retrieving traces. * @return A unique instance of {@link OpenTelemetryCollectorContainer} */ public static synchronized OpenTelemetryCollectorContainer getInstance(JaegerContainer jaegerBackendContainer) { @@ -150,7 +150,7 @@ public static synchronized OpenTelemetryCollectorContainer getNewInstance() { * external code. * * @param jaegerBackendContainer A {@link JaegerContainer} instance that will be used as the Jaeger backend, e.g.: - * for storing and retrieving traces. + * for storing and retrieving traces. * @return An instance of {@link OpenTelemetryCollectorContainer} */ public static synchronized OpenTelemetryCollectorContainer getNewInstance(JaegerContainer jaegerBackendContainer) {