use of org.wildfly.extension.microprofile.opentracing.resolver.JaegerEnvTracerConfiguration in project wildfly by wildfly.
the class SubsystemAdd method performBoottime.
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
WildFlyTracerFactory.registerTracer(ENV_TRACER).accept(new JaegerEnvTracerConfiguration());
TracingExtensionLogger.ROOT_LOGGER.activatingSubsystem();
String defaultTracer = DEFAULT_TRACER.resolveModelAttribute(context, operation).asStringOrNull();
if (defaultTracer != null && !defaultTracer.isEmpty()) {
CapabilityServiceBuilder<?> builder = context.getCapabilityServiceTarget().addCapability(DEFAULT_TRACER_CAPABILITY);
final Supplier<TracerConfiguration> config = builder.requiresCapability(TRACER_CAPABILITY_NAME, TracerConfiguration.class, defaultTracer);
final Consumer<TracerConfiguration> injector = builder.provides(DEFAULT_TRACER_CAPABILITY);
builder.setInstance(new Service() {
@Override
public void start(StartContext context) throws StartException {
injector.accept(config.get());
WildFlyTracerFactory.registerDefaultTracer().accept(config.get());
}
@Override
public void stop(StopContext context) {
injector.accept(null);
WildFlyTracerFactory.registerDefaultTracer().accept(config.get());
}
}).setInitialMode(ServiceController.Mode.ACTIVE).install();
}
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_OPENTRACING, new TracingDependencyProcessor());
processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_MICROPROFILE_OPENTRACING, new TracingDeploymentProcessor());
}
}, OperationContext.Stage.RUNTIME);
}
Aggregations