Reference documentation and code samples for the Stackdriver Monitoring V3 Client class SpanContext.
The context of a span. This is attached to anExemplarinDistributionvalues during aggregation.
It contains the name of a span with format:
projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
Generated from protobuf messagegoogle.monitoring.v3.SpanContext
Namespace
Google \ Cloud \ Monitoring \ V3
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ span_name
string
The resource name of the span. The format is: projects/[PROJECT_ID_OR_NUMBER]/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.[SPAN_ID]is a unique identifier for a span within a trace; it is a 16-character hexadecimal encoding of an 8-byte array.
getSpanName
The resource name of the span. The format is:
projects/[PROJECT_ID_OR_NUMBER]/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.
[SPAN_ID]is a unique identifier for a span within a trace; it
is a 16-character hexadecimal encoding of an 8-byte array.
Returns
Type
Description
string
setSpanName
The resource name of the span. The format is:
projects/[PROJECT_ID_OR_NUMBER]/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.
[SPAN_ID]is a unique identifier for a span within a trace; it
is a 16-character hexadecimal encoding of an 8-byte array.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Stackdriver Monitoring V3 Client - Class SpanContext (2.1.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.1.2 (latest)](/php/docs/reference/cloud-monitoring/latest/V3.SpanContext)\n- [2.1.1](/php/docs/reference/cloud-monitoring/2.1.1/V3.SpanContext)\n- [2.0.1](/php/docs/reference/cloud-monitoring/2.0.1/V3.SpanContext)\n- [1.12.1](/php/docs/reference/cloud-monitoring/1.12.1/V3.SpanContext)\n- [1.11.1](/php/docs/reference/cloud-monitoring/1.11.1/V3.SpanContext)\n- [1.10.3](/php/docs/reference/cloud-monitoring/1.10.3/V3.SpanContext)\n- [1.9.0](/php/docs/reference/cloud-monitoring/1.9.0/V3.SpanContext)\n- [1.8.0](/php/docs/reference/cloud-monitoring/1.8.0/V3.SpanContext)\n- [1.7.1](/php/docs/reference/cloud-monitoring/1.7.1/V3.SpanContext)\n- [1.6.0](/php/docs/reference/cloud-monitoring/1.6.0/V3.SpanContext)\n- [1.5.1](/php/docs/reference/cloud-monitoring/1.5.1/V3.SpanContext)\n- [1.4.0](/php/docs/reference/cloud-monitoring/1.4.0/V3.SpanContext)\n- [1.3.2](/php/docs/reference/cloud-monitoring/1.3.2/V3.SpanContext)\n- [1.2.2](/php/docs/reference/cloud-monitoring/1.2.2/V3.SpanContext) \nReference documentation and code samples for the Stackdriver Monitoring V3 Client class SpanContext.\n\nThe context of a span. This is attached to an\n[Exemplar](https://cloud.google.com/php/docs/reference/common-protos/latest/Api.Distribution.Exemplar.html)\nin [Distribution](https://cloud.google.com/php/docs/reference/common-protos/latest/Api.Distribution.html) values during aggregation.\n\nIt contains the name of a span with format:\nprojects/\\[PROJECT_ID_OR_NUMBER\\]/traces/\\[TRACE_ID\\]/spans/\\[SPAN_ID\\]\n\nGenerated from protobuf message `google.monitoring.v3.SpanContext`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Monitoring \\\\ V3\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getSpanName\n\nThe resource name of the span. The format is:\nprojects/\\[PROJECT_ID_OR_NUMBER\\]/traces/\\[TRACE_ID\\]/spans/\\[SPAN_ID\\]\n`[TRACE_ID]` is a unique identifier for a trace within a project;\nit is a 32-character hexadecimal encoding of a 16-byte array.\n\n`[SPAN_ID]` is a unique identifier for a span within a trace; it\nis a 16-character hexadecimal encoding of an 8-byte array.\n\n### setSpanName\n\nThe resource name of the span. The format is:\nprojects/\\[PROJECT_ID_OR_NUMBER\\]/traces/\\[TRACE_ID\\]/spans/\\[SPAN_ID\\]\n`[TRACE_ID]` is a unique identifier for a trace within a project;\nit is a 32-character hexadecimal encoding of a 16-byte array.\n\n`[SPAN_ID]` is a unique identifier for a span within a trace; it\nis a 16-character hexadecimal encoding of an 8-byte array."]]