SpanCustomizer
public abstract class Span extends Object implements SpanCustomizer
Modifier and Type | Class | Description |
---|---|---|
static class |
Span.Kind |
Constructor | Description |
---|---|
Span() |
Modifier and Type | Method | Description |
---|---|---|
abstract void |
abandon() |
Throws away the current span without reporting it.
|
abstract Span |
annotate(long timestamp,
String value) |
Like
SpanCustomizer.annotate(String) , except with a given timestamp in microseconds. |
abstract Span |
annotate(String value) |
Associates an event that explains latency with the current system time.
|
abstract TraceContext |
context() |
|
abstract void |
finish() |
Reports the span complete, assigning the most precise duration possible.
|
abstract void |
finish(long timestamp) |
Like
finish() , except with a given timestamp in microseconds. |
abstract void |
flush() |
Reports the span, even if unfinished.
|
abstract boolean |
isNoop() |
When true, no recording is done and nothing is reported to zipkin.
|
abstract Span |
kind(Span.Kind kind) |
The kind of span is optional.
|
abstract Span |
name(String name) |
Sets the string name for the logical operation this span represents.
|
Span |
remoteEndpoint(zipkin.Endpoint endpoint) |
Deprecated.
use
remoteEndpoint(Endpoint) , possibly with Endpoint.toV2() |
abstract Span |
remoteEndpoint(zipkin2.Endpoint endpoint) |
For a client span, this would be the server's address.
|
abstract Span |
start() |
Starts the span with an implicit timestamp.
|
abstract Span |
start(long timestamp) |
Like
start() , except with a given timestamp in microseconds. |
abstract Span |
tag(String key,
String value) |
Tags give your span context for search, viewing and analysis.
|
public abstract boolean isNoop()
public abstract TraceContext context()
public abstract Span start()
Spans can be modified before calling start. For example, you can add tags to the span and set its name without lock contention.
public abstract Span start(long timestamp)
start()
, except with a given timestamp in microseconds.public abstract Span name(String name)
name
in interface SpanCustomizer
public abstract Span kind(Span.Kind kind)
Span.Kind.SERVER
, the span's start timestamp is implicitly annotated as "sr" and
that plus its duration as "ss".public abstract Span annotate(String value)
annotate
in interface SpanCustomizer
value
- A short tag indicating the event, like "finagle.retry"Constants
public abstract Span annotate(long timestamp, String value)
SpanCustomizer.annotate(String)
, except with a given timestamp in microseconds.annotate
in interface SpanCustomizer
public abstract Span tag(String key, String value)
TraceKeys.SQL_QUERY
isn't searchable, but it can help in debugging when viewing a trace.tag
in interface SpanCustomizer
key
- Name used to lookup spans, such as "your_app.version". See TraceKeys
for
standard ones.value
- String value, cannot be null
.@Deprecated public final Span remoteEndpoint(zipkin.Endpoint endpoint)
remoteEndpoint(Endpoint)
, possibly with Endpoint.toV2()
public abstract Span remoteEndpoint(zipkin2.Endpoint endpoint)
It is often expensive to derive a remote address: always check isNoop()
first!
public abstract void finish()
public abstract void abandon()
public abstract void finish(long timestamp)
finish()
, except with a given timestamp in microseconds.
Zipkin's span duration
is derived by subtracting the start
timestamp from this, and set when appropriate.
public abstract void flush()
This primarily supports two use cases: one-way spans and orphaned spans. For example, a one-way span can be modeled as a span where one tracer calls start and another calls finish. In order to report that span from its origin, flush must be called.
Another example is where a user didn't call finish within a deadline or before a shutdown occurs. By flushing, you can report what was in progress.
Copyright © 2018 OpenZipkin. All rights reserved.