use of org.wildfly.extension.microprofile.opentracing.resolver.JaegerTracerConfiguration 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();
}
Aggregations