pub struct Span {Show 16 fields
pub trace_id: Vec<u8>,
pub span_id: Vec<u8>,
pub tracestate: Option<Tracestate>,
pub parent_span_id: Vec<u8>,
pub name: Option<TruncatableString>,
pub kind: i32,
pub start_time: Option<Timestamp>,
pub end_time: Option<Timestamp>,
pub attributes: Option<Attributes>,
pub stack_trace: Option<StackTrace>,
pub time_events: Option<TimeEvents>,
pub links: Option<Links>,
pub status: Option<Status>,
pub resource: Option<Resource>,
pub same_process_as_parent_span: Option<BoolValue>,
pub child_span_count: Option<UInt32Value>,
}
Expand description
A span represents a single operation within a trace. Spans can be nested to form a trace tree. Spans may also be linked to other spans from the same or different trace. And form graphs. Often, a trace contains a root span that describes the end-to-end latency, and one or more subspans for its sub-operations. A trace can also contain multiple root spans, or none at all. Spans do not need to be contiguous - there may be gaps or overlaps between spans in a trace.
The next id is 17. TODO(bdrutu): Add an example.
Fields§
§trace_id: Vec<u8>
A unique identifier for a trace. All spans from the same trace share
the same trace_id
. The ID is a 16-byte array. An ID with all zeroes
is considered invalid.
This field is semantically required. Receiver should generate new random trace_id if empty or invalid trace_id was received.
This field is required.
span_id: Vec<u8>
A unique identifier for a span within a trace, assigned when the span is created. The ID is an 8-byte array. An ID with all zeroes is considered invalid.
This field is semantically required. Receiver should generate new random span_id if empty or invalid span_id was received.
This field is required.
tracestate: Option<Tracestate>
The Tracestate on the span.
parent_span_id: Vec<u8>
The span_id
of this span’s parent span. If this is a root span, then this
field must be empty. The ID is an 8-byte array.
name: Option<TruncatableString>
A description of the span’s operation.
For example, the name can be a qualified method name or a file name and a line number where the operation is called. A best practice is to use the same display name at the same call point in an application. This makes it easier to correlate spans in different traces.
This field is semantically required to be set to non-empty string. When null or empty string received - receiver may use string “name” as a replacement. There might be smarted algorithms implemented by receiver to fix the empty span name.
This field is required.
kind: i32
Distinguishes between spans generated in a particular context. For example,
two spans with the same name may be distinguished using CLIENT
(caller)
and SERVER
(callee) to identify queueing latency associated with the span.
start_time: Option<Timestamp>
The start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server’s application handler starts running.
This field is semantically required. When not set on receive - receiver should set it to the value of end_time field if it was set. Or to the current time if neither was set. It is important to keep end_time > start_time for consistency.
This field is required.
end_time: Option<Timestamp>
The end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running.
This field is semantically required. When not set on receive - receiver should set it to start_time value. It is important to keep end_time > start_time for consistency.
This field is required.
attributes: Option<Attributes>
A set of attributes on the span.
stack_trace: Option<StackTrace>
A stack trace captured at the start of the span.
time_events: Option<TimeEvents>
The included time events.
links: Option<Links>
The included links.
status: Option<Status>
An optional final status for this span. Semantically when Status wasn’t set it is means span ended without errors and assume Status.Ok (code = 0).
resource: Option<Resource>
An optional resource that is associated with this span. If not set, this span should be part of a batch that does include the resource information, unless resource information is unknown.
same_process_as_parent_span: Option<BoolValue>
A highly recommended but not required flag that identifies when a trace crosses a process boundary. True when the parent_span belongs to the same process as the current span. This flag is most commonly used to indicate the need to adjust time as clocks in different processes may not be synchronized.
child_span_count: Option<UInt32Value>
An optional number of child spans that were generated while this span was active. If set, allows an implementation to detect missing child spans.
Implementations§
Trait Implementations§
Source§impl Message for Span
impl Message for Span
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.Source§impl Name for Span
impl Name for Span
Source§const NAME: &'static str = "Span"
const NAME: &'static str = "Span"
Message
.
This name is the same as it appears in the source .proto file, e.g. FooBar
.Source§const PACKAGE: &'static str = "opencensus.proto.trace.v1"
const PACKAGE: &'static str = "opencensus.proto.trace.v1"
.
, e.g. google.protobuf
.Source§fn full_name() -> String
fn full_name() -> String
Message
.
It’s prefixed with the package name and names of any parent messages,
e.g. google.rpc.BadRequest.FieldViolation
.
By default, this is the package name followed by the message name.
Fully-qualified names must be unique within a domain of Type URLs.impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request