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