Reference documentation and code samples for the Stackdriver Trace V2 Client class Span.
A span represents a single operation within a trace. Spans can be nested to form a trace tree. 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 might be gaps or overlaps between spans in a trace.
Generated from protobuf message google.devtools.cloudtrace.v2.Span
Namespace
Google \ Cloud \ Trace \ V2Methods
__construct
Constructor.
data
array
Optional. Data for populating the Message object.
↳ name
string
Required. The resource name of the span in the following format: * * projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
[TRACE_ID]
is a unique identifier for a trace within a project; it is a 32-character hexadecimal encoding of a 16-byte array. It should not be zero. [SPAN_ID]
is a unique identifier for a span within a trace; it is a 16-character hexadecimal encoding of an 8-byte array. It should not be zero. .
↳ span_id
string
Required. The [SPAN_ID]
portion of the span's resource name.
↳ parent_span_id
string
The [SPAN_ID]
of this span's parent span. If this is a root span, then this field must be empty.
↳ display_name
TruncatableString
Required. A description of the span's operation (up to 128 bytes). Cloud Trace displays the description in the Cloud console. For example, the display 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 within an application and at the same call point. This makes it easier to correlate spans in different traces.
↳ start_time
Google\Protobuf\Timestamp
Required. 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.
↳ end_time
Google\Protobuf\Timestamp
Required. 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.
↳ attributes
↳ stack_trace
↳ time_events
Span\TimeEvents
A set of time events. You can have up to 32 annotations and 128 message events per span.
↳ links
↳ status
↳ same_process_as_parent_span
Google\Protobuf\BoolValue
Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
↳ child_span_count
Google\Protobuf\Int32Value
Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
↳ span_kind
int
Optional. 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 an RPC call.
getName
Required. The resource name of the span in the following format:
-
projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
[TRACE_ID]
is a unique identifier for a trace within a project; it is a 32-character hexadecimal encoding of a 16-byte array. It should not be zero.
[SPAN_ID]
is a unique identifier for a span within a trace; it
is a 16-character hexadecimal encoding of an 8-byte array. It should not
be zero.
.
string
setName
Required. The resource name of the span in the following format:
-
projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
[TRACE_ID]
is a unique identifier for a trace within a project; it is a 32-character hexadecimal encoding of a 16-byte array. It should not be zero.
[SPAN_ID]
is a unique identifier for a span within a trace; it
is a 16-character hexadecimal encoding of an 8-byte array. It should not
be zero.
.
var
string
$this
getSpanId
Required. The [SPAN_ID]
portion of the span's resource name.
string
setSpanId
Required. The [SPAN_ID]
portion of the span's resource name.
var
string
$this
getParentSpanId
The [SPAN_ID]
of this span's parent span. If this is a root span,
then this field must be empty.
string
setParentSpanId
The [SPAN_ID]
of this span's parent span. If this is a root span,
then this field must be empty.
var
string
$this
getDisplayName
Required. A description of the span's operation (up to 128 bytes).
Cloud Trace displays the description in the Cloud console. For example, the display 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 within an application and at the same call point. This makes it easier to correlate spans in different traces.
hasDisplayName
clearDisplayName
setDisplayName
Required. A description of the span's operation (up to 128 bytes).
Cloud Trace displays the description in the Cloud console. For example, the display 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 within an application and at the same call point. This makes it easier to correlate spans in different traces.
$this
getStartTime
Required. 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.
hasStartTime
clearStartTime
setStartTime
Required. 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
getEndTime
Required. 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.
hasEndTime
clearEndTime
setEndTime
Required. 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
getAttributes
A set of attributes on the span. You can have up to 32 attributes per span.
hasAttributes
clearAttributes
setAttributes
A set of attributes on the span. You can have up to 32 attributes per span.
$this
getStackTrace
Stack trace captured at the start of the span.
hasStackTrace
clearStackTrace
setStackTrace
Stack trace captured at the start of the span.
$this
getTimeEvents
A set of time events. You can have up to 32 annotations and 128 message events per span.
hasTimeEvents
clearTimeEvents
setTimeEvents
A set of time events. You can have up to 32 annotations and 128 message events per span.
$this
getLinks
Links associated with the span. You can have up to 128 links per Span.
hasLinks
clearLinks
setLinks
Links associated with the span. You can have up to 128 links per Span.
$this
getStatus
Optional. The final status for this span.
hasStatus
clearStatus
setStatus
Optional. The final status for this span.
$this
getSameProcessAsParentSpan
Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
hasSameProcessAsParentSpan
clearSameProcessAsParentSpan
getSameProcessAsParentSpanValue
Returns the unboxed value from getSameProcessAsParentSpan()
Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
bool|null
setSameProcessAsParentSpan
Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
$this
setSameProcessAsParentSpanValue
Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object.
Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
var
bool|null
$this
getChildSpanCount
Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
hasChildSpanCount
clearChildSpanCount
getChildSpanCountValue
Returns the unboxed value from getChildSpanCount()
Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
int|null
setChildSpanCount
Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
$this
setChildSpanCountValue
Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.
Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
var
int|null
$this
getSpanKind
Optional. 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 an RPC call.
int
setSpanKind
Optional. 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 an RPC call.
var
int
$this