项目作者: opentracing-contrib

项目描述 :
OpenTracing Apache HttpClient instrumentation
高级语言: Java
项目地址: git://github.com/opentracing-contrib/java-apache-httpclient.git
创建时间: 2017-04-24T15:52:35Z
项目社区:https://github.com/opentracing-contrib/java-apache-httpclient

开源协议:Apache License 2.0

下载


Build Status Released Version

OpenTracing Apache HttpClient

Apache HttpClient instrumentation.

Configuration

  1. GlobalTracer.register(tracer);
  2. HttpClient httpClient = new TracingHttpClientBuilder()
  3. .build();
  4. //custom configuration
  5. HttpClient httpClient = new TracingHttpClientBuilder(
  6. redirectStrategy,
  7. redirectHandlingDisabled,
  8. GlobalTracer.get(),
  9. spanDecorators)
  10. .build();

Linking to parent span

If parent span context is not passed created client spans will be in a new trace.

SpanManager

  1. spanManager.activate(parentSpan); // called in the same thread as client.execute()
  2. client.execute(new HttpGet("url"));

Manually

  1. BasicHttpContext basicHttpContext = new BasicHttpContext();
  2. basicHttpContext.setAttribute(Constants.PARENT_CONTEXT, parentSpan.context());
  3. client.execute(new HttpGet("url"), basicHttpContext);

Development

  1. ./mvnw clean install

Release

Follow instructions in RELEASE