Search in sources :

Example 6 with SpanTracingConfig

use of io.helidon.tracing.config.SpanTracingConfig in project helidon by oracle.

the class Response method createWriteSpan.

private Span createWriteSpan(GenericType<?> type) {
    Optional<SpanContext> parentSpan = spanContext();
    if (!parentSpan.isPresent()) {
        // from request
        return null;
    }
    SpanTracingConfig spanConfig = TracingConfigUtil.spanConfig(NettyWebServer.TRACING_COMPONENT, TRACING_CONTENT_WRITE);
    if (spanConfig.enabled()) {
        String spanName = spanConfig.newName().orElse(TRACING_CONTENT_WRITE);
        Tracer.SpanBuilder spanBuilder = WebTracingConfig.tracer(webServer()).buildSpan(spanName).asChildOf(parentSpan.get());
        if (type != null) {
            spanBuilder.withTag("response.type", type.getTypeName());
        }
        return spanBuilder.start();
    }
    return null;
}
Also used : SpanContext(io.opentracing.SpanContext) Tracer(io.opentracing.Tracer) SpanTracingConfig(io.helidon.tracing.config.SpanTracingConfig)

Aggregations

SpanTracingConfig (io.helidon.tracing.config.SpanTracingConfig)6 Tracer (io.opentracing.Tracer)5 Span (io.opentracing.Span)4 SpanContext (io.opentracing.SpanContext)4 GlobalTracer (io.opentracing.util.GlobalTracer)3 Context (io.helidon.common.context.Context)2 TracingConfigUtil (io.helidon.tracing.config.TracingConfigUtil)2 TracingContext (io.helidon.tracing.jersey.client.internal.TracingContext)2 Tags (io.opentracing.tag.Tags)2 Map (java.util.Map)2 Contexts (io.helidon.common.context.Contexts)1 Single (io.helidon.common.reactive.Single)1 HelidonServiceLoader (io.helidon.common.serviceloader.HelidonServiceLoader)1 Config (io.helidon.config.Config)1 DbClientServiceContext (io.helidon.dbclient.DbClientServiceContext)1 DbClientServiceBase (io.helidon.dbclient.common.DbClientServiceBase)1 TracerProvider (io.helidon.tracing.spi.TracerProvider)1 ServerRequest (io.helidon.webserver.ServerRequest)1 Scope (io.opentracing.Scope)1 Format (io.opentracing.propagation.Format)1