Package zipkin2.proto3
Class Span
- java.lang.Object
- 
- com.squareup.wire.Message<Span,Span.Builder>
- 
- zipkin2.proto3.Span
 
 
- 
- All Implemented Interfaces:
- Serializable
 
 public final class Span extends com.squareup.wire.Message<Span,Span.Builder> A span is a single-host view of an operation. A trace is a series of spans (often RPC calls) which nest to form a latency tree. Spans are in the same trace when they share the same trace ID. The parent_id field establishes the position of one span in the tree. The root span is where parent_id is Absent and usually has the longest duration in the trace. However, nested asynchronous work can materialize as child spans whose duration exceed the root span. Spans usually represent remote activity such as RPC calls, or messaging producers and consumers. However, they can also represent in-process activity in any position of the trace. For example, a root span could represent a server receiving an initial client request. A root span could also represent a scheduled job that has no remote context. Encoding notes: Epoch timestamp are encoded fixed64 as varint would also be 8 bytes, and more expensive to encode and size. Duration is stored uint64, as often the numbers are quite small. Default values are ok, as only natural numbers are used. For example, zero is an invalid timestamp and an invalid duration, false values for debug or shared are ignorable, and zero-length strings also coerce to null. The next id is 14. Note fields up to 15 take 1 byte to encode. Take care when adding new fields https://developers.google.com/protocol-buffers/docs/proto3#assigning-tags- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSpan.Builderstatic classSpan.KindWhen present, kind clarifies timestamp, duration and remote_endpoint.
 - 
Field SummaryFields Modifier and Type Field Description static com.squareup.wire.ProtoAdapter<Span>ADAPTERList<Annotation>annotationsAssociates events that explain latency with the time they happened.BooleandebugTrue is a request to store this span even if it overrides sampling policy.static BooleanDEFAULT_DEBUGstatic LongDEFAULT_DURATIONstatic okio.ByteStringDEFAULT_IDstatic Span.KindDEFAULT_KINDstatic StringDEFAULT_NAMEstatic okio.ByteStringDEFAULT_PARENT_IDstatic BooleanDEFAULT_SHAREDstatic LongDEFAULT_TIMESTAMPstatic okio.ByteStringDEFAULT_TRACE_IDLongdurationDuration in microseconds of the critical path, if known.okio.ByteStringidUnique identifier for this operation within the trace.Span.KindkindWhen present, used to interpret remote_endpointEndpointlocal_endpointThe host that recorded this span, primarily for query by service name.StringnameThe logical operation this span represents in lowercase (e.g.okio.ByteStringparent_idThe parent span ID or absent if this the root span in a trace.Endpointremote_endpointWhen an RPC (or messaging) span, indicates the other side of the connection.BooleansharedTrue if we are contributing to a span started by another tracer (ex on a different host).Map<String,String>tagsTags give your span context for search, viewing and analysis.LongtimestampEpoch microseconds of the start of this span, possibly absent if incomplete.okio.ByteStringtrace_idRandomly generated, unique identifier for a trace, set on all spans within it.
 - 
Constructor SummaryConstructors Constructor Description Span(okio.ByteString trace_id, okio.ByteString parent_id, okio.ByteString id, Span.Kind kind, String name, Long timestamp, Long duration, Endpoint local_endpoint, Endpoint remote_endpoint, List<Annotation> annotations, Map<String,String> tags, Boolean debug, Boolean shared)Span(okio.ByteString trace_id, okio.ByteString parent_id, okio.ByteString id, Span.Kind kind, String name, Long timestamp, Long duration, Endpoint local_endpoint, Endpoint remote_endpoint, List<Annotation> annotations, Map<String,String> tags, Boolean debug, Boolean shared, okio.ByteString unknownFields)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)inthashCode()Span.BuildernewBuilder()StringtoString()
 
- 
- 
- 
Field Detail- 
ADAPTERpublic static final com.squareup.wire.ProtoAdapter<Span> ADAPTER 
 - 
DEFAULT_TRACE_IDpublic static final okio.ByteString DEFAULT_TRACE_ID 
 - 
DEFAULT_PARENT_IDpublic static final okio.ByteString DEFAULT_PARENT_ID 
 - 
DEFAULT_IDpublic static final okio.ByteString DEFAULT_ID 
 - 
DEFAULT_KINDpublic static final Span.Kind DEFAULT_KIND 
 - 
DEFAULT_NAMEpublic static final String DEFAULT_NAME - See Also:
- Constant Field Values
 
 - 
DEFAULT_TIMESTAMPpublic static final Long DEFAULT_TIMESTAMP 
 - 
DEFAULT_DURATIONpublic static final Long DEFAULT_DURATION 
 - 
DEFAULT_DEBUGpublic static final Boolean DEFAULT_DEBUG 
 - 
DEFAULT_SHAREDpublic static final Boolean DEFAULT_SHARED 
 - 
trace_idpublic final okio.ByteString trace_id Randomly generated, unique identifier for a trace, set on all spans within it. This field is required and encoded as 8 or 16 bytes, in big endian byte order.
 - 
parent_idpublic final okio.ByteString parent_id The parent span ID or absent if this the root span in a trace.
 - 
idpublic final okio.ByteString id Unique identifier for this operation within the trace. This field is required and encoded as 8 opaque bytes.
 - 
kindpublic final Span.Kind kind When present, used to interpret remote_endpoint
 - 
namepublic final String name The logical operation this span represents in lowercase (e.g. rpc method). Leave absent if unknown. As these are lookup labels, take care to ensure names are low cardinality. For example, do not embed variables into the name.
 - 
timestamppublic final Long timestamp Epoch microseconds of the start of this span, possibly absent if incomplete. For example, 1502787600000000 corresponds to 2017-08-15 09:00 UTC This value should be set directly by instrumentation, using the most precise value possible. For example, gettimeofday or multiplying epoch millis by 1000. There are three known edge-cases where this could be reported absent. - A span was allocated but never started (ex not yet received a timestamp) - The span's start event was lost - Data about a completed span (ex tags) were sent after the fact
 - 
durationpublic final Long duration Duration in microseconds of the critical path, if known. Durations of less than one are rounded up. Duration of children can be longer than their parents due to asynchronous operations. For example 150 milliseconds is 150000 microseconds.
 - 
local_endpointpublic final Endpoint local_endpoint The host that recorded this span, primarily for query by service name. Instrumentation should always record this. Usually, absent implies late data. The IP address corresponding to this is usually the site local or advertised service address. When present, the port indicates the listen port.
 - 
remote_endpointpublic final Endpoint remote_endpoint When an RPC (or messaging) span, indicates the other side of the connection. By recording the remote endpoint, your trace will contain network context even if the peer is not tracing. For example, you can record the IP from the "X-Forwarded-For" header or the service name and socket of a remote peer.
 - 
annotationspublic final List<Annotation> annotations Associates events that explain latency with the time they happened.
 - 
tagspublic final Map<String,String> tags Tags give your span context for search, viewing and analysis. For example, a key "your_app.version" would let you lookup traces by version. A tag "sql.query" isn't searchable, but it can help in debugging when viewing a trace.
 - 
debugpublic final Boolean debug True is a request to store this span even if it overrides sampling policy. This is true when the "X-B3-Flags" header has a value of 1.
 - 
sharedpublic final Boolean shared True if we are contributing to a span started by another tracer (ex on a different host).
 
- 
 - 
Constructor Detail- 
Spanpublic Span(okio.ByteString trace_id, okio.ByteString parent_id, okio.ByteString id, Span.Kind kind, String name, Long timestamp, Long duration, Endpoint local_endpoint, Endpoint remote_endpoint, List<Annotation> annotations, Map<String,String> tags, Boolean debug, Boolean shared)
 - 
Spanpublic Span(okio.ByteString trace_id, okio.ByteString parent_id, okio.ByteString id, Span.Kind kind, String name, Long timestamp, Long duration, Endpoint local_endpoint, Endpoint remote_endpoint, List<Annotation> annotations, Map<String,String> tags, Boolean debug, Boolean shared, okio.ByteString unknownFields)
 
- 
 - 
Method Detail- 
newBuilderpublic Span.Builder newBuilder() - Specified by:
- newBuilderin class- com.squareup.wire.Message<Span,Span.Builder>
 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- com.squareup.wire.Message<Span,Span.Builder>
 
 
- 
 
-