use of io.opentelemetry.api.OpenTelemetry in project wildfly by wildfly.
the class OpenTelemetrySubsystemDeploymentProcessor method setupOtelCdiBeans.
private void setupOtelCdiBeans(DeploymentPhaseContext deploymentPhaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = deploymentPhaseContext.getDeploymentUnit();
final ClassLoader initialCl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
final ModuleClassLoader moduleCL = deploymentUnit.getAttachment(Attachments.MODULE).getClassLoader();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(moduleCL);
String serviceName = holder.config.serviceName != null ? holder.config.serviceName : getServiceName(deploymentUnit);
final OpenTelemetry openTelemetry = OpenTelemetryCdiExtension.registerApplicationOpenTelemetryBean(moduleCL, holder.getOpenTelemetry());
OpenTelemetryCdiExtension.registerApplicationTracer(moduleCL, openTelemetry.getTracer(serviceName));
OTEL_LOGGER.registeringTracer(serviceName);
} catch (SecurityException | IllegalArgumentException ex) {
OTEL_LOGGER.errorResolvingTracer(ex);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(initialCl);
}
}
Aggregations