[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-08 (世界標準時間)。"],[],[],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)."]]