Stay organized with collections
Save and categorize content based on your preferences.
This document provides an introduction to traces and spans.
A trace represents a single end-to-end operation. Traces are composed of
spans, which are records for a single function or operation.
Trace data model
A trace has the following properties:
Trace ID: The unique identifier of the end-to-end operation.
The trace ID must be
propagated as context as part of the end-to-end operation.
A collection of spans that share the same value for the trace ID.
Cloud Trace uses the trace ID to identify which spans in its repository
are associated with the same trace.
Span data model
A span corresponds to an operation which took place over some finite but
non-zero time period. The following lists some essential properties stored
by each span:
Trace ID: The identifier of the end-to-end operation in which this
particular overall operation took place.
Span ID: The unique identifier for the span. If the same operation is
invoked in the fulfillment of a single overall operation multiple times,
then a trace might contain multiple spans with the same name. However,
each span has a distinct span ID.
Parent span ID: Identifies the operation which invoked this span. The
"root" span has the parent span ID set to null.
Name: The name of the operation that was performed.
Start time: The start time of the operation.
End time: The end time of the operation.
Spans might also contain attributes, which store additional information about
an operation by using key-value pairs. Cloud Trace recommends that you use
OpenTelemetry Semantic Conventions where possible.
[[["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-03 UTC."],[],[],null,["# Traces and spans\n\nThis document provides an introduction to traces and spans.\nA *trace* represents a single end-to-end operation. Traces are composed of\n*spans*, which are records for a single function or operation.\n\nTrace data model\n----------------\n\nA trace has the following properties:\n\n- **Trace ID** : The unique identifier of the end-to-end operation.\n The trace ID must be\n propagated as [context](/trace/docs/trace-context) as part of the end-to-end operation.\n\n- A collection of spans that share the same value for the trace ID.\n\n Cloud Trace uses the trace ID to identify which spans in its repository\n are associated with the same trace.\n\nSpan data model\n---------------\n\nA span corresponds to an operation which took place over some finite but\nnon-zero time period. The following lists some essential properties stored\nby each span:\n\n- **Trace ID**: The identifier of the end-to-end operation in which this particular overall operation took place.\n- **Span ID**: The unique identifier for the span. If the same operation is invoked in the fulfillment of a single overall operation multiple times, then a trace might contain multiple spans with the same name. However, each span has a distinct span ID.\n- **Parent span ID** : Identifies the operation which invoked this span. The \"root\" span has the parent span ID set to `null`.\n- **Name**: The name of the operation that was performed.\n- **Start time**: The start time of the operation.\n- **End time**: The end time of the operation.\n\nSpans might also contain *attributes* , which store additional information about\nan operation by using key-value pairs. Cloud Trace recommends that you use\n[OpenTelemetry Semantic Conventions](https://github.com/open-telemetry/semantic-conventions) where possible.\n\nResources\n---------\n\nOpenTelemetry resources:\n\n- [OpenTelemetry](https://opentelemetry.io/)\n- [OpenTelemetry Trace overview](https://opentelemetry.io/docs/specs/otel/overview/#traces)\n- [OpenTelemetry Traces](https://opentelemetry.io/docs/concepts/signals/traces/)\n- [OpenTelemetry `trace.proto`](https://github.com/open-telemetry/opentelemetry-proto/blob/v1.1.0/opentelemetry/proto/trace/v1/trace.proto)\n\nWhat's next\n-----------\n\n- Learn about [context and context propagation](/trace/docs/trace-context).\n- Learn about [sampling](/trace/docs/trace-sampling)."]]