xref: /aosp_15_r20/external/googleapis/google/devtools/cloudtrace/v2/trace.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2022 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.devtools.cloudtrace.v2;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto";
22*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/wrappers.proto";
23*d5c09012SAndroid Build Coastguard Workerimport "google/rpc/status.proto";
24*d5c09012SAndroid Build Coastguard Worker
25*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.Trace.V2";
26*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/trace/apiv2/tracepb;tracepb";
27*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
28*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "TraceProto";
29*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.devtools.cloudtrace.v2";
30*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\Trace\\V2";
31*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::Trace::V2";
32*d5c09012SAndroid Build Coastguard Worker
33*d5c09012SAndroid Build Coastguard Worker// A span represents a single operation within a trace. Spans can be
34*d5c09012SAndroid Build Coastguard Worker// nested to form a trace tree. Often, a trace contains a root span
35*d5c09012SAndroid Build Coastguard Worker// that describes the end-to-end latency, and one or more subspans for
36*d5c09012SAndroid Build Coastguard Worker// its sub-operations.
37*d5c09012SAndroid Build Coastguard Worker//
38*d5c09012SAndroid Build Coastguard Worker// A trace can also contain multiple root spans, or none at all.
39*d5c09012SAndroid Build Coastguard Worker// Spans do not need to be contiguous. There might be
40*d5c09012SAndroid Build Coastguard Worker// gaps or overlaps between spans in a trace.
41*d5c09012SAndroid Build Coastguard Workermessage Span {
42*d5c09012SAndroid Build Coastguard Worker  option (google.api.resource) = {
43*d5c09012SAndroid Build Coastguard Worker    type: "cloudtrace.googleapis.com/Span"
44*d5c09012SAndroid Build Coastguard Worker    pattern: "projects/{project}/traces/{trace}/spans/{span}"
45*d5c09012SAndroid Build Coastguard Worker  };
46*d5c09012SAndroid Build Coastguard Worker
47*d5c09012SAndroid Build Coastguard Worker  // A set of attributes as key-value pairs.
48*d5c09012SAndroid Build Coastguard Worker  message Attributes {
49*d5c09012SAndroid Build Coastguard Worker    // A set of attributes. Each attribute's key can be up to 128 bytes
50*d5c09012SAndroid Build Coastguard Worker    // long. The value can be a string up to 256 bytes, a signed 64-bit integer,
51*d5c09012SAndroid Build Coastguard Worker    // or the boolean values `true` or `false`. For example:
52*d5c09012SAndroid Build Coastguard Worker    //
53*d5c09012SAndroid Build Coastguard Worker    //     "/instance_id": { "string_value": { "value": "my-instance" } }
54*d5c09012SAndroid Build Coastguard Worker    //     "/http/request_bytes": { "int_value": 300 }
55*d5c09012SAndroid Build Coastguard Worker    //     "abc.com/myattribute": { "bool_value": false }
56*d5c09012SAndroid Build Coastguard Worker    map<string, AttributeValue> attribute_map = 1;
57*d5c09012SAndroid Build Coastguard Worker
58*d5c09012SAndroid Build Coastguard Worker    // The number of attributes that were discarded. Attributes can be discarded
59*d5c09012SAndroid Build Coastguard Worker    // because their keys are too long or because there are too many attributes.
60*d5c09012SAndroid Build Coastguard Worker    // If this value is 0 then all attributes are valid.
61*d5c09012SAndroid Build Coastguard Worker    int32 dropped_attributes_count = 2;
62*d5c09012SAndroid Build Coastguard Worker  }
63*d5c09012SAndroid Build Coastguard Worker
64*d5c09012SAndroid Build Coastguard Worker  // A time-stamped annotation or message event in the Span.
65*d5c09012SAndroid Build Coastguard Worker  message TimeEvent {
66*d5c09012SAndroid Build Coastguard Worker    // Text annotation with a set of attributes.
67*d5c09012SAndroid Build Coastguard Worker    message Annotation {
68*d5c09012SAndroid Build Coastguard Worker      // A user-supplied message describing the event. The maximum length for
69*d5c09012SAndroid Build Coastguard Worker      // the description is 256 bytes.
70*d5c09012SAndroid Build Coastguard Worker      TruncatableString description = 1;
71*d5c09012SAndroid Build Coastguard Worker
72*d5c09012SAndroid Build Coastguard Worker      // A set of attributes on the annotation. You can have up to 4 attributes
73*d5c09012SAndroid Build Coastguard Worker      // per Annotation.
74*d5c09012SAndroid Build Coastguard Worker      Attributes attributes = 2;
75*d5c09012SAndroid Build Coastguard Worker    }
76*d5c09012SAndroid Build Coastguard Worker
77*d5c09012SAndroid Build Coastguard Worker    // An event describing a message sent/received between Spans.
78*d5c09012SAndroid Build Coastguard Worker    message MessageEvent {
79*d5c09012SAndroid Build Coastguard Worker      // Indicates whether the message was sent or received.
80*d5c09012SAndroid Build Coastguard Worker      enum Type {
81*d5c09012SAndroid Build Coastguard Worker        // Unknown event type.
82*d5c09012SAndroid Build Coastguard Worker        TYPE_UNSPECIFIED = 0;
83*d5c09012SAndroid Build Coastguard Worker
84*d5c09012SAndroid Build Coastguard Worker        // Indicates a sent message.
85*d5c09012SAndroid Build Coastguard Worker        SENT = 1;
86*d5c09012SAndroid Build Coastguard Worker
87*d5c09012SAndroid Build Coastguard Worker        // Indicates a received message.
88*d5c09012SAndroid Build Coastguard Worker        RECEIVED = 2;
89*d5c09012SAndroid Build Coastguard Worker      }
90*d5c09012SAndroid Build Coastguard Worker
91*d5c09012SAndroid Build Coastguard Worker      // Type of MessageEvent. Indicates whether the message was sent or
92*d5c09012SAndroid Build Coastguard Worker      // received.
93*d5c09012SAndroid Build Coastguard Worker      Type type = 1;
94*d5c09012SAndroid Build Coastguard Worker
95*d5c09012SAndroid Build Coastguard Worker      // An identifier for the MessageEvent's message that can be used to match
96*d5c09012SAndroid Build Coastguard Worker      // `SENT` and `RECEIVED` MessageEvents.
97*d5c09012SAndroid Build Coastguard Worker      int64 id = 2;
98*d5c09012SAndroid Build Coastguard Worker
99*d5c09012SAndroid Build Coastguard Worker      // The number of uncompressed bytes sent or received.
100*d5c09012SAndroid Build Coastguard Worker      int64 uncompressed_size_bytes = 3;
101*d5c09012SAndroid Build Coastguard Worker
102*d5c09012SAndroid Build Coastguard Worker      // The number of compressed bytes sent or received. If missing, the
103*d5c09012SAndroid Build Coastguard Worker      // compressed size is assumed to be the same size as the uncompressed
104*d5c09012SAndroid Build Coastguard Worker      // size.
105*d5c09012SAndroid Build Coastguard Worker      int64 compressed_size_bytes = 4;
106*d5c09012SAndroid Build Coastguard Worker    }
107*d5c09012SAndroid Build Coastguard Worker
108*d5c09012SAndroid Build Coastguard Worker    // The timestamp indicating the time the event occurred.
109*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Timestamp time = 1;
110*d5c09012SAndroid Build Coastguard Worker
111*d5c09012SAndroid Build Coastguard Worker    // A `TimeEvent` can contain either an `Annotation` object or a
112*d5c09012SAndroid Build Coastguard Worker    // `MessageEvent` object, but not both.
113*d5c09012SAndroid Build Coastguard Worker    oneof value {
114*d5c09012SAndroid Build Coastguard Worker      // Text annotation with a set of attributes.
115*d5c09012SAndroid Build Coastguard Worker      Annotation annotation = 2;
116*d5c09012SAndroid Build Coastguard Worker
117*d5c09012SAndroid Build Coastguard Worker      // An event describing a message sent/received between Spans.
118*d5c09012SAndroid Build Coastguard Worker      MessageEvent message_event = 3;
119*d5c09012SAndroid Build Coastguard Worker    }
120*d5c09012SAndroid Build Coastguard Worker  }
121*d5c09012SAndroid Build Coastguard Worker
122*d5c09012SAndroid Build Coastguard Worker  // A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation
123*d5c09012SAndroid Build Coastguard Worker  // on the span, consisting of either user-supplied key:value pairs, or
124*d5c09012SAndroid Build Coastguard Worker  // details of a message sent/received between Spans.
125*d5c09012SAndroid Build Coastguard Worker  message TimeEvents {
126*d5c09012SAndroid Build Coastguard Worker    // A collection of `TimeEvent`s.
127*d5c09012SAndroid Build Coastguard Worker    repeated TimeEvent time_event = 1;
128*d5c09012SAndroid Build Coastguard Worker
129*d5c09012SAndroid Build Coastguard Worker    // The number of dropped annotations in all the included time events.
130*d5c09012SAndroid Build Coastguard Worker    // If the value is 0, then no annotations were dropped.
131*d5c09012SAndroid Build Coastguard Worker    int32 dropped_annotations_count = 2;
132*d5c09012SAndroid Build Coastguard Worker
133*d5c09012SAndroid Build Coastguard Worker    // The number of dropped message events in all the included time events.
134*d5c09012SAndroid Build Coastguard Worker    // If the value is 0, then no message events were dropped.
135*d5c09012SAndroid Build Coastguard Worker    int32 dropped_message_events_count = 3;
136*d5c09012SAndroid Build Coastguard Worker  }
137*d5c09012SAndroid Build Coastguard Worker
138*d5c09012SAndroid Build Coastguard Worker  // A pointer from the current span to another span in the same trace or in a
139*d5c09012SAndroid Build Coastguard Worker  // different trace. For example, this can be used in batching operations,
140*d5c09012SAndroid Build Coastguard Worker  // where a single batch handler processes multiple requests from different
141*d5c09012SAndroid Build Coastguard Worker  // traces or when the handler receives a request from a different project.
142*d5c09012SAndroid Build Coastguard Worker  message Link {
143*d5c09012SAndroid Build Coastguard Worker    // The relationship of the current span relative to the linked span: child,
144*d5c09012SAndroid Build Coastguard Worker    // parent, or unspecified.
145*d5c09012SAndroid Build Coastguard Worker    enum Type {
146*d5c09012SAndroid Build Coastguard Worker      // The relationship of the two spans is unknown.
147*d5c09012SAndroid Build Coastguard Worker      TYPE_UNSPECIFIED = 0;
148*d5c09012SAndroid Build Coastguard Worker
149*d5c09012SAndroid Build Coastguard Worker      // The linked span is a child of the current span.
150*d5c09012SAndroid Build Coastguard Worker      CHILD_LINKED_SPAN = 1;
151*d5c09012SAndroid Build Coastguard Worker
152*d5c09012SAndroid Build Coastguard Worker      // The linked span is a parent of the current span.
153*d5c09012SAndroid Build Coastguard Worker      PARENT_LINKED_SPAN = 2;
154*d5c09012SAndroid Build Coastguard Worker    }
155*d5c09012SAndroid Build Coastguard Worker
156*d5c09012SAndroid Build Coastguard Worker    // The `[TRACE_ID]` for a trace within a project.
157*d5c09012SAndroid Build Coastguard Worker    string trace_id = 1;
158*d5c09012SAndroid Build Coastguard Worker
159*d5c09012SAndroid Build Coastguard Worker    // The `[SPAN_ID]` for a span within a trace.
160*d5c09012SAndroid Build Coastguard Worker    string span_id = 2;
161*d5c09012SAndroid Build Coastguard Worker
162*d5c09012SAndroid Build Coastguard Worker    // The relationship of the current span relative to the linked span.
163*d5c09012SAndroid Build Coastguard Worker    Type type = 3;
164*d5c09012SAndroid Build Coastguard Worker
165*d5c09012SAndroid Build Coastguard Worker    // A set of attributes on the link. Up to 32 attributes can be
166*d5c09012SAndroid Build Coastguard Worker    // specified per link.
167*d5c09012SAndroid Build Coastguard Worker    Attributes attributes = 4;
168*d5c09012SAndroid Build Coastguard Worker  }
169*d5c09012SAndroid Build Coastguard Worker
170*d5c09012SAndroid Build Coastguard Worker  // A collection of links, which are references from this span to a span
171*d5c09012SAndroid Build Coastguard Worker  // in the same or different trace.
172*d5c09012SAndroid Build Coastguard Worker  message Links {
173*d5c09012SAndroid Build Coastguard Worker    // A collection of links.
174*d5c09012SAndroid Build Coastguard Worker    repeated Link link = 1;
175*d5c09012SAndroid Build Coastguard Worker
176*d5c09012SAndroid Build Coastguard Worker    // The number of dropped links after the maximum size was enforced. If
177*d5c09012SAndroid Build Coastguard Worker    // this value is 0, then no links were dropped.
178*d5c09012SAndroid Build Coastguard Worker    int32 dropped_links_count = 2;
179*d5c09012SAndroid Build Coastguard Worker  }
180*d5c09012SAndroid Build Coastguard Worker
181*d5c09012SAndroid Build Coastguard Worker  // Type of span. Can be used to specify additional relationships between spans
182*d5c09012SAndroid Build Coastguard Worker  // in addition to a parent/child relationship.
183*d5c09012SAndroid Build Coastguard Worker  enum SpanKind {
184*d5c09012SAndroid Build Coastguard Worker    // Unspecified. Do NOT use as default.
185*d5c09012SAndroid Build Coastguard Worker    // Implementations MAY assume SpanKind.INTERNAL to be default.
186*d5c09012SAndroid Build Coastguard Worker    SPAN_KIND_UNSPECIFIED = 0;
187*d5c09012SAndroid Build Coastguard Worker
188*d5c09012SAndroid Build Coastguard Worker    // Indicates that the span is used internally. Default value.
189*d5c09012SAndroid Build Coastguard Worker    INTERNAL = 1;
190*d5c09012SAndroid Build Coastguard Worker
191*d5c09012SAndroid Build Coastguard Worker    // Indicates that the span covers server-side handling of an RPC or other
192*d5c09012SAndroid Build Coastguard Worker    // remote network request.
193*d5c09012SAndroid Build Coastguard Worker    SERVER = 2;
194*d5c09012SAndroid Build Coastguard Worker
195*d5c09012SAndroid Build Coastguard Worker    // Indicates that the span covers the client-side wrapper around an RPC or
196*d5c09012SAndroid Build Coastguard Worker    // other remote request.
197*d5c09012SAndroid Build Coastguard Worker    CLIENT = 3;
198*d5c09012SAndroid Build Coastguard Worker
199*d5c09012SAndroid Build Coastguard Worker    // Indicates that the span describes producer sending a message to a broker.
200*d5c09012SAndroid Build Coastguard Worker    // Unlike client and  server, there is no direct critical path latency
201*d5c09012SAndroid Build Coastguard Worker    // relationship between producer and consumer spans (e.g. publishing a
202*d5c09012SAndroid Build Coastguard Worker    // message to a pubsub service).
203*d5c09012SAndroid Build Coastguard Worker    PRODUCER = 4;
204*d5c09012SAndroid Build Coastguard Worker
205*d5c09012SAndroid Build Coastguard Worker    // Indicates that the span describes consumer receiving a message from a
206*d5c09012SAndroid Build Coastguard Worker    // broker. Unlike client and  server, there is no direct critical path
207*d5c09012SAndroid Build Coastguard Worker    // latency relationship between producer and consumer spans (e.g. receiving
208*d5c09012SAndroid Build Coastguard Worker    // a message from a pubsub service subscription).
209*d5c09012SAndroid Build Coastguard Worker    CONSUMER = 5;
210*d5c09012SAndroid Build Coastguard Worker  }
211*d5c09012SAndroid Build Coastguard Worker
212*d5c09012SAndroid Build Coastguard Worker  // Required. The resource name of the span in the following format:
213*d5c09012SAndroid Build Coastguard Worker  //
214*d5c09012SAndroid Build Coastguard Worker  //  * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]`
215*d5c09012SAndroid Build Coastguard Worker  //
216*d5c09012SAndroid Build Coastguard Worker  // `[TRACE_ID]` is a unique identifier for a trace within a project;
217*d5c09012SAndroid Build Coastguard Worker  // it is a 32-character hexadecimal encoding of a 16-byte array. It should
218*d5c09012SAndroid Build Coastguard Worker  // not be zero.
219*d5c09012SAndroid Build Coastguard Worker  //
220*d5c09012SAndroid Build Coastguard Worker  // `[SPAN_ID]` is a unique identifier for a span within a trace; it
221*d5c09012SAndroid Build Coastguard Worker  // is a 16-character hexadecimal encoding of an 8-byte array. It should not
222*d5c09012SAndroid Build Coastguard Worker  // be zero.
223*d5c09012SAndroid Build Coastguard Worker  // .
224*d5c09012SAndroid Build Coastguard Worker  string name = 1 [(google.api.field_behavior) = REQUIRED];
225*d5c09012SAndroid Build Coastguard Worker
226*d5c09012SAndroid Build Coastguard Worker  // Required. The `[SPAN_ID]` portion of the span's resource name.
227*d5c09012SAndroid Build Coastguard Worker  string span_id = 2 [(google.api.field_behavior) = REQUIRED];
228*d5c09012SAndroid Build Coastguard Worker
229*d5c09012SAndroid Build Coastguard Worker  // The `[SPAN_ID]` of this span's parent span. If this is a root span,
230*d5c09012SAndroid Build Coastguard Worker  // then this field must be empty.
231*d5c09012SAndroid Build Coastguard Worker  string parent_span_id = 3;
232*d5c09012SAndroid Build Coastguard Worker
233*d5c09012SAndroid Build Coastguard Worker  // Required. A description of the span's operation (up to 128 bytes).
234*d5c09012SAndroid Build Coastguard Worker  // Cloud Trace displays the description in the
235*d5c09012SAndroid Build Coastguard Worker  // Cloud console.
236*d5c09012SAndroid Build Coastguard Worker  // For example, the display name can be a qualified method name or a file name
237*d5c09012SAndroid Build Coastguard Worker  // and a line number where the operation is called. A best practice is to use
238*d5c09012SAndroid Build Coastguard Worker  // the same display name within an application and at the same call point.
239*d5c09012SAndroid Build Coastguard Worker  // This makes it easier to correlate spans in different traces.
240*d5c09012SAndroid Build Coastguard Worker  TruncatableString display_name = 4 [(google.api.field_behavior) = REQUIRED];
241*d5c09012SAndroid Build Coastguard Worker
242*d5c09012SAndroid Build Coastguard Worker  // Required. The start time of the span. On the client side, this is the time
243*d5c09012SAndroid Build Coastguard Worker  // kept by the local machine where the span execution starts. On the server
244*d5c09012SAndroid Build Coastguard Worker  // side, this is the time when the server's application handler starts
245*d5c09012SAndroid Build Coastguard Worker  // running.
246*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp start_time = 5
247*d5c09012SAndroid Build Coastguard Worker      [(google.api.field_behavior) = REQUIRED];
248*d5c09012SAndroid Build Coastguard Worker
249*d5c09012SAndroid Build Coastguard Worker  // Required. The end time of the span. On the client side, this is the time
250*d5c09012SAndroid Build Coastguard Worker  // kept by the local machine where the span execution ends. On the server
251*d5c09012SAndroid Build Coastguard Worker  // side, this is the time when the server application handler stops running.
252*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp end_time = 6
253*d5c09012SAndroid Build Coastguard Worker      [(google.api.field_behavior) = REQUIRED];
254*d5c09012SAndroid Build Coastguard Worker
255*d5c09012SAndroid Build Coastguard Worker  // A set of attributes on the span. You can have up to 32 attributes per
256*d5c09012SAndroid Build Coastguard Worker  // span.
257*d5c09012SAndroid Build Coastguard Worker  Attributes attributes = 7;
258*d5c09012SAndroid Build Coastguard Worker
259*d5c09012SAndroid Build Coastguard Worker  // Stack trace captured at the start of the span.
260*d5c09012SAndroid Build Coastguard Worker  StackTrace stack_trace = 8;
261*d5c09012SAndroid Build Coastguard Worker
262*d5c09012SAndroid Build Coastguard Worker  // A set of time events. You can have up to 32 annotations and 128 message
263*d5c09012SAndroid Build Coastguard Worker  // events per span.
264*d5c09012SAndroid Build Coastguard Worker  TimeEvents time_events = 9;
265*d5c09012SAndroid Build Coastguard Worker
266*d5c09012SAndroid Build Coastguard Worker  // Links associated with the span. You can have up to 128 links per Span.
267*d5c09012SAndroid Build Coastguard Worker  Links links = 10;
268*d5c09012SAndroid Build Coastguard Worker
269*d5c09012SAndroid Build Coastguard Worker  // Optional. The final status for this span.
270*d5c09012SAndroid Build Coastguard Worker  google.rpc.Status status = 11 [(google.api.field_behavior) = OPTIONAL];
271*d5c09012SAndroid Build Coastguard Worker
272*d5c09012SAndroid Build Coastguard Worker  // Optional. Set this parameter to indicate whether this span is in
273*d5c09012SAndroid Build Coastguard Worker  // the same process as its parent. If you do not set this parameter,
274*d5c09012SAndroid Build Coastguard Worker  // Trace is unable to take advantage of this helpful information.
275*d5c09012SAndroid Build Coastguard Worker  google.protobuf.BoolValue same_process_as_parent_span = 12
276*d5c09012SAndroid Build Coastguard Worker      [(google.api.field_behavior) = OPTIONAL];
277*d5c09012SAndroid Build Coastguard Worker
278*d5c09012SAndroid Build Coastguard Worker  // Optional. The number of child spans that were generated while this span
279*d5c09012SAndroid Build Coastguard Worker  // was active. If set, allows implementation to detect missing child spans.
280*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Int32Value child_span_count = 13
281*d5c09012SAndroid Build Coastguard Worker      [(google.api.field_behavior) = OPTIONAL];
282*d5c09012SAndroid Build Coastguard Worker
283*d5c09012SAndroid Build Coastguard Worker  // Optional. Distinguishes between spans generated in a particular context.
284*d5c09012SAndroid Build Coastguard Worker  // For example, two spans with the same name may be distinguished using
285*d5c09012SAndroid Build Coastguard Worker  // `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call.
286*d5c09012SAndroid Build Coastguard Worker  SpanKind span_kind = 14 [(google.api.field_behavior) = OPTIONAL];
287*d5c09012SAndroid Build Coastguard Worker}
288*d5c09012SAndroid Build Coastguard Worker
289*d5c09012SAndroid Build Coastguard Worker// The allowed types for `[VALUE]` in a `[KEY]:[VALUE]` attribute.
290*d5c09012SAndroid Build Coastguard Workermessage AttributeValue {
291*d5c09012SAndroid Build Coastguard Worker  // The type of the value.
292*d5c09012SAndroid Build Coastguard Worker  oneof value {
293*d5c09012SAndroid Build Coastguard Worker    // A string up to 256 bytes long.
294*d5c09012SAndroid Build Coastguard Worker    TruncatableString string_value = 1;
295*d5c09012SAndroid Build Coastguard Worker
296*d5c09012SAndroid Build Coastguard Worker    // A 64-bit signed integer.
297*d5c09012SAndroid Build Coastguard Worker    int64 int_value = 2;
298*d5c09012SAndroid Build Coastguard Worker
299*d5c09012SAndroid Build Coastguard Worker    // A Boolean value represented by `true` or `false`.
300*d5c09012SAndroid Build Coastguard Worker    bool bool_value = 3;
301*d5c09012SAndroid Build Coastguard Worker  }
302*d5c09012SAndroid Build Coastguard Worker}
303*d5c09012SAndroid Build Coastguard Worker
304*d5c09012SAndroid Build Coastguard Worker// A call stack appearing in a trace.
305*d5c09012SAndroid Build Coastguard Workermessage StackTrace {
306*d5c09012SAndroid Build Coastguard Worker  // Represents a single stack frame in a stack trace.
307*d5c09012SAndroid Build Coastguard Worker  message StackFrame {
308*d5c09012SAndroid Build Coastguard Worker    // The fully-qualified name that uniquely identifies the function or
309*d5c09012SAndroid Build Coastguard Worker    // method that is active in this frame (up to 1024 bytes).
310*d5c09012SAndroid Build Coastguard Worker    TruncatableString function_name = 1;
311*d5c09012SAndroid Build Coastguard Worker
312*d5c09012SAndroid Build Coastguard Worker    // An un-mangled function name, if `function_name` is mangled.
313*d5c09012SAndroid Build Coastguard Worker    // To get information about name mangling, run
314*d5c09012SAndroid Build Coastguard Worker    // [this search](https://www.google.com/search?q=cxx+name+mangling).
315*d5c09012SAndroid Build Coastguard Worker    // The name can be fully-qualified (up to 1024 bytes).
316*d5c09012SAndroid Build Coastguard Worker    TruncatableString original_function_name = 2;
317*d5c09012SAndroid Build Coastguard Worker
318*d5c09012SAndroid Build Coastguard Worker    // The name of the source file where the function call appears (up to 256
319*d5c09012SAndroid Build Coastguard Worker    // bytes).
320*d5c09012SAndroid Build Coastguard Worker    TruncatableString file_name = 3;
321*d5c09012SAndroid Build Coastguard Worker
322*d5c09012SAndroid Build Coastguard Worker    // The line number in `file_name` where the function call appears.
323*d5c09012SAndroid Build Coastguard Worker    int64 line_number = 4;
324*d5c09012SAndroid Build Coastguard Worker
325*d5c09012SAndroid Build Coastguard Worker    // The column number where the function call appears, if available.
326*d5c09012SAndroid Build Coastguard Worker    // This is important in JavaScript because of its anonymous functions.
327*d5c09012SAndroid Build Coastguard Worker    int64 column_number = 5;
328*d5c09012SAndroid Build Coastguard Worker
329*d5c09012SAndroid Build Coastguard Worker    // The binary module from where the code was loaded.
330*d5c09012SAndroid Build Coastguard Worker    Module load_module = 6;
331*d5c09012SAndroid Build Coastguard Worker
332*d5c09012SAndroid Build Coastguard Worker    // The version of the deployed source code (up to 128 bytes).
333*d5c09012SAndroid Build Coastguard Worker    TruncatableString source_version = 7;
334*d5c09012SAndroid Build Coastguard Worker  }
335*d5c09012SAndroid Build Coastguard Worker
336*d5c09012SAndroid Build Coastguard Worker  // A collection of stack frames, which can be truncated.
337*d5c09012SAndroid Build Coastguard Worker  message StackFrames {
338*d5c09012SAndroid Build Coastguard Worker    // Stack frames in this call stack.
339*d5c09012SAndroid Build Coastguard Worker    repeated StackFrame frame = 1;
340*d5c09012SAndroid Build Coastguard Worker
341*d5c09012SAndroid Build Coastguard Worker    // The number of stack frames that were dropped because there
342*d5c09012SAndroid Build Coastguard Worker    // were too many stack frames.
343*d5c09012SAndroid Build Coastguard Worker    // If this value is 0, then no stack frames were dropped.
344*d5c09012SAndroid Build Coastguard Worker    int32 dropped_frames_count = 2;
345*d5c09012SAndroid Build Coastguard Worker  }
346*d5c09012SAndroid Build Coastguard Worker
347*d5c09012SAndroid Build Coastguard Worker  // Stack frames in this stack trace. A maximum of 128 frames are allowed.
348*d5c09012SAndroid Build Coastguard Worker  StackFrames stack_frames = 1;
349*d5c09012SAndroid Build Coastguard Worker
350*d5c09012SAndroid Build Coastguard Worker  // The hash ID is used to conserve network bandwidth for duplicate
351*d5c09012SAndroid Build Coastguard Worker  // stack traces within a single trace.
352*d5c09012SAndroid Build Coastguard Worker  //
353*d5c09012SAndroid Build Coastguard Worker  // Often multiple spans will have identical stack traces.
354*d5c09012SAndroid Build Coastguard Worker  // The first occurrence of a stack trace should contain both the
355*d5c09012SAndroid Build Coastguard Worker  // `stackFrame` content and a value in `stackTraceHashId`.
356*d5c09012SAndroid Build Coastguard Worker  //
357*d5c09012SAndroid Build Coastguard Worker  // Subsequent spans within the same request can refer
358*d5c09012SAndroid Build Coastguard Worker  // to that stack trace by only setting `stackTraceHashId`.
359*d5c09012SAndroid Build Coastguard Worker  int64 stack_trace_hash_id = 2;
360*d5c09012SAndroid Build Coastguard Worker}
361*d5c09012SAndroid Build Coastguard Worker
362*d5c09012SAndroid Build Coastguard Worker// Binary module.
363*d5c09012SAndroid Build Coastguard Workermessage Module {
364*d5c09012SAndroid Build Coastguard Worker  // For example: main binary, kernel modules, and dynamic libraries
365*d5c09012SAndroid Build Coastguard Worker  // such as libc.so, sharedlib.so (up to 256 bytes).
366*d5c09012SAndroid Build Coastguard Worker  TruncatableString module = 1;
367*d5c09012SAndroid Build Coastguard Worker
368*d5c09012SAndroid Build Coastguard Worker  // A unique identifier for the module, usually a hash of its
369*d5c09012SAndroid Build Coastguard Worker  // contents (up to 128 bytes).
370*d5c09012SAndroid Build Coastguard Worker  TruncatableString build_id = 2;
371*d5c09012SAndroid Build Coastguard Worker}
372*d5c09012SAndroid Build Coastguard Worker
373*d5c09012SAndroid Build Coastguard Worker// Represents a string that might be shortened to a specified length.
374*d5c09012SAndroid Build Coastguard Workermessage TruncatableString {
375*d5c09012SAndroid Build Coastguard Worker  // The shortened string. For example, if the original string is 500
376*d5c09012SAndroid Build Coastguard Worker  // bytes long and the limit of the string is 128 bytes, then
377*d5c09012SAndroid Build Coastguard Worker  // `value` contains the first 128 bytes of the 500-byte string.
378*d5c09012SAndroid Build Coastguard Worker  //
379*d5c09012SAndroid Build Coastguard Worker  // Truncation always happens on a UTF8 character boundary. If there
380*d5c09012SAndroid Build Coastguard Worker  // are multi-byte characters in the string, then the length of the
381*d5c09012SAndroid Build Coastguard Worker  // shortened string might be less than the size limit.
382*d5c09012SAndroid Build Coastguard Worker  string value = 1;
383*d5c09012SAndroid Build Coastguard Worker
384*d5c09012SAndroid Build Coastguard Worker  // The number of bytes removed from the original string. If this
385*d5c09012SAndroid Build Coastguard Worker  // value is 0, then the string was not shortened.
386*d5c09012SAndroid Build Coastguard Worker  int32 truncated_byte_count = 2;
387*d5c09012SAndroid Build Coastguard Worker}
388