-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[issues-309] - Restore the UndeployDeployTest::testFaultToleranceMetr…
…icsAreTracedWithSameDeployments test, which verifies the MP Faut Tolerance + MP Telemetry integration
- Loading branch information
Showing
4 changed files
with
325 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
.../org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileTelemetryServerSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,174 @@ | ||
package org.jboss.eap.qe.microprofile.fault.tolerance.util; | ||
|
||
import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; | ||
import org.wildfly.extras.creaper.core.online.OnlineManagementClient; | ||
import org.wildfly.extras.creaper.core.online.operations.Address; | ||
import org.wildfly.extras.creaper.core.online.operations.Operations; | ||
import org.wildfly.extras.creaper.core.online.operations.admin.Administration; | ||
|
||
/** | ||
* Operations required to set up the server for MicroProfile Telemetry | ||
*/ | ||
public class MicroProfileTelemetryServerSetup { | ||
private static final Address OPENTELEMETRY_EXTENSION_ADDRESS = Address | ||
.extension("org.wildfly.extension.opentelemetry"); | ||
private static final Address OPENTELEMETRY_SUBSYSTEM_ADDRESS = Address | ||
.subsystem("opentelemetry"); | ||
|
||
private static final Address MICROPROFILE_TELEMETRY_EXTENSION_ADDRESS = Address | ||
.extension("org.wildfly.extension.microprofile.telemetry"); | ||
private static final Address MICROPROFILE_TELEMETRY_SUBSYSTEM_ADDRESS = Address | ||
.subsystem("microprofile-telemetry"); | ||
|
||
/** | ||
* Checks whether <b>"org.wildfly.extension.opentelemetry"</b> extension is present | ||
* | ||
* @return True if extension is already present,false otherwise | ||
* @throws Exception exception thrown by the internal operation executed by {@link Operations} API | ||
*/ | ||
public static Boolean openTelemetryExtensionExists(Operations operations) throws Exception { | ||
return operations.exists(OPENTELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
|
||
/** | ||
* Checks whether <b>"opentelemetry"</b> subsystem is present | ||
* | ||
* @return True if extension is already present,false otherwise | ||
* @throws Exception exception thrown by the internal operation executed by {@link Operations} API | ||
*/ | ||
public static Boolean openTelemetrySubsystemExists(Operations operations) throws Exception { | ||
return operations.exists(OPENTELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
|
||
/** | ||
* Checks whether <b>"org.wildfly.extension.microprofile.telemetry"</b> extension is present | ||
* | ||
* @return True if extension is already present,false otherwise | ||
* @throws Exception exception thrown by the internal operation executed by {@link Operations} API | ||
*/ | ||
public static Boolean microProfileTelemetryExtensionExists(Operations operations) throws Exception { | ||
return operations.exists(MICROPROFILE_TELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
|
||
/** | ||
* Checks whether <b>"microprofile-telemetry"</b> subsystem is present | ||
* | ||
* @return True if extension is already present,false otherwise | ||
* @throws Exception exception thrown by the internal operation executed by {@link Operations} API | ||
*/ | ||
public static Boolean microProfileTelemetrySubsystemExists(Operations operations) throws Exception { | ||
return operations.exists(MICROPROFILE_TELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
|
||
/** | ||
* Enable OpenTelemetry extension and subsystem. | ||
* | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void enableOpenTelemetry() throws Exception { | ||
try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { | ||
enableOpenTelemetry(client); | ||
} | ||
} | ||
|
||
/** | ||
* Enable OpenTelemetry extension and subsystem. | ||
* | ||
* @param client {@link OnlineManagementClient} instance used to execute the command | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void enableOpenTelemetry(OnlineManagementClient client) throws Exception { | ||
Operations operations = new Operations(client); | ||
if (!openTelemetryExtensionExists(operations)) { | ||
operations.add(OPENTELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
if (!openTelemetrySubsystemExists(operations)) { | ||
operations.add(OPENTELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
new Administration(client).reloadIfRequired(); | ||
} | ||
|
||
/** | ||
* Disable OpenTelemetry subsystem and extension | ||
* | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void disableOpenTelemetry() throws Exception { | ||
try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { | ||
disableOpenTelemetry(client); | ||
} | ||
} | ||
|
||
/** | ||
* Disable OpenTelemetry subsystem and extension | ||
* | ||
* @param client {@link OnlineManagementClient} instance used to execute the command | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void disableOpenTelemetry(OnlineManagementClient client) throws Exception { | ||
Operations operations = new Operations(client); | ||
if (openTelemetrySubsystemExists(operations)) { | ||
operations.remove(OPENTELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
if (openTelemetryExtensionExists(operations)) { | ||
operations.remove(OPENTELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
new Administration(client).reloadIfRequired(); | ||
} | ||
|
||
/** | ||
* Enable MicroProfile Telemetry extension and subsystem. | ||
* | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void enableMicroProfileTelemetry() throws Exception { | ||
try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { | ||
enableMicroProfileTelemetry(client); | ||
} | ||
} | ||
|
||
/** | ||
* Enable MicroProfile Telemetry extension and subsystem. | ||
* | ||
* @param client {@link OnlineManagementClient} instance used to execute the command | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void enableMicroProfileTelemetry(OnlineManagementClient client) throws Exception { | ||
Operations operations = new Operations(client); | ||
if (!openTelemetryExtensionExists(operations)) { | ||
operations.add(MICROPROFILE_TELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
if (!openTelemetrySubsystemExists(operations)) { | ||
operations.add(MICROPROFILE_TELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
new Administration(client).reloadIfRequired(); | ||
} | ||
|
||
/** | ||
* Disable MicroProfile Telemetry subsystem and extension | ||
* | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void disableMicroProfileTelemetry() throws Exception { | ||
try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { | ||
disableMicroProfileTelemetry(client); | ||
} | ||
} | ||
|
||
/** | ||
* Disable MicroProfile Telemetry subsystem and extension | ||
* | ||
* @param client {@link OnlineManagementClient} instance used to execute the command | ||
* @throws Exception exception thrown by the internal operation executed by {@link OnlineManagementClient} API | ||
*/ | ||
public static void disableMicroProfileTelemetry(OnlineManagementClient client) throws Exception { | ||
Operations operations = new Operations(client); | ||
if (microProfileTelemetrySubsystemExists(operations)) { | ||
operations.remove(MICROPROFILE_TELEMETRY_SUBSYSTEM_ADDRESS); | ||
} | ||
if (microProfileTelemetryExtensionExists(operations)) { | ||
operations.remove(MICROPROFILE_TELEMETRY_EXTENSION_ADDRESS); | ||
} | ||
new Administration(client).reloadIfRequired(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
microprofile-fault-tolerance/src/test/resources/otel-collector-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
extensions: | ||
health_check: | ||
pprof: | ||
endpoint: 0.0.0.0:1777 | ||
zpages: | ||
endpoint: 0.0.0.0:55679 | ||
|
||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4317 | ||
http: | ||
endpoint: 0.0.0.0:4318 | ||
|
||
processors: | ||
batch: | ||
|
||
exporters: | ||
logging: | ||
verbosity: detailed | ||
prometheus: | ||
endpoint: "0.0.0.0:49152" | ||
otlp: | ||
endpoint: 0.0.0.0:4217 | ||
tls: | ||
insecure: true | ||
|
||
service: | ||
# telemetry: | ||
# logs: | ||
# level: "debug" | ||
pipelines: | ||
metrics: | ||
receivers: [ otlp ] | ||
processors: [ batch ] | ||
exporters: [ prometheus, logging ] | ||
traces: | ||
receivers: [ otlp ] | ||
processors: [ ] | ||
exporters: [ otlp, logging ] | ||
|
||
extensions: [ health_check, pprof, zpages ] |