public sealed class SpanContext : IMessage<SpanContext>, IEquatable<SpanContext>, IDeepCloneable<SpanContext>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Monitoring v3 API class SpanContext.
The context of a span. This is attached to an
[Exemplar][google.api.Distribution.Exemplar]
in [Distribution][google.api.Distribution] values during aggregation.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eSpanContext\u003c/code\u003e class within the Google Cloud Monitoring v3 API is 3.15.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSpanContext\u003c/code\u003e is a class in the Google Cloud Monitoring v3 API, used to define the context of a span and is attached to an Exemplar in Distribution values during aggregation.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSpanContext\u003c/code\u003e class provides a \u003ccode\u003eSpanName\u003c/code\u003e property that represents the resource name of a span, which follows the format \u003ccode\u003eprojects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSpanContext\u003c/code\u003e class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThere are multiple versions of the SpanContext class, with the ability to access documentation for versions ranging from 2.3.0 to 3.15.0.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Monitoring v3 API - Class SpanContext (3.15.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.15.0 (latest)](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/latest/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.14.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.13.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.12.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.11.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.10.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.9.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.8.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.7.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.6.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.5.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.4.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.3.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.2.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.1.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/3.0.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/2.6.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/2.5.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/2.4.0/Google.Cloud.Monitoring.V3.SpanContext)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/2.3.0/Google.Cloud.Monitoring.V3.SpanContext) \n\n public sealed class SpanContext : IMessage\u003cSpanContext\u003e, IEquatable\u003cSpanContext\u003e, IDeepCloneable\u003cSpanContext\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Monitoring v3 API class SpanContext.\n\nThe context of a span. This is attached to an\n\\[Exemplar\\]\\[google.api.Distribution.Exemplar\\]\nin \\[Distribution\\]\\[google.api.Distribution\\] values during aggregation.\n\nIt contains the name of a span with format: \n\n projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]\n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SpanContext \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[SpanContext](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/latest/Google.Cloud.Monitoring.V3.SpanContext), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SpanContext](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/latest/Google.Cloud.Monitoring.V3.SpanContext), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[SpanContext](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/latest/Google.Cloud.Monitoring.V3.SpanContext), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Monitoring.V3](/dotnet/docs/reference/Google.Cloud.Monitoring.V3/latest/Google.Cloud.Monitoring.V3)\n\nAssembly\n--------\n\nGoogle.Cloud.Monitoring.V3.dll\n\nConstructors\n------------\n\n### SpanContext()\n\n public SpanContext()\n\n### SpanContext(SpanContext)\n\n public SpanContext(SpanContext other)\n\nProperties\n----------\n\n### SpanName\n\n public string SpanName { get; set; }\n\nThe resource name of the span. The format is: \n\n projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]\n\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."]]