All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentracing.contrib.httpcomponents.SpanHttpAsync Maven / Gradle / Ivy

There is a newer version: 0.12.3
Show newest version
package io.opentracing.contrib.httpcomponents;

import com.github.threadcontext.Context;
import com.github.threadcontext.httpasyncclient.ContextAsyncClient;
import io.opentracing.util.GlobalTracer;
import io.opentracing.threadcontext.ContextSpan;
import java.util.Arrays;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;

public final class SpanHttpAsync {

    private SpanHttpAsync() {
    }

    public static CloseableHttpAsyncClient trace(CloseableHttpAsyncClient client) {
        final HttpTaggerFactory taggerFactory = CombinedHttpTagger.factory(Arrays.asList(
            StandardHttpTagger.FACTORY,
            ContentHttpTagger.FACTORY
        ));
        return new SpanHttpAsyncClient(new ContextAsyncClient(client, Context.DEFAULT), GlobalTracer.get(), ContextSpan.DEFAULT, taggerFactory);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy