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