io.opentracing.contrib.httpcomponents.SpanHttpAsync Maven / Gradle / Ivy
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