use of org.wildfly.microprofile.opentracing.smallrye.TracerConfiguration in project wildfly by wildfly.
the class JaegerTracerConfigurationAddHandler method performRuntime.
@Override
@SuppressWarnings("unchecked")
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
super.performRuntime(context, operation, model);
CapabilityServiceBuilder builder = context.getCapabilityServiceTarget().addCapability(TRACER_CAPABILITY);
String outboundSocketBindingName = TracerAttributes.SENDER_BINDING.resolveModelAttribute(context, model).asStringOrNull();
Supplier<OutboundSocketBinding> outboundSocketBindingSupplier;
if (outboundSocketBindingName != null) {
outboundSocketBindingSupplier = builder.requiresCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, OutboundSocketBinding.class, outboundSocketBindingName);
} else {
outboundSocketBindingSupplier = () -> null;
}
TracerConfiguration config = new JaegerTracerConfiguration(context, context.getCurrentAddressValue(), operation, outboundSocketBindingSupplier);
Consumer<TracerConfiguration> injector = builder.provides(TRACER_CAPABILITY);
builder.setInstance(new Service() {
@Override
public void start(StartContext context) {
injector.accept(config);
WildFlyTracerFactory.registerTracer(config.getName()).accept(config);
}
@Override
public void stop(StopContext context) {
WildFlyTracerFactory.registerTracer(config.getName()).accept(null);
}
});
builder.setInitialMode(ON_DEMAND).install();
}
use of org.wildfly.microprofile.opentracing.smallrye.TracerConfiguration 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