OLD | NEW |
| (Empty) |
1 // This is a generated file (see the discoveryapis_generator project). | |
2 | |
3 library googleapis.tracing.v1; | |
4 | |
5 import 'dart:core' as core; | |
6 import 'dart:async' as async; | |
7 import 'dart:convert' as convert; | |
8 | |
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | |
10 import 'package:http/http.dart' as http; | |
11 | |
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | |
13 ApiRequestError, DetailedApiRequestError; | |
14 | |
15 const core.String USER_AGENT = 'dart-api-client tracing/v1'; | |
16 | |
17 /** Send and retrieve trace data from Google Stackdriver Trace. */ | |
18 class TracingApi { | |
19 /** View and manage your data across Google Cloud Platform services */ | |
20 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | |
21 | |
22 /** Write Trace data for a project or application */ | |
23 static const TraceAppendScope = "https://www.googleapis.com/auth/trace.append"
; | |
24 | |
25 /** Read Trace data for a project or application */ | |
26 static const TraceReadonlyScope = "https://www.googleapis.com/auth/trace.reado
nly"; | |
27 | |
28 | |
29 final commons.ApiRequester _requester; | |
30 | |
31 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester); | |
32 | |
33 TracingApi(http.Client client, {core.String rootUrl: "https://tracing.googleap
is.com/", core.String servicePath: ""}) : | |
34 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | |
35 } | |
36 | |
37 | |
38 class ProjectsResourceApi { | |
39 final commons.ApiRequester _requester; | |
40 | |
41 ProjectsTracesResourceApi get traces => new ProjectsTracesResourceApi(_request
er); | |
42 | |
43 ProjectsResourceApi(commons.ApiRequester client) : | |
44 _requester = client; | |
45 } | |
46 | |
47 | |
48 class ProjectsTracesResourceApi { | |
49 final commons.ApiRequester _requester; | |
50 | |
51 ProjectsTracesResourceApi(commons.ApiRequester client) : | |
52 _requester = client; | |
53 | |
54 /** | |
55 * Sends new spans to Stackdriver Trace or updates existing spans. If the | |
56 * name of a trace that you send matches that of an existing trace, any fields | |
57 * in the existing trace and its spans are overwritten by the provided values, | |
58 * and any new fields provided are merged with the existing trace data. If the | |
59 * name does not match, a new trace is created with given set of spans. | |
60 * | |
61 * [request] - The metadata request object. | |
62 * | |
63 * Request parameters: | |
64 * | |
65 * [parent] - ID of the Cloud project where the trace data is stored. | |
66 * Value must have pattern "^projects/[^/]+$". | |
67 * | |
68 * Completes with a [Empty]. | |
69 * | |
70 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
71 * error. | |
72 * | |
73 * If the used [http.Client] completes with an error when making a REST call, | |
74 * this method will complete with the same error. | |
75 */ | |
76 async.Future<Empty> batchUpdate(BatchUpdateSpansRequest request, core.String p
arent) { | |
77 var _url = null; | |
78 var _queryParams = new core.Map(); | |
79 var _uploadMedia = null; | |
80 var _uploadOptions = null; | |
81 var _downloadOptions = commons.DownloadOptions.Metadata; | |
82 var _body = null; | |
83 | |
84 if (request != null) { | |
85 _body = convert.JSON.encode((request).toJson()); | |
86 } | |
87 if (parent == null) { | |
88 throw new core.ArgumentError("Parameter parent is required."); | |
89 } | |
90 | |
91 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/traces:b
atchUpdate'; | |
92 | |
93 var _response = _requester.request(_url, | |
94 "POST", | |
95 body: _body, | |
96 queryParams: _queryParams, | |
97 uploadOptions: _uploadOptions, | |
98 uploadMedia: _uploadMedia, | |
99 downloadOptions: _downloadOptions); | |
100 return _response.then((data) => new Empty.fromJson(data)); | |
101 } | |
102 | |
103 /** | |
104 * Returns a specific trace. | |
105 * | |
106 * Request parameters: | |
107 * | |
108 * [name] - ID of the trace. Format is `projects/PROJECT_ID/traces/TRACE_ID`. | |
109 * Value must have pattern "^projects/[^/]+/traces/[^/]+$". | |
110 * | |
111 * Completes with a [Trace]. | |
112 * | |
113 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
114 * error. | |
115 * | |
116 * If the used [http.Client] completes with an error when making a REST call, | |
117 * this method will complete with the same error. | |
118 */ | |
119 async.Future<Trace> get(core.String name) { | |
120 var _url = null; | |
121 var _queryParams = new core.Map(); | |
122 var _uploadMedia = null; | |
123 var _uploadOptions = null; | |
124 var _downloadOptions = commons.DownloadOptions.Metadata; | |
125 var _body = null; | |
126 | |
127 if (name == null) { | |
128 throw new core.ArgumentError("Parameter name is required."); | |
129 } | |
130 | |
131 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name'); | |
132 | |
133 var _response = _requester.request(_url, | |
134 "GET", | |
135 body: _body, | |
136 queryParams: _queryParams, | |
137 uploadOptions: _uploadOptions, | |
138 uploadMedia: _uploadMedia, | |
139 downloadOptions: _downloadOptions); | |
140 return _response.then((data) => new Trace.fromJson(data)); | |
141 } | |
142 | |
143 /** | |
144 * Returns of a list of traces that match the specified filter conditions. | |
145 * | |
146 * Request parameters: | |
147 * | |
148 * [parent] - ID of the Cloud project where the trace data is stored. | |
149 * Value must have pattern "^projects/[^/]+$". | |
150 * | |
151 * [filter] - An optional filter for the request. | |
152 * Example: | |
153 * `version_label_key:a some_label:some_label_key` | |
154 * returns traces from version `a` and has `some_label` with `some_label_key`. | |
155 * | |
156 * [endTime] - End of the time interval (inclusive) during which the trace | |
157 * data was | |
158 * collected from the application. | |
159 * | |
160 * [startTime] - Start of the time interval (inclusive) during which the trace | |
161 * data was | |
162 * collected from the application. | |
163 * | |
164 * [pageToken] - Token identifying the page of results to return. If provided, | |
165 * use the | |
166 * value of the `next_page_token` field from a previous request. Optional. | |
167 * | |
168 * [pageSize] - Maximum number of traces to return. If not specified or <= 0, | |
169 * the | |
170 * implementation selects a reasonable value. The implementation may | |
171 * return fewer traces than the requested page size. Optional. | |
172 * | |
173 * [orderBy] - Field used to sort the returned traces. Optional. | |
174 * Can be one of the following: | |
175 * | |
176 * * `trace_id` | |
177 * * `name` (`name` field of root span in the trace) | |
178 * * `duration` (difference between `end_time` and `start_time` fields of | |
179 * the root span) | |
180 * * `start` (`start_time` field of the root span) | |
181 * | |
182 * Descending order can be specified by appending `desc` to the sort field | |
183 * (for example, `name desc`). | |
184 * | |
185 * Only one sort field is permitted. | |
186 * | |
187 * Completes with a [ListTracesResponse]. | |
188 * | |
189 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
190 * error. | |
191 * | |
192 * If the used [http.Client] completes with an error when making a REST call, | |
193 * this method will complete with the same error. | |
194 */ | |
195 async.Future<ListTracesResponse> list(core.String parent, {core.String filter,
core.String endTime, core.String startTime, core.String pageToken, core.int pag
eSize, core.String orderBy}) { | |
196 var _url = null; | |
197 var _queryParams = new core.Map(); | |
198 var _uploadMedia = null; | |
199 var _uploadOptions = null; | |
200 var _downloadOptions = commons.DownloadOptions.Metadata; | |
201 var _body = null; | |
202 | |
203 if (parent == null) { | |
204 throw new core.ArgumentError("Parameter parent is required."); | |
205 } | |
206 if (filter != null) { | |
207 _queryParams["filter"] = [filter]; | |
208 } | |
209 if (endTime != null) { | |
210 _queryParams["endTime"] = [endTime]; | |
211 } | |
212 if (startTime != null) { | |
213 _queryParams["startTime"] = [startTime]; | |
214 } | |
215 if (pageToken != null) { | |
216 _queryParams["pageToken"] = [pageToken]; | |
217 } | |
218 if (pageSize != null) { | |
219 _queryParams["pageSize"] = ["${pageSize}"]; | |
220 } | |
221 if (orderBy != null) { | |
222 _queryParams["orderBy"] = [orderBy]; | |
223 } | |
224 | |
225 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/traces'; | |
226 | |
227 var _response = _requester.request(_url, | |
228 "GET", | |
229 body: _body, | |
230 queryParams: _queryParams, | |
231 uploadOptions: _uploadOptions, | |
232 uploadMedia: _uploadMedia, | |
233 downloadOptions: _downloadOptions); | |
234 return _response.then((data) => new ListTracesResponse.fromJson(data)); | |
235 } | |
236 | |
237 /** | |
238 * Returns a list of spans within a trace. | |
239 * | |
240 * Request parameters: | |
241 * | |
242 * [name] - ID of the trace for which to list child spans. Format is | |
243 * `projects/PROJECT_ID/traces/TRACE_ID`. | |
244 * Value must have pattern "^projects/[^/]+/traces/[^/]+$". | |
245 * | |
246 * [pageToken] - Token identifying the page of results to return. If provided, | |
247 * use the | |
248 * value of the `nextPageToken` field from a previous request. Optional. | |
249 * | |
250 * Completes with a [ListSpansResponse]. | |
251 * | |
252 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
253 * error. | |
254 * | |
255 * If the used [http.Client] completes with an error when making a REST call, | |
256 * this method will complete with the same error. | |
257 */ | |
258 async.Future<ListSpansResponse> listSpans(core.String name, {core.String pageT
oken}) { | |
259 var _url = null; | |
260 var _queryParams = new core.Map(); | |
261 var _uploadMedia = null; | |
262 var _uploadOptions = null; | |
263 var _downloadOptions = commons.DownloadOptions.Metadata; | |
264 var _body = null; | |
265 | |
266 if (name == null) { | |
267 throw new core.ArgumentError("Parameter name is required."); | |
268 } | |
269 if (pageToken != null) { | |
270 _queryParams["pageToken"] = [pageToken]; | |
271 } | |
272 | |
273 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + ':listSpans'
; | |
274 | |
275 var _response = _requester.request(_url, | |
276 "GET", | |
277 body: _body, | |
278 queryParams: _queryParams, | |
279 uploadOptions: _uploadOptions, | |
280 uploadMedia: _uploadMedia, | |
281 downloadOptions: _downloadOptions); | |
282 return _response.then((data) => new ListSpansResponse.fromJson(data)); | |
283 } | |
284 | |
285 } | |
286 | |
287 | |
288 | |
289 /** Text annotation with a set of attributes. */ | |
290 class Annotation { | |
291 /** A set of attributes on the annotation. */ | |
292 core.Map<core.String, AttributeValue> attributes; | |
293 /** A user-supplied message describing the event. */ | |
294 core.String description; | |
295 | |
296 Annotation(); | |
297 | |
298 Annotation.fromJson(core.Map _json) { | |
299 if (_json.containsKey("attributes")) { | |
300 attributes = commons.mapMap(_json["attributes"], (item) => new AttributeVa
lue.fromJson(item)); | |
301 } | |
302 if (_json.containsKey("description")) { | |
303 description = _json["description"]; | |
304 } | |
305 } | |
306 | |
307 core.Map toJson() { | |
308 var _json = new core.Map(); | |
309 if (attributes != null) { | |
310 _json["attributes"] = commons.mapMap(attributes, (item) => (item).toJson()
); | |
311 } | |
312 if (description != null) { | |
313 _json["description"] = description; | |
314 } | |
315 return _json; | |
316 } | |
317 } | |
318 | |
319 /** The allowed types for the value side of an attribute key:value pair. */ | |
320 class AttributeValue { | |
321 /** A boolean value. */ | |
322 core.bool boolValue; | |
323 /** An integer value. */ | |
324 core.String intValue; | |
325 /** A string value. */ | |
326 core.String stringValue; | |
327 | |
328 AttributeValue(); | |
329 | |
330 AttributeValue.fromJson(core.Map _json) { | |
331 if (_json.containsKey("boolValue")) { | |
332 boolValue = _json["boolValue"]; | |
333 } | |
334 if (_json.containsKey("intValue")) { | |
335 intValue = _json["intValue"]; | |
336 } | |
337 if (_json.containsKey("stringValue")) { | |
338 stringValue = _json["stringValue"]; | |
339 } | |
340 } | |
341 | |
342 core.Map toJson() { | |
343 var _json = new core.Map(); | |
344 if (boolValue != null) { | |
345 _json["boolValue"] = boolValue; | |
346 } | |
347 if (intValue != null) { | |
348 _json["intValue"] = intValue; | |
349 } | |
350 if (stringValue != null) { | |
351 _json["stringValue"] = stringValue; | |
352 } | |
353 return _json; | |
354 } | |
355 } | |
356 | |
357 /** The request message for the `BatchUpdateSpans` method. */ | |
358 class BatchUpdateSpansRequest { | |
359 /** A map from trace name to spans to be stored or updated. */ | |
360 core.Map<core.String, SpanUpdates> spanUpdates; | |
361 | |
362 BatchUpdateSpansRequest(); | |
363 | |
364 BatchUpdateSpansRequest.fromJson(core.Map _json) { | |
365 if (_json.containsKey("spanUpdates")) { | |
366 spanUpdates = commons.mapMap(_json["spanUpdates"], (item) => new SpanUpdat
es.fromJson(item)); | |
367 } | |
368 } | |
369 | |
370 core.Map toJson() { | |
371 var _json = new core.Map(); | |
372 if (spanUpdates != null) { | |
373 _json["spanUpdates"] = commons.mapMap(spanUpdates, (item) => (item).toJson
()); | |
374 } | |
375 return _json; | |
376 } | |
377 } | |
378 | |
379 /** | |
380 * A generic empty message that you can re-use to avoid defining duplicated | |
381 * empty messages in your APIs. A typical example is to use it as the request | |
382 * or the response type of an API method. For instance: | |
383 * | |
384 * service Foo { | |
385 * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); | |
386 * } | |
387 * | |
388 * The JSON representation for `Empty` is empty JSON object `{}`. | |
389 */ | |
390 class Empty { | |
391 | |
392 Empty(); | |
393 | |
394 Empty.fromJson(core.Map _json) { | |
395 } | |
396 | |
397 core.Map toJson() { | |
398 var _json = new core.Map(); | |
399 return _json; | |
400 } | |
401 } | |
402 | |
403 /** | |
404 * A pointer from this span to another span in a different `Trace`. Used | |
405 * (for example) in batching operations, where a single batch handler | |
406 * processes multiple requests from different traces. | |
407 */ | |
408 class Link { | |
409 /** The `id` of the linked span. */ | |
410 core.String spanId; | |
411 /** The ID of the parent trace of the linked span. */ | |
412 core.String traceId; | |
413 /** | |
414 * The relationship of the current span relative to the linked span. | |
415 * Possible string values are: | |
416 * - "TYPE_UNSPECIFIED" : The relationship of the two spans is unknown. | |
417 * - "CHILD" : The current span is a child of the linked span. | |
418 * - "PARENT" : The current span is the parent of the linked span. | |
419 */ | |
420 core.String type; | |
421 | |
422 Link(); | |
423 | |
424 Link.fromJson(core.Map _json) { | |
425 if (_json.containsKey("spanId")) { | |
426 spanId = _json["spanId"]; | |
427 } | |
428 if (_json.containsKey("traceId")) { | |
429 traceId = _json["traceId"]; | |
430 } | |
431 if (_json.containsKey("type")) { | |
432 type = _json["type"]; | |
433 } | |
434 } | |
435 | |
436 core.Map toJson() { | |
437 var _json = new core.Map(); | |
438 if (spanId != null) { | |
439 _json["spanId"] = spanId; | |
440 } | |
441 if (traceId != null) { | |
442 _json["traceId"] = traceId; | |
443 } | |
444 if (type != null) { | |
445 _json["type"] = type; | |
446 } | |
447 return _json; | |
448 } | |
449 } | |
450 | |
451 /** The response message for the `ListSpans` method. */ | |
452 class ListSpansResponse { | |
453 /** | |
454 * If defined, indicates that there are more spans that match the request. | |
455 * Pass this as the value of `pageToken` in a subsequent request to retrieve | |
456 * additional spans. | |
457 */ | |
458 core.String nextPageToken; | |
459 /** The requested spans if there are any in the specified trace. */ | |
460 core.List<Span> spans; | |
461 | |
462 ListSpansResponse(); | |
463 | |
464 ListSpansResponse.fromJson(core.Map _json) { | |
465 if (_json.containsKey("nextPageToken")) { | |
466 nextPageToken = _json["nextPageToken"]; | |
467 } | |
468 if (_json.containsKey("spans")) { | |
469 spans = _json["spans"].map((value) => new Span.fromJson(value)).toList(); | |
470 } | |
471 } | |
472 | |
473 core.Map toJson() { | |
474 var _json = new core.Map(); | |
475 if (nextPageToken != null) { | |
476 _json["nextPageToken"] = nextPageToken; | |
477 } | |
478 if (spans != null) { | |
479 _json["spans"] = spans.map((value) => (value).toJson()).toList(); | |
480 } | |
481 return _json; | |
482 } | |
483 } | |
484 | |
485 /** The response message for the `ListTraces` method. */ | |
486 class ListTracesResponse { | |
487 /** | |
488 * If defined, indicates that there are more traces that match the request | |
489 * and that this value should be passed to the next request to continue | |
490 * retrieving additional traces. | |
491 */ | |
492 core.String nextPageToken; | |
493 /** List of trace records returned. */ | |
494 core.List<Trace> traces; | |
495 | |
496 ListTracesResponse(); | |
497 | |
498 ListTracesResponse.fromJson(core.Map _json) { | |
499 if (_json.containsKey("nextPageToken")) { | |
500 nextPageToken = _json["nextPageToken"]; | |
501 } | |
502 if (_json.containsKey("traces")) { | |
503 traces = _json["traces"].map((value) => new Trace.fromJson(value)).toList(
); | |
504 } | |
505 } | |
506 | |
507 core.Map toJson() { | |
508 var _json = new core.Map(); | |
509 if (nextPageToken != null) { | |
510 _json["nextPageToken"] = nextPageToken; | |
511 } | |
512 if (traces != null) { | |
513 _json["traces"] = traces.map((value) => (value).toJson()).toList(); | |
514 } | |
515 return _json; | |
516 } | |
517 } | |
518 | |
519 /** Binary module. */ | |
520 class Module { | |
521 /** | |
522 * Build_id is a unique identifier for the module, | |
523 * usually a hash of its contents | |
524 */ | |
525 core.String buildId; | |
526 /** | |
527 * E.g. main binary, kernel modules, and dynamic libraries | |
528 * such as libc.so, sharedlib.so | |
529 */ | |
530 core.String module; | |
531 | |
532 Module(); | |
533 | |
534 Module.fromJson(core.Map _json) { | |
535 if (_json.containsKey("buildId")) { | |
536 buildId = _json["buildId"]; | |
537 } | |
538 if (_json.containsKey("module")) { | |
539 module = _json["module"]; | |
540 } | |
541 } | |
542 | |
543 core.Map toJson() { | |
544 var _json = new core.Map(); | |
545 if (buildId != null) { | |
546 _json["buildId"] = buildId; | |
547 } | |
548 if (module != null) { | |
549 _json["module"] = module; | |
550 } | |
551 return _json; | |
552 } | |
553 } | |
554 | |
555 /** An event describing an RPC message sent/received on the network. */ | |
556 class NetworkEvent { | |
557 /** | |
558 * If available, this is the kernel time: | |
559 * | |
560 * * For sent messages, this is the time at which the first bit was sent. | |
561 * * For received messages, this is the time at which the last bit was | |
562 * received. | |
563 */ | |
564 core.String kernelTime; | |
565 /** An identifier for the message, which must be unique in this span. */ | |
566 core.String messageId; | |
567 /** The number of bytes sent or received. */ | |
568 core.String messageSize; | |
569 /** | |
570 * Type of NetworkEvent. Indicates whether the RPC message was sent or | |
571 * received. | |
572 * Possible string values are: | |
573 * - "TYPE_UNSPECIFIED" : Unknown event type. | |
574 * - "SENT" : Indicates a sent RPC message. | |
575 * - "RECV" : Indicates a received RPC message. | |
576 */ | |
577 core.String type; | |
578 | |
579 NetworkEvent(); | |
580 | |
581 NetworkEvent.fromJson(core.Map _json) { | |
582 if (_json.containsKey("kernelTime")) { | |
583 kernelTime = _json["kernelTime"]; | |
584 } | |
585 if (_json.containsKey("messageId")) { | |
586 messageId = _json["messageId"]; | |
587 } | |
588 if (_json.containsKey("messageSize")) { | |
589 messageSize = _json["messageSize"]; | |
590 } | |
591 if (_json.containsKey("type")) { | |
592 type = _json["type"]; | |
593 } | |
594 } | |
595 | |
596 core.Map toJson() { | |
597 var _json = new core.Map(); | |
598 if (kernelTime != null) { | |
599 _json["kernelTime"] = kernelTime; | |
600 } | |
601 if (messageId != null) { | |
602 _json["messageId"] = messageId; | |
603 } | |
604 if (messageSize != null) { | |
605 _json["messageSize"] = messageSize; | |
606 } | |
607 if (type != null) { | |
608 _json["type"] = type; | |
609 } | |
610 return _json; | |
611 } | |
612 } | |
613 | |
614 /** | |
615 * A span represents a single operation within a trace. Spans can be nested | |
616 * to form a trace tree. Often, a trace contains a root span that | |
617 * describes the end-to-end latency and, optionally, one or more subspans for | |
618 * its sub-operations. (A trace could alternatively contain multiple root spans, | |
619 * or none at all.) Spans do not need to be contiguous. There may be gaps | |
620 * and/or overlaps between spans in a trace. | |
621 */ | |
622 class Span { | |
623 /** | |
624 * Properties of a span in key:value format. The maximum length for the | |
625 * key is 128 characters. The value can be a string (up to 2000 characters), | |
626 * int, or boolean. | |
627 * | |
628 * Some common pair examples: | |
629 * | |
630 * "/instance_id": "my-instance" | |
631 * "/zone": "us-central1-a" | |
632 * "/grpc/peer_address": "ip:port" (dns, etc.) | |
633 * "/grpc/deadline": "Duration" | |
634 * "/http/user_agent" | |
635 * "/http/request_bytes": 300 | |
636 * "/http/response_bytes": 1200 | |
637 * "/http/url": google.com/apis | |
638 * "abc.com/myattribute": true | |
639 */ | |
640 core.Map<core.String, AttributeValue> attributes; | |
641 /** True if this span has a remote parent (is an RPC server span). */ | |
642 core.bool hasRemoteParent; | |
643 /** | |
644 * Identifier for the span. Must be a 64-bit integer other than 0 and | |
645 * unique within a trace. | |
646 */ | |
647 core.String id; | |
648 /** | |
649 * A collection of links, which are references from this span to another span | |
650 * in a different trace. | |
651 */ | |
652 core.List<Link> links; | |
653 /** | |
654 * End time of the span. | |
655 * On the client side, this is the local machine clock time at which the span | |
656 * execution was ended; on the server | |
657 * side, this is the time at which the server application handler stopped | |
658 * running. | |
659 */ | |
660 core.String localEndTime; | |
661 /** | |
662 * Start time of the span. | |
663 * On the client side, this is the local machine clock time at which the span | |
664 * execution was started; on the server | |
665 * side, this is the time at which the server application handler started | |
666 * running. | |
667 */ | |
668 core.String localStartTime; | |
669 /** | |
670 * Name of the span. The span name is sanitized and displayed in the | |
671 * Stackdriver Trace tool in the {% dynamic print site_values.console_name %}. | |
672 * The name may be a method name or some other per-call site name. | |
673 * For the same executable and the same call point, a best practice is | |
674 * to use a consistent name, which makes it easier to correlate | |
675 * cross-trace spans. | |
676 */ | |
677 core.String name; | |
678 /** | |
679 * ID of the parent span. If this is a root span, the value must be `0` or | |
680 * empty. | |
681 */ | |
682 core.String parentId; | |
683 /** Stack trace captured at the start of the span. */ | |
684 StackTrace stackTrace; | |
685 /** An optional final status for this span. */ | |
686 Status status; | |
687 /** | |
688 * A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation | |
689 * on the span, consisting of either user-supplied key:value pairs, or | |
690 * details of an RPC message sent/received on the network. | |
691 */ | |
692 core.List<TimeEvent> timeEvents; | |
693 | |
694 Span(); | |
695 | |
696 Span.fromJson(core.Map _json) { | |
697 if (_json.containsKey("attributes")) { | |
698 attributes = commons.mapMap(_json["attributes"], (item) => new AttributeVa
lue.fromJson(item)); | |
699 } | |
700 if (_json.containsKey("hasRemoteParent")) { | |
701 hasRemoteParent = _json["hasRemoteParent"]; | |
702 } | |
703 if (_json.containsKey("id")) { | |
704 id = _json["id"]; | |
705 } | |
706 if (_json.containsKey("links")) { | |
707 links = _json["links"].map((value) => new Link.fromJson(value)).toList(); | |
708 } | |
709 if (_json.containsKey("localEndTime")) { | |
710 localEndTime = _json["localEndTime"]; | |
711 } | |
712 if (_json.containsKey("localStartTime")) { | |
713 localStartTime = _json["localStartTime"]; | |
714 } | |
715 if (_json.containsKey("name")) { | |
716 name = _json["name"]; | |
717 } | |
718 if (_json.containsKey("parentId")) { | |
719 parentId = _json["parentId"]; | |
720 } | |
721 if (_json.containsKey("stackTrace")) { | |
722 stackTrace = new StackTrace.fromJson(_json["stackTrace"]); | |
723 } | |
724 if (_json.containsKey("status")) { | |
725 status = new Status.fromJson(_json["status"]); | |
726 } | |
727 if (_json.containsKey("timeEvents")) { | |
728 timeEvents = _json["timeEvents"].map((value) => new TimeEvent.fromJson(val
ue)).toList(); | |
729 } | |
730 } | |
731 | |
732 core.Map toJson() { | |
733 var _json = new core.Map(); | |
734 if (attributes != null) { | |
735 _json["attributes"] = commons.mapMap(attributes, (item) => (item).toJson()
); | |
736 } | |
737 if (hasRemoteParent != null) { | |
738 _json["hasRemoteParent"] = hasRemoteParent; | |
739 } | |
740 if (id != null) { | |
741 _json["id"] = id; | |
742 } | |
743 if (links != null) { | |
744 _json["links"] = links.map((value) => (value).toJson()).toList(); | |
745 } | |
746 if (localEndTime != null) { | |
747 _json["localEndTime"] = localEndTime; | |
748 } | |
749 if (localStartTime != null) { | |
750 _json["localStartTime"] = localStartTime; | |
751 } | |
752 if (name != null) { | |
753 _json["name"] = name; | |
754 } | |
755 if (parentId != null) { | |
756 _json["parentId"] = parentId; | |
757 } | |
758 if (stackTrace != null) { | |
759 _json["stackTrace"] = (stackTrace).toJson(); | |
760 } | |
761 if (status != null) { | |
762 _json["status"] = (status).toJson(); | |
763 } | |
764 if (timeEvents != null) { | |
765 _json["timeEvents"] = timeEvents.map((value) => (value).toJson()).toList()
; | |
766 } | |
767 return _json; | |
768 } | |
769 } | |
770 | |
771 /** Collection of spans to update. */ | |
772 class SpanUpdates { | |
773 /** A collection of spans. */ | |
774 core.List<Span> spans; | |
775 | |
776 SpanUpdates(); | |
777 | |
778 SpanUpdates.fromJson(core.Map _json) { | |
779 if (_json.containsKey("spans")) { | |
780 spans = _json["spans"].map((value) => new Span.fromJson(value)).toList(); | |
781 } | |
782 } | |
783 | |
784 core.Map toJson() { | |
785 var _json = new core.Map(); | |
786 if (spans != null) { | |
787 _json["spans"] = spans.map((value) => (value).toJson()).toList(); | |
788 } | |
789 return _json; | |
790 } | |
791 } | |
792 | |
793 /** Represents a single stack frame in a stack trace. */ | |
794 class StackFrame { | |
795 /** | |
796 * Column number is important in JavaScript (anonymous functions). | |
797 * May not be available in some languages. | |
798 */ | |
799 core.String columnNumber; | |
800 /** The filename of the file containing this frame. */ | |
801 core.String fileName; | |
802 /** | |
803 * The fully-qualified name that uniquely identifies this function or | |
804 * method. | |
805 */ | |
806 core.String functionName; | |
807 /** Line number of the frame. */ | |
808 core.String lineNumber; | |
809 /** Binary module the code is loaded from. */ | |
810 Module loadModule; | |
811 /** | |
812 * Used when the function name is | |
813 * [mangled](http://www.avabodh.com/cxxin/namemangling.html). May be | |
814 * fully-qualified. | |
815 */ | |
816 core.String originalFunctionName; | |
817 /** The version of the deployed source code. */ | |
818 core.String sourceVersion; | |
819 | |
820 StackFrame(); | |
821 | |
822 StackFrame.fromJson(core.Map _json) { | |
823 if (_json.containsKey("columnNumber")) { | |
824 columnNumber = _json["columnNumber"]; | |
825 } | |
826 if (_json.containsKey("fileName")) { | |
827 fileName = _json["fileName"]; | |
828 } | |
829 if (_json.containsKey("functionName")) { | |
830 functionName = _json["functionName"]; | |
831 } | |
832 if (_json.containsKey("lineNumber")) { | |
833 lineNumber = _json["lineNumber"]; | |
834 } | |
835 if (_json.containsKey("loadModule")) { | |
836 loadModule = new Module.fromJson(_json["loadModule"]); | |
837 } | |
838 if (_json.containsKey("originalFunctionName")) { | |
839 originalFunctionName = _json["originalFunctionName"]; | |
840 } | |
841 if (_json.containsKey("sourceVersion")) { | |
842 sourceVersion = _json["sourceVersion"]; | |
843 } | |
844 } | |
845 | |
846 core.Map toJson() { | |
847 var _json = new core.Map(); | |
848 if (columnNumber != null) { | |
849 _json["columnNumber"] = columnNumber; | |
850 } | |
851 if (fileName != null) { | |
852 _json["fileName"] = fileName; | |
853 } | |
854 if (functionName != null) { | |
855 _json["functionName"] = functionName; | |
856 } | |
857 if (lineNumber != null) { | |
858 _json["lineNumber"] = lineNumber; | |
859 } | |
860 if (loadModule != null) { | |
861 _json["loadModule"] = (loadModule).toJson(); | |
862 } | |
863 if (originalFunctionName != null) { | |
864 _json["originalFunctionName"] = originalFunctionName; | |
865 } | |
866 if (sourceVersion != null) { | |
867 _json["sourceVersion"] = sourceVersion; | |
868 } | |
869 return _json; | |
870 } | |
871 } | |
872 | |
873 /** StackTrace collected in a trace. */ | |
874 class StackTrace { | |
875 /** Stack frames of this stack trace. */ | |
876 core.List<StackFrame> stackFrame; | |
877 /** | |
878 * The hash ID is used to conserve network bandwidth for duplicate | |
879 * stack traces within a single trace. | |
880 * | |
881 * Often multiple spans will have identical stack traces. | |
882 * The first occurance of a stack trace should contain both the | |
883 * `stackFrame` content and a value in `stackTraceHashId`. | |
884 * | |
885 * Subsequent spans within the same request can refer | |
886 * to that stack trace by only setting `stackTraceHashId`. | |
887 */ | |
888 core.String stackTraceHashId; | |
889 | |
890 StackTrace(); | |
891 | |
892 StackTrace.fromJson(core.Map _json) { | |
893 if (_json.containsKey("stackFrame")) { | |
894 stackFrame = _json["stackFrame"].map((value) => new StackFrame.fromJson(va
lue)).toList(); | |
895 } | |
896 if (_json.containsKey("stackTraceHashId")) { | |
897 stackTraceHashId = _json["stackTraceHashId"]; | |
898 } | |
899 } | |
900 | |
901 core.Map toJson() { | |
902 var _json = new core.Map(); | |
903 if (stackFrame != null) { | |
904 _json["stackFrame"] = stackFrame.map((value) => (value).toJson()).toList()
; | |
905 } | |
906 if (stackTraceHashId != null) { | |
907 _json["stackTraceHashId"] = stackTraceHashId; | |
908 } | |
909 return _json; | |
910 } | |
911 } | |
912 | |
913 /** | |
914 * The `Status` type defines a logical error model that is suitable for | |
915 * different | |
916 * programming environments, including REST APIs and RPC APIs. It is used by | |
917 * [gRPC](https://github.com/grpc). The error model is designed to be: | |
918 * | |
919 * - Simple to use and understand for most users | |
920 * - Flexible enough to meet unexpected needs | |
921 * | |
922 * # Overview | |
923 * | |
924 * The `Status` message contains three pieces of data: error code, error | |
925 * message, | |
926 * and error details. The error code should be an enum value of | |
927 * google.rpc.Code, but it may accept additional error codes if needed. The | |
928 * error message should be a developer-facing English message that helps | |
929 * developers *understand* and *resolve* the error. If a localized user-facing | |
930 * error message is needed, put the localized message in the error details or | |
931 * localize it in the client. The optional error details may contain arbitrary | |
932 * information about the error. There is a predefined set of error detail types | |
933 * in the package `google.rpc` which can be used for common error conditions. | |
934 * | |
935 * # Language mapping | |
936 * | |
937 * The `Status` message is the logical representation of the error model, but it | |
938 * is not necessarily the actual wire format. When the `Status` message is | |
939 * exposed in different client libraries and different wire protocols, it can be | |
940 * mapped differently. For example, it will likely be mapped to some exceptions | |
941 * in Java, but more likely mapped to some error codes in C. | |
942 * | |
943 * # Other uses | |
944 * | |
945 * The error model and the `Status` message can be used in a variety of | |
946 * environments, either with or without APIs, to provide a | |
947 * consistent developer experience across different environments. | |
948 * | |
949 * Example uses of this error model include: | |
950 * | |
951 * - Partial errors. If a service needs to return partial errors to the client, | |
952 * it may embed the `Status` in the normal response to indicate the partial | |
953 * errors. | |
954 * | |
955 * - Workflow errors. A typical workflow has multiple steps. Each step may | |
956 * have a `Status` message for error reporting purpose. | |
957 * | |
958 * - Batch operations. If a client uses batch request and batch response, the | |
959 * `Status` message should be used directly inside batch response, one for | |
960 * each error sub-response. | |
961 * | |
962 * - Asynchronous operations. If an API call embeds asynchronous operation | |
963 * results in its response, the status of those operations should be | |
964 * represented directly using the `Status` message. | |
965 * | |
966 * - Logging. If some API errors are stored in logs, the message `Status` could | |
967 * be used directly after any stripping needed for security/privacy reasons. | |
968 */ | |
969 class Status { | |
970 /** The status code, which should be an enum value of google.rpc.Code. */ | |
971 core.int code; | |
972 /** | |
973 * A list of messages that carry the error details. There will be a | |
974 * common set of message types for APIs to use. | |
975 * | |
976 * The values for Object must be JSON objects. It can consist of `num`, | |
977 * `String`, `bool` and `null` as well as `Map` and `List` values. | |
978 */ | |
979 core.List<core.Map<core.String, core.Object>> details; | |
980 /** | |
981 * A developer-facing error message, which should be in English. Any | |
982 * user-facing error message should be localized and sent in the | |
983 * google.rpc.Status.details field, or localized by the client. | |
984 */ | |
985 core.String message; | |
986 | |
987 Status(); | |
988 | |
989 Status.fromJson(core.Map _json) { | |
990 if (_json.containsKey("code")) { | |
991 code = _json["code"]; | |
992 } | |
993 if (_json.containsKey("details")) { | |
994 details = _json["details"]; | |
995 } | |
996 if (_json.containsKey("message")) { | |
997 message = _json["message"]; | |
998 } | |
999 } | |
1000 | |
1001 core.Map toJson() { | |
1002 var _json = new core.Map(); | |
1003 if (code != null) { | |
1004 _json["code"] = code; | |
1005 } | |
1006 if (details != null) { | |
1007 _json["details"] = details; | |
1008 } | |
1009 if (message != null) { | |
1010 _json["message"] = message; | |
1011 } | |
1012 return _json; | |
1013 } | |
1014 } | |
1015 | |
1016 /** A time-stamped annotation in the Span. */ | |
1017 class TimeEvent { | |
1018 /** One or more key:value pairs. */ | |
1019 Annotation annotation; | |
1020 /** The timestamp indicating the time the event occurred. */ | |
1021 core.String localTime; | |
1022 /** An event describing an RPC message sent/received on the network. */ | |
1023 NetworkEvent networkEvent; | |
1024 | |
1025 TimeEvent(); | |
1026 | |
1027 TimeEvent.fromJson(core.Map _json) { | |
1028 if (_json.containsKey("annotation")) { | |
1029 annotation = new Annotation.fromJson(_json["annotation"]); | |
1030 } | |
1031 if (_json.containsKey("localTime")) { | |
1032 localTime = _json["localTime"]; | |
1033 } | |
1034 if (_json.containsKey("networkEvent")) { | |
1035 networkEvent = new NetworkEvent.fromJson(_json["networkEvent"]); | |
1036 } | |
1037 } | |
1038 | |
1039 core.Map toJson() { | |
1040 var _json = new core.Map(); | |
1041 if (annotation != null) { | |
1042 _json["annotation"] = (annotation).toJson(); | |
1043 } | |
1044 if (localTime != null) { | |
1045 _json["localTime"] = localTime; | |
1046 } | |
1047 if (networkEvent != null) { | |
1048 _json["networkEvent"] = (networkEvent).toJson(); | |
1049 } | |
1050 return _json; | |
1051 } | |
1052 } | |
1053 | |
1054 /** | |
1055 * A trace describes how long it takes for an application to perform some | |
1056 * operations. It consists of a set of spans, each representing | |
1057 * an operation and including time information and operation details. | |
1058 */ | |
1059 class Trace { | |
1060 /** | |
1061 * A globally unique identifier for the trace in the format | |
1062 * `projects/PROJECT_NUMBER/traces/TRACE_ID`. `TRACE_ID` is a base16-encoded | |
1063 * string of a 128-bit number and is required to be 32 char long. | |
1064 */ | |
1065 core.String name; | |
1066 | |
1067 Trace(); | |
1068 | |
1069 Trace.fromJson(core.Map _json) { | |
1070 if (_json.containsKey("name")) { | |
1071 name = _json["name"]; | |
1072 } | |
1073 } | |
1074 | |
1075 core.Map toJson() { | |
1076 var _json = new core.Map(); | |
1077 if (name != null) { | |
1078 _json["name"] = name; | |
1079 } | |
1080 return _json; | |
1081 } | |
1082 } | |
OLD | NEW |