Search in sources :

Example 1 with JaegerEnvTracerConfiguration

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);
}
Also used : StopContext(org.jboss.msc.service.StopContext) TracerConfiguration(org.wildfly.microprofile.opentracing.smallrye.TracerConfiguration) JaegerEnvTracerConfiguration(org.wildfly.extension.microprofile.opentracing.resolver.JaegerEnvTracerConfiguration) Service(org.jboss.msc.Service) JaegerEnvTracerConfiguration(org.wildfly.extension.microprofile.opentracing.resolver.JaegerEnvTracerConfiguration) StartContext(org.jboss.msc.service.StartContext) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) StartException(org.jboss.msc.service.StartException) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep)

Aggregations

AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)1 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)1 Service (org.jboss.msc.Service)1 StartContext (org.jboss.msc.service.StartContext)1 StartException (org.jboss.msc.service.StartException)1 StopContext (org.jboss.msc.service.StopContext)1 JaegerEnvTracerConfiguration (org.wildfly.extension.microprofile.opentracing.resolver.JaegerEnvTracerConfiguration)1 TracerConfiguration (org.wildfly.microprofile.opentracing.smallrye.TracerConfiguration)1