Package zipkin2.reporter.okhttp3
Class OkHttpSender
- java.lang.Object
-
- zipkin2.reporter.Component
-
- zipkin2.reporter.Sender
-
- zipkin2.reporter.okhttp3.OkHttpSender
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BytesMessageSender
public final class OkHttpSender extends Sender
Reports spans to Zipkin, using its POST endpoint.Usage
This type is designed for
the async reporter.Here's a simple configuration, configured for json:
sender = OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans");Here's an example that adds basic auth (assuming you have an authenticating proxy):
{@code credential = Credentials.basic("me", "secure"); sender = OkHttpSender.newBuilder() .endpoint("https://authenticated-proxy/api/v2/spans") .clientBuilder().authenticator(new Authenticator() {
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOkHttpSender.Builder-
Nested classes/interfaces inherited from interface zipkin2.reporter.BytesMessageSender
BytesMessageSender.Base
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CheckResultcheck()Deprecated.voidclose()Waits up to a second for in-flight requests to finish before cancelling themstatic OkHttpSendercreate(String endpoint)Creates a sender that postsEncoding.JSONmessages.Encodingencoding()intmessageMaxBytes()intmessageSizeInBytes(int encodedSizeInBytes)intmessageSizeInBytes(List<byte[]> encodedSpans)static OkHttpSender.BuildernewBuilder()voidsend(List<byte[]> encodedSpans)Sends spans as a POST toOkHttpSender.Builder.endpoint(String).Call<Void>sendSpans(List<byte[]> encodedSpans)Deprecated.OkHttpSender.BuildertoBuilder()Creates a builder out of this object.StringtoString()
-
-
-
Method Detail
-
create
public static OkHttpSender create(String endpoint)
Creates a sender that postsEncoding.JSONmessages.
-
newBuilder
public static OkHttpSender.Builder newBuilder()
-
toBuilder
public OkHttpSender.Builder toBuilder()
Creates a builder out of this object. Note: if theOkHttpSender.Builder.clientBuilder()was customized, you'll need to re-apply those customizations.
-
messageSizeInBytes
public int messageSizeInBytes(List<byte[]> encodedSpans)
-
messageSizeInBytes
public int messageSizeInBytes(int encodedSizeInBytes)
- Specified by:
messageSizeInBytesin interfaceBytesMessageSender- Overrides:
messageSizeInBytesin classSender
-
encoding
public Encoding encoding()
-
messageMaxBytes
public int messageMaxBytes()
-
sendSpans
@Deprecated public Call<Void> sendSpans(List<byte[]> encodedSpans)
Deprecated.
-
send
public void send(List<byte[]> encodedSpans) throws IOException
Sends spans as a POST toOkHttpSender.Builder.endpoint(String).- Specified by:
sendin interfaceBytesMessageSender- Overrides:
sendin classSender- Throws:
IOException
-
check
@Deprecated public CheckResult check()
Deprecated.
-
close
public void close()
Waits up to a second for in-flight requests to finish before cancelling them
-
-