hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok2c <...@git.apache.org>
Subject [GitHub] httpclient pull request #74: WIP: OpenTracing integration
Date Fri, 12 May 2017 12:47:58 GMT
Github user ok2c commented on a diff in the pull request:

    --- Diff: httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/TracingAsyncExec.java
    @@ -0,0 +1,80 @@
    +package org.apache.hc.client5.http.impl.async;
    +import java.io.IOException;
    +import java.net.URISyntaxException;
    +import org.apache.hc.client5.http.async.AsyncExecCallback;
    +import org.apache.hc.client5.http.async.AsyncExecChain;
    +import org.apache.hc.client5.http.async.AsyncExecChain.Scope;
    +import org.apache.hc.client5.http.async.AsyncExecChainHandler;
    +import org.apache.hc.core5.http.EntityDetails;
    +import org.apache.hc.core5.http.HttpException;
    +import org.apache.hc.core5.http.HttpRequest;
    +import org.apache.hc.core5.http.HttpResponse;
    +import org.apache.hc.core5.http.nio.AsyncDataConsumer;
    +import org.apache.hc.core5.http.nio.AsyncEntityProducer;
    +import io.opentracing.Span;
    +import io.opentracing.Tracer;
    +import io.opentracing.Tracer.SpanBuilder;
    +import io.opentracing.contrib.spanmanager.DefaultSpanManager;
    +import io.opentracing.contrib.spanmanager.SpanManager.ManagedSpan;
    +import io.opentracing.tag.Tags;
    + * @author Pavol Loffay
    + */
    +public class TracingAsyncExec implements AsyncExecChainHandler {
    +  private Tracer tracer;
    +  public TracingAsyncExec(Tracer tracer) {
    +    this.tracer = tracer;
    +  }
    +  @Override
    +  public void execute(HttpRequest request, AsyncEntityProducer entityProducer, final
Scope scope,
    +      AsyncExecChain chain, final AsyncExecCallback asyncExecCallback) throws HttpException,
IOException {
    +    SpanBuilder spanBuilder = tracer.buildSpan(request.getMethod())
    +        .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
    +    ManagedSpan current = DefaultSpanManager.getInstance().current();
    --- End diff --
    No, it does not. It can also happen on a I/O dispatch thread. If you want pass bits of
contextual data to the request executors you should be using HttpContext associated with the
    PS: We are migrating from SVN to Git. I'll likely take a few more days before I can merge
your pull requests. Please bear with me. 

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message