HttpSender

Reports spans to Zipkin, using its <a href="https://zipkin.io/zipkin-api/#/">POST</a> endpoint.

<h3>Usage</h3>

This type is designed for {@link AsyncReporter.Builder#builder(Sender) the async reporter}.

<p>Here's a simple configuration, configured for json:

<pre>{@code sender = OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans"); }</pre>

<p>Here's an example that adds <a href="https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/Authenticate.java">basic auth</a> (assuming you have an authenticating proxy):

<pre>{@code credential = Credentials.basic("me", "secure"); sender = OkHttpSender.newBuilder() .endpoint("https://authenticated-proxy/api/v2/spans") .clientBuilder().authenticator(new Authenticator() { @Override public Request authenticate(Route route, Response response) throws IOException { if (response.request().header("Authorization") != null) { return null; // Give up, we've already attempted to authenticate. } return response.request().newBuilder() .header("Authorization", credential) .build(); } }) .build(); }</pre>

<h3>Implementation Notes</h3>

<p>This sender is thread-safe.

Constructors

this
this()
Undocumented in source.
this
this(string endpoint)
Undocumented in source.

Members

Functions

endpoint
void endpoint(string value)
Undocumented in source. Be warned that the author may not have intended to support it.
sendSpans
void sendSpans(Span[] spans)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

client
HttpClient client;
Undocumented in source.

Meta