This document describes the format in which trace spans are stored. The format of the data is generally consistent with the proto files defined by the OpenTelemetry OTLP Protocol. However, fields might be converted from an OpenTelemetry-specific data type to a JSON data type before storage.
The Telemetry API uses the OpenTelemetry OTLP Protocol. This protocol relies on the trace_service.proto and trace.proto files. For information about field limits, see Telemetry API limits.
The Cloud Trace API doesn't use the OpenTelemetry OTLP Protocol and defines a proprietary data format. Trace data sent to your Google Cloud project through this API is converted to the format described by this document. However, the limits for the Cloud Trace API apply.
Span storage format
Field | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
trace_id |
Globally unique identifier for the
trace.
This identifier is a 128-bit numeric value formatted as a 16-byte
hexadecimal string. For example,
A numeric value of zero is invalid. The |
||||||||||||||||
span_id |
Required. Identifier for the
span.
Must be unique within a trace.
This identifier is a 64-bit numeric value
formatted as an 8-byte hexadecimal string.
For example, A numeric value of zero is invalid. |
||||||||||||||||
trace_state |
This field corresponds to the
OpenTelemetry libraries automatically record the value of the
|
||||||||||||||||
parent_span_id |
Optional. Identifies the operation which invoked this span. The "root" span has the parent span ID set to null. The parent-child relationship between spans is used by visualization tools to construct the tree structure. |
||||||||||||||||
name |
Required. The name of the operation that was performed. The name can be a method name or some other per-call site name. For the same executable and the same endpoint, using a consistent name makes it easier to correlate cross-trace spans. For best practices, see How to Name Your Spans. The span name is sanitized and displayed in the Google Cloud console. |
||||||||||||||||
kind |
Specifies where in the system the operation took place. The value corresponds to the OpenTelemetry: Span Kind enumeration:
|
||||||||||||||||
start_time |
Required. Start time of the span, to the nearest nanosecond. |
||||||||||||||||
start_time_unix_nano |
The start time in nanoseconds, according to the UNIX epoch. |
||||||||||||||||
end_time |
Required. End time of the span, to the nearest nanosecond. |
||||||||||||||||
end_time_unix_nano |
The end time in nanoseconds, according to the UNIX epoch. |
||||||||||||||||
receive_time |
Required. Receive time of the span, to the nearest nanosecond. |
||||||||||||||||
receive_time_unix_nano |
The end time in nanoseconds, according to the UNIX epoch. |
||||||||||||||||
duration_unix_nano |
The duration in nanoseconds. |
||||||||||||||||
attributes |
Each attribute is a key-value pair. The attributes available to you are dependent on your trace data. The structure of attributes follow the OpenTelemetry standard. To learn more, see OpenTelemetry: Attributes. OpenTelemetry specificies semantic conventions for attributes. To learn about these conventions, see Trace semantic conventions. The following are examples of attributes: "yourcompany.your.own.key": "your own value" "network.protocol.name": "http" "network.protocol.version": "1.1" "http.response.status_code": "200" "network.peer.address": "REDACTED" |
||||||||||||||||
dropped_attributes_count |
The number of attributes that were discarded. Attributes can discarded because their keys are too long or because there are too many attributes. When this value is zero, no attributes were discarded. This value might be set by the client-side instrumentation or by an application. The value can be incremented by the server. |
||||||||||||||||
events |
A point in time event. Each event contains the following fields.
|
||||||||||||||||
dropped_events_count |
The number of events that were discarded. Events can discarded because there are too many events. When this value is zero, no events were discarded. |
||||||||||||||||
links |
Links associated with the span. Links are references from this span to another span in the same or different trace. Links provide a mechanism to correlate spans from one trace with spans in another trace. For example, suppose one operation causes an asynchronous operation to occur. In this scenario, there are two traces, one for the original operation and one for the asynchronous operation. You can use links to correlate the spans in these traces. Each link contains the following fields.
|
||||||||||||||||
dropped_links_count |
The number of links that were discarded. Links can discarded because there are too many links. When this value is zero, no links were discarded. |
||||||||||||||||
status |
This field records the completion status for a span.
The value of the
The |
||||||||||||||||
resource |
This field identifies the infrastructure or hosting system from which the telemetry was collected or that the telemetry is about. For example, consider an application running on Google Kubernetes Engine. Attributes for this resource might include the process name and namespace. This field contains the following subfields:
To learn more, see OpenTelemetry: Resources. |
||||||||||||||||
instrumentation_scope |
This field identifies the library or application component for
the specified For example, suppose the application "checkout-service" is deployed
to Cloud Run, which means that the A client span, like "WritePaymentInfoToStripe", might be a span that is reported by the "payment-processor-library", which is inside the Cloud Run service named "checkout-service". This field contains the following subfields:
To learn more, see OpenTelemetry: Instrumentation scope. |
||||||||||||||||
resource_schema_link |
These fields must be a URL formatted as a string. These fields contain a URL that returns a schema file for a resource. The format of the schema file and data is defined by OpenTelemetry. For more information, see OpenTelemetry: Schemas. These fields can only be set when using the Telemetry API. That API doesn't validate that the data conforms to the declared schema. |
||||||||||||||||
scope_schema_link |
These fields must be a URL formatted as a string. These fields contain a URL that returns a schema file for a scope. The format of the schema file and data is defined by OpenTelemetry. For more information, see OpenTelemetry: Schemas. These fields can only be set when using the Telemetry API. That API doesn't validate that the data conforms to the declared schema. |
||||||||||||||||
apphub |
Application-specific labels are available when trace spans are generated by App Hub applications, when those applications run on supported infrastructure or have been instrumented. To learn more about Application Monitoring and when these labels are available, see Application Monitoring overview. This field contains
|