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