| Modifier and Type | Method | Description |
|---|---|---|
Tracing.Builder |
addFinishedSpanHandler(FinishedSpanHandler finishedSpanHandler) |
Similar to
spanReporter(Reporter) except it can read the trace context and create
more efficient or completely different data structures. |
Tracing |
build() |
|
Tracing.Builder |
clock(Clock clock) |
Assigns microsecond-resolution timestamp source for operations like
Span.start(). |
Tracing.Builder |
currentTraceContext(CurrentTraceContext currentTraceContext) |
Responsible for implementing
Tracer.startScopedSpan(String), Tracer.currentSpanCustomizer(), Tracer.currentSpan() and Tracer.withSpanInScope(Span). |
Tracing.Builder |
endpoint(zipkin2.Endpoint endpoint) |
Deprecated.
Use
localServiceName(String) localIp(String) and localPort(int). Will be removed in Brave v6. |
Tracing.Builder |
errorParser(ErrorParser errorParser) |
|
Tracing.Builder |
localIp(String localIp) |
The text representation of the primary IP address associated with this service.
|
Tracing.Builder |
localPort(int localPort) |
The primary listen port associated with this service.
|
Tracing.Builder |
localServiceName(String localServiceName) |
Lower-case label of the remote node in the service graph, such as "favstar".
|
Tracing.Builder |
propagationFactory(Propagation.Factory propagationFactory) |
Controls how trace contexts are injected or extracted from remote requests, such as from http
headers.
|
Tracing.Builder |
sampler(Sampler sampler) |
Sampler is responsible for deciding if a particular trace should be "sampled", i.e.
|
Tracing.Builder |
spanReporter(zipkin2.reporter.Reporter<zipkin2.Span> spanReporter) |
Controls how spans are reported.
|
Tracing.Builder |
supportsJoin(boolean supportsJoin) |
True means the tracing system supports sharing a span ID between a
Span.Kind.CLIENT
and Span.Kind.SERVER span. |
Tracing.Builder |
traceId128Bit(boolean traceId128Bit) |
When true, new root spans will have 128-bit trace IDs.
|
public Tracing.Builder localServiceName(String localServiceName)
This is a primary label for trace lookup and aggregation, so it should be intuitive and consistent. Many use a name from service discovery.
localIp(String)public Tracing.Builder localIp(String localIp)
localServiceName(String),
localPort(int)public Tracing.Builder localPort(int localPort)
localIp(String)@Deprecated public Tracing.Builder endpoint(zipkin2.Endpoint endpoint)
localServiceName(String) localIp(String) and localPort(int). Will be removed in Brave v6.Endpoint of the local service being traced.public Tracing.Builder spanReporter(zipkin2.reporter.Reporter<zipkin2.Span> spanReporter)
AsyncReporter
which batches spans before sending to Zipkin.
The AsyncReporter includes a Sender, which is a driver for transports like
http, kafka and scribe.
For example, here's how to batch send spans via http:
spanReporter = AsyncReporter.create(URLConnectionSender.create("http://localhost:9411/api/v2/spans"));
tracingBuilder.spanReporter(spanReporter);
See https://github.com/openzipkin/zipkin-reporter-java
public Tracing.Builder clock(Clock clock)
Span.start().
Defaults to JRE-specific platform time.
Note: timestamps are read once per trace, then ticks
thereafter. This ensures there's no clock skew problems inside a single trace.
See Tracing.clock(TraceContext)
public Tracing.Builder sampler(Sampler sampler)
for temporary overridespublic Tracing.Builder currentTraceContext(CurrentTraceContext currentTraceContext)
Tracer.startScopedSpan(String), Tracer.currentSpanCustomizer(), Tracer.currentSpan() and Tracer.withSpanInScope(Span).
By default a simple thread-local is used. Override to support other mechanisms or to synchronize with other mechanisms such as SLF4J's MDC.
public Tracing.Builder propagationFactory(Propagation.Factory propagationFactory)
B3Propagation.FACTORYpublic Tracing.Builder traceId128Bit(boolean traceId128Bit)
public Tracing.Builder supportsJoin(boolean supportsJoin)
Span.Kind.CLIENT
and Span.Kind.SERVER span. Defaults to true.
Set this to false when the tracing system requires the opposite. For example, if ultimately spans are sent to Amazon X-Ray or Google Stackdriver Trace, you should set this to false.
This is implicitly set to false when Propagation.Factory.supportsJoin() is false,
as in that case, sharing IDs isn't possible anyway.
Propagation.Factory.supportsJoin()public Tracing.Builder errorParser(ErrorParser errorParser)
public Tracing.Builder addFinishedSpanHandler(FinishedSpanHandler finishedSpanHandler)
spanReporter(Reporter) except it can read the trace context and create
more efficient or completely different data structures. Importantly, the input is mutable for
customization purposes.
These handlers execute before the span reporter, which
means any mutations occur prior to Zipkin.
This is named firehose as it can receive data even when spans are not sampled remotely.
For example, FinishedSpanHandler.alwaysSampleLocal() will generate data for all traced
requests while not affecting headers. This setting is often used for metrics aggregation.
Your handler can also be a custom span transport. When this is the case, set the span reporter to Reporter.NOOP to avoid redundant conversion
overhead.
public Tracing build()
Copyright © 2018 OpenZipkin. All rights reserved.