public class WingtipsToZipkinLifecycleListener
extends java.lang.Object
implements com.nike.wingtips.lifecyclelistener.SpanLifecycleListener
A SpanLifecycleListener that converts Wingtips Spans to Zipkin Spans and then sends them
to a Zipkin server in periodic batches, essentially making Wingtips compatible with Zipkin.
For a straightforward no-hassle integration simply use the basic constructor:
WingtipsToZipkinLifecycleListener(String, String, String). If you want more flexibility in order to adjust how
Wingtips spans are converted to Zipkin spans, or adjust how the Zipkin spans are batched up and sent to the Zipkin server, then you
can use the WingtipsToZipkinLifecycleListener(String, String, WingtipsToZipkinSpanConverter, ZipkinSpanSender)
constructor.
Note that it's easy to create an adapter that allows you to have a SpanCollector from the Zipkin Brave libraries function
as a ZipkinSpanSender. So if you're accustomed to using specific Zipkin SpanCollectors you can use them with
Wingtips unchanged.
| Modifier and Type | Field and Description |
|---|---|
protected long |
lastSpanHandlingErrorLogTimeEpochMillis |
protected java.lang.String |
localComponentNamespace |
protected static long |
MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS |
protected java.lang.String |
serviceName |
protected java.util.concurrent.atomic.AtomicLong |
spanHandlingErrorCounter |
protected zipkin.Endpoint |
zipkinEndpoint |
protected WingtipsToZipkinSpanConverter |
zipkinSpanConverter |
protected ZipkinSpanSender |
zipkinSpanSender |
| Constructor and Description |
|---|
WingtipsToZipkinLifecycleListener(java.lang.String serviceName,
java.lang.String localComponentNamespace,
java.lang.String postZipkinSpansBaseUrl)
Convenience constructor that uses
WingtipsToZipkinSpanConverterDefaultImpl and ZipkinSpanSenderDefaultHttpImpl as the
implementations for zipkinSpanConverter and zipkinSpanSender. |
WingtipsToZipkinLifecycleListener(java.lang.String serviceName,
java.lang.String localComponentNamespace,
WingtipsToZipkinSpanConverter zipkinSpanConverter,
ZipkinSpanSender zipkinSpanSender)
Kitchen-sink constructor that lets you set all the options.
|
| Modifier and Type | Method and Description |
|---|---|
void |
spanCompleted(com.nike.wingtips.Span span) |
void |
spanSampled(com.nike.wingtips.Span span) |
void |
spanStarted(com.nike.wingtips.Span span) |
protected final java.lang.String serviceName
protected final java.lang.String localComponentNamespace
protected final zipkin.Endpoint zipkinEndpoint
protected final WingtipsToZipkinSpanConverter zipkinSpanConverter
protected final ZipkinSpanSender zipkinSpanSender
protected final java.util.concurrent.atomic.AtomicLong spanHandlingErrorCounter
protected long lastSpanHandlingErrorLogTimeEpochMillis
protected static final long MIN_SPAN_HANDLING_ERROR_LOG_INTERVAL_MILLIS
public WingtipsToZipkinLifecycleListener(java.lang.String serviceName,
java.lang.String localComponentNamespace,
WingtipsToZipkinSpanConverter zipkinSpanConverter,
ZipkinSpanSender zipkinSpanSender)
serviceName - The name of this service. This is used to build the Zipkin Endpoint that will be used for client/server/local
Zipkin annotations when sending spans to Zipkin.localComponentNamespace - The Constants.LOCAL_COMPONENT namespace that should be used when creating certain Zipkin
annotations when the Wingtips span's Span.getSpanPurpose() is
Span.SpanPurpose.LOCAL_ONLY. See the Constants.LOCAL_COMPONENT
javadocs for more information on what this is and how it's used by the Zipkin server, so you know
what value you should send.zipkinSpanConverter - The WingtipsToZipkinSpanConverter that should be used to convert Wingtips spans to Zipkin spans.zipkinSpanSender - The ZipkinSpanSender for collecting and sending Zipkin spans to the Zipkin server.public WingtipsToZipkinLifecycleListener(java.lang.String serviceName,
java.lang.String localComponentNamespace,
java.lang.String postZipkinSpansBaseUrl)
WingtipsToZipkinSpanConverterDefaultImpl and ZipkinSpanSenderDefaultHttpImpl as the
implementations for zipkinSpanConverter and zipkinSpanSender.serviceName - The name of this service. This is used to build the Zipkin Endpoint that will be used for client/server/local
Zipkin annotations when sending spans to Zipkin.localComponentNamespace - The Constants.LOCAL_COMPONENT namespace that should be used when creating certain Zipkin
annotations when the Wingtips span's Span.getSpanPurpose() is
Span.SpanPurpose.LOCAL_ONLY. See the Constants.LOCAL_COMPONENT
javadocs for more information on what this is and how it's used by the Zipkin server, so you know
what value you should send.postZipkinSpansBaseUrl - The base URL of the Zipkin server. This should include the scheme, host, and port (if non-standard for the scheme).
e.g. http://localhost:9411, or https://zipkinserver.doesnotexist.com/public void spanStarted(com.nike.wingtips.Span span)
spanStarted in interface com.nike.wingtips.lifecyclelistener.SpanLifecycleListenerpublic void spanSampled(com.nike.wingtips.Span span)
spanSampled in interface com.nike.wingtips.lifecyclelistener.SpanLifecycleListenerpublic void spanCompleted(com.nike.wingtips.Span span)
spanCompleted in interface com.nike.wingtips.lifecyclelistener.SpanLifecycleListener