gcp_sdk_devtools_cloudtrace_v2/model.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate lazy_static;
extern crate reqwest;
extern crate rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
/// A span represents a single operation within a trace. Spans can be
/// nested to form a trace tree. Often, a trace contains a root span
/// that describes the end-to-end latency, and one or more subspans for
/// its sub-operations.
///
/// A trace can also contain multiple root spans, or none at all.
/// Spans do not need to be contiguous. There might be
/// gaps or overlaps between spans in a trace.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Span {
/// Required. The resource name of the span in the following format:
///
/// * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]`
///
/// `[TRACE_ID]` is a unique identifier for a trace within a project;
/// it is a 32-character hexadecimal encoding of a 16-byte array. It should
/// not be zero.
///
/// `[SPAN_ID]` is a unique identifier for a span within a trace; it
/// is a 16-character hexadecimal encoding of an 8-byte array. It should not
/// be zero.
/// .
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
/// Required. The `[SPAN_ID]` portion of the span's resource name.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub span_id: std::string::String,
/// The `[SPAN_ID]` of this span's parent span. If this is a root span,
/// then this field must be empty.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent_span_id: std::string::String,
/// Required. A description of the span's operation (up to 128 bytes).
/// Cloud Trace displays the description in the
/// Cloud console.
/// For example, the display name can be a qualified method name or a file name
/// and a line number where the operation is called. A best practice is to use
/// the same display name within an application and at the same call point.
/// This makes it easier to correlate spans in different traces.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub display_name: std::option::Option<crate::model::TruncatableString>,
/// Required. The start time of the span. On the client side, this is the time
/// kept by the local machine where the span execution starts. On the server
/// side, this is the time when the server's application handler starts
/// running.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub start_time: std::option::Option<wkt::Timestamp>,
/// Required. The end time of the span. On the client side, this is the time
/// kept by the local machine where the span execution ends. On the server
/// side, this is the time when the server application handler stops running.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub end_time: std::option::Option<wkt::Timestamp>,
/// A set of attributes on the span. You can have up to 32 attributes per
/// span.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub attributes: std::option::Option<crate::model::span::Attributes>,
/// Stack trace captured at the start of the span.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub stack_trace: std::option::Option<crate::model::StackTrace>,
/// A set of time events. You can have up to 32 annotations and 128 message
/// events per span.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub time_events: std::option::Option<crate::model::span::TimeEvents>,
/// Links associated with the span. You can have up to 128 links per Span.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub links: std::option::Option<crate::model::span::Links>,
/// Optional. The final status for this span.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub status: std::option::Option<rpc::model::Status>,
/// Optional. Set this parameter to indicate whether this span is in
/// the same process as its parent. If you do not set this parameter,
/// Trace is unable to take advantage of this helpful information.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub same_process_as_parent_span: std::option::Option<wkt::BoolValue>,
/// Optional. The number of child spans that were generated while this span
/// was active. If set, allows implementation to detect missing child spans.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub child_span_count: std::option::Option<wkt::Int32Value>,
/// Optional. Distinguishes between spans generated in a particular context.
/// For example, two spans with the same name may be distinguished using
/// `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call.
pub span_kind: crate::model::span::SpanKind,
}
impl Span {
/// Sets the value of [name][crate::model::Span::name].
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [span_id][crate::model::Span::span_id].
pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.span_id = v.into();
self
}
/// Sets the value of [parent_span_id][crate::model::Span::parent_span_id].
pub fn set_parent_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent_span_id = v.into();
self
}
/// Sets the value of [display_name][crate::model::Span::display_name].
pub fn set_display_name<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [start_time][crate::model::Span::start_time].
pub fn set_start_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.start_time = v.into();
self
}
/// Sets the value of [end_time][crate::model::Span::end_time].
pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.end_time = v.into();
self
}
/// Sets the value of [attributes][crate::model::Span::attributes].
pub fn set_attributes<
T: std::convert::Into<std::option::Option<crate::model::span::Attributes>>,
>(
mut self,
v: T,
) -> Self {
self.attributes = v.into();
self
}
/// Sets the value of [stack_trace][crate::model::Span::stack_trace].
pub fn set_stack_trace<T: std::convert::Into<std::option::Option<crate::model::StackTrace>>>(
mut self,
v: T,
) -> Self {
self.stack_trace = v.into();
self
}
/// Sets the value of [time_events][crate::model::Span::time_events].
pub fn set_time_events<
T: std::convert::Into<std::option::Option<crate::model::span::TimeEvents>>,
>(
mut self,
v: T,
) -> Self {
self.time_events = v.into();
self
}
/// Sets the value of [links][crate::model::Span::links].
pub fn set_links<T: std::convert::Into<std::option::Option<crate::model::span::Links>>>(
mut self,
v: T,
) -> Self {
self.links = v.into();
self
}
/// Sets the value of [status][crate::model::Span::status].
pub fn set_status<T: std::convert::Into<std::option::Option<rpc::model::Status>>>(
mut self,
v: T,
) -> Self {
self.status = v.into();
self
}
/// Sets the value of [same_process_as_parent_span][crate::model::Span::same_process_as_parent_span].
pub fn set_same_process_as_parent_span<
T: std::convert::Into<std::option::Option<wkt::BoolValue>>,
>(
mut self,
v: T,
) -> Self {
self.same_process_as_parent_span = v.into();
self
}
/// Sets the value of [child_span_count][crate::model::Span::child_span_count].
pub fn set_child_span_count<T: std::convert::Into<std::option::Option<wkt::Int32Value>>>(
mut self,
v: T,
) -> Self {
self.child_span_count = v.into();
self
}
/// Sets the value of [span_kind][crate::model::Span::span_kind].
pub fn set_span_kind<T: std::convert::Into<crate::model::span::SpanKind>>(
mut self,
v: T,
) -> Self {
self.span_kind = v.into();
self
}
}
impl wkt::message::Message for Span {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span"
}
}
/// Defines additional types related to Span
pub mod span {
#[allow(unused_imports)]
use super::*;
/// A set of attributes as key-value pairs.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Attributes {
/// A set of attributes. Each attribute's key can be up to 128 bytes
/// long. The value can be a string up to 256 bytes, a signed 64-bit integer,
/// or the boolean values `true` or `false`. For example:
///
/// ```norust
/// "/instance_id": { "string_value": { "value": "my-instance" } }
/// "/http/request_bytes": { "int_value": 300 }
/// "abc.com/myattribute": { "bool_value": false }
/// ```
#[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
pub attribute_map:
std::collections::HashMap<std::string::String, crate::model::AttributeValue>,
/// The number of attributes that were discarded. Attributes can be discarded
/// because their keys are too long or because there are too many attributes.
/// If this value is 0 then all attributes are valid.
pub dropped_attributes_count: i32,
}
impl Attributes {
/// Sets the value of [dropped_attributes_count][crate::model::span::Attributes::dropped_attributes_count].
pub fn set_dropped_attributes_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.dropped_attributes_count = v.into();
self
}
/// Sets the value of [attribute_map][crate::model::span::Attributes::attribute_map].
pub fn set_attribute_map<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::AttributeValue>,
{
use std::iter::Iterator;
self.attribute_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Attributes {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.Attributes"
}
}
/// A time-stamped annotation or message event in the Span.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct TimeEvent {
/// The timestamp indicating the time the event occurred.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub time: std::option::Option<wkt::Timestamp>,
/// A `TimeEvent` can contain either an `Annotation` object or a
/// `MessageEvent` object, but not both.
#[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
pub value: std::option::Option<crate::model::span::time_event::Value>,
}
impl TimeEvent {
/// Sets the value of [time][crate::model::span::TimeEvent::time].
pub fn set_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.time = v.into();
self
}
/// Sets the value of `value`.
pub fn set_value<
T: std::convert::Into<std::option::Option<crate::model::span::time_event::Value>>,
>(
mut self,
v: T,
) -> Self {
self.value = v.into();
self
}
/// The value of [value][crate::model::span::TimeEvent::value]
/// if it holds a `Annotation`, `None` if the field is not set or
/// holds a different branch.
pub fn get_annotation(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::Annotation>>
{
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::span::time_event::Value::Annotation(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// The value of [value][crate::model::span::TimeEvent::value]
/// if it holds a `MessageEvent`, `None` if the field is not set or
/// holds a different branch.
pub fn get_message_event(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::MessageEvent>>
{
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::span::time_event::Value::MessageEvent(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [value][crate::model::span::TimeEvent::value]
/// to hold a `Annotation`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
pub fn set_annotation<
T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::Annotation>>,
>(
mut self,
v: T,
) -> Self {
self.value = std::option::Option::Some(
crate::model::span::time_event::Value::Annotation(v.into()),
);
self
}
/// Sets the value of [value][crate::model::span::TimeEvent::value]
/// to hold a `MessageEvent`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
pub fn set_message_event<
T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::MessageEvent>>,
>(
mut self,
v: T,
) -> Self {
self.value = std::option::Option::Some(
crate::model::span::time_event::Value::MessageEvent(v.into()),
);
self
}
}
impl wkt::message::Message for TimeEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent"
}
}
/// Defines additional types related to TimeEvent
pub mod time_event {
#[allow(unused_imports)]
use super::*;
/// Text annotation with a set of attributes.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Annotation {
/// A user-supplied message describing the event. The maximum length for
/// the description is 256 bytes.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub description: std::option::Option<crate::model::TruncatableString>,
/// A set of attributes on the annotation. You can have up to 4 attributes
/// per Annotation.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub attributes: std::option::Option<crate::model::span::Attributes>,
}
impl Annotation {
/// Sets the value of [description][crate::model::span::time_event::Annotation::description].
pub fn set_description<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.description = v.into();
self
}
/// Sets the value of [attributes][crate::model::span::time_event::Annotation::attributes].
pub fn set_attributes<
T: std::convert::Into<std::option::Option<crate::model::span::Attributes>>,
>(
mut self,
v: T,
) -> Self {
self.attributes = v.into();
self
}
}
impl wkt::message::Message for Annotation {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation"
}
}
/// An event describing a message sent/received between Spans.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct MessageEvent {
/// Type of MessageEvent. Indicates whether the message was sent or
/// received.
#[serde(rename = "type")]
pub r#type: crate::model::span::time_event::message_event::Type,
/// An identifier for the MessageEvent's message that can be used to match
/// `SENT` and `RECEIVED` MessageEvents.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub id: i64,
/// The number of uncompressed bytes sent or received.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub uncompressed_size_bytes: i64,
/// The number of compressed bytes sent or received. If missing, the
/// compressed size is assumed to be the same size as the uncompressed
/// size.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub compressed_size_bytes: i64,
}
impl MessageEvent {
/// Sets the value of [r#type][crate::model::span::time_event::MessageEvent::type].
pub fn set_type<
T: std::convert::Into<crate::model::span::time_event::message_event::Type>,
>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [id][crate::model::span::time_event::MessageEvent::id].
pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [uncompressed_size_bytes][crate::model::span::time_event::MessageEvent::uncompressed_size_bytes].
pub fn set_uncompressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.uncompressed_size_bytes = v.into();
self
}
/// Sets the value of [compressed_size_bytes][crate::model::span::time_event::MessageEvent::compressed_size_bytes].
pub fn set_compressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.compressed_size_bytes = v.into();
self
}
}
impl wkt::message::Message for MessageEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent"
}
}
/// Defines additional types related to MessageEvent
pub mod message_event {
#[allow(unused_imports)]
use super::*;
/// Indicates whether the message was sent or received.
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Type(std::borrow::Cow<'static, str>);
impl Type {
/// Creates a new Type instance.
pub const fn new(v: &'static str) -> Self {
Self(std::borrow::Cow::Borrowed(v))
}
/// Gets the enum value.
pub fn value(&self) -> &str {
&self.0
}
}
/// Useful constants to work with [Type](Type)
pub mod r#type {
use super::Type;
/// Unknown event type.
pub const TYPE_UNSPECIFIED: Type = Type::new("TYPE_UNSPECIFIED");
/// Indicates a sent message.
pub const SENT: Type = Type::new("SENT");
/// Indicates a received message.
pub const RECEIVED: Type = Type::new("RECEIVED");
}
impl std::convert::From<std::string::String> for Type {
fn from(value: std::string::String) -> Self {
Self(std::borrow::Cow::Owned(value))
}
}
}
/// A `TimeEvent` can contain either an `Annotation` object or a
/// `MessageEvent` object, but not both.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub enum Value {
/// Text annotation with a set of attributes.
Annotation(std::boxed::Box<crate::model::span::time_event::Annotation>),
/// An event describing a message sent/received between Spans.
MessageEvent(std::boxed::Box<crate::model::span::time_event::MessageEvent>),
}
}
/// A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation
/// on the span, consisting of either user-supplied key:value pairs, or
/// details of a message sent/received between Spans.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct TimeEvents {
/// A collection of `TimeEvent`s.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub time_event: std::vec::Vec<crate::model::span::TimeEvent>,
/// The number of dropped annotations in all the included time events.
/// If the value is 0, then no annotations were dropped.
pub dropped_annotations_count: i32,
/// The number of dropped message events in all the included time events.
/// If the value is 0, then no message events were dropped.
pub dropped_message_events_count: i32,
}
impl TimeEvents {
/// Sets the value of [dropped_annotations_count][crate::model::span::TimeEvents::dropped_annotations_count].
pub fn set_dropped_annotations_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.dropped_annotations_count = v.into();
self
}
/// Sets the value of [dropped_message_events_count][crate::model::span::TimeEvents::dropped_message_events_count].
pub fn set_dropped_message_events_count<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.dropped_message_events_count = v.into();
self
}
/// Sets the value of [time_event][crate::model::span::TimeEvents::time_event].
pub fn set_time_event<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::span::TimeEvent>,
{
use std::iter::Iterator;
self.time_event = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TimeEvents {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvents"
}
}
/// A pointer from the current span to another span in the same trace or in a
/// different trace. For example, this can be used in batching operations,
/// where a single batch handler processes multiple requests from different
/// traces or when the handler receives a request from a different project.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Link {
/// The `[TRACE_ID]` for a trace within a project.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub trace_id: std::string::String,
/// The `[SPAN_ID]` for a span within a trace.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub span_id: std::string::String,
/// The relationship of the current span relative to the linked span.
#[serde(rename = "type")]
pub r#type: crate::model::span::link::Type,
/// A set of attributes on the link. Up to 32 attributes can be
/// specified per link.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub attributes: std::option::Option<crate::model::span::Attributes>,
}
impl Link {
/// Sets the value of [trace_id][crate::model::span::Link::trace_id].
pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.trace_id = v.into();
self
}
/// Sets the value of [span_id][crate::model::span::Link::span_id].
pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.span_id = v.into();
self
}
/// Sets the value of [r#type][crate::model::span::Link::type].
pub fn set_type<T: std::convert::Into<crate::model::span::link::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [attributes][crate::model::span::Link::attributes].
pub fn set_attributes<
T: std::convert::Into<std::option::Option<crate::model::span::Attributes>>,
>(
mut self,
v: T,
) -> Self {
self.attributes = v.into();
self
}
}
impl wkt::message::Message for Link {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.Link"
}
}
/// Defines additional types related to Link
pub mod link {
#[allow(unused_imports)]
use super::*;
/// The relationship of the current span relative to the linked span: child,
/// parent, or unspecified.
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Type(std::borrow::Cow<'static, str>);
impl Type {
/// Creates a new Type instance.
pub const fn new(v: &'static str) -> Self {
Self(std::borrow::Cow::Borrowed(v))
}
/// Gets the enum value.
pub fn value(&self) -> &str {
&self.0
}
}
/// Useful constants to work with [Type](Type)
pub mod r#type {
use super::Type;
/// The relationship of the two spans is unknown.
pub const TYPE_UNSPECIFIED: Type = Type::new("TYPE_UNSPECIFIED");
/// The linked span is a child of the current span.
pub const CHILD_LINKED_SPAN: Type = Type::new("CHILD_LINKED_SPAN");
/// The linked span is a parent of the current span.
pub const PARENT_LINKED_SPAN: Type = Type::new("PARENT_LINKED_SPAN");
}
impl std::convert::From<std::string::String> for Type {
fn from(value: std::string::String) -> Self {
Self(std::borrow::Cow::Owned(value))
}
}
}
/// A collection of links, which are references from this span to a span
/// in the same or different trace.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Links {
/// A collection of links.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub link: std::vec::Vec<crate::model::span::Link>,
/// The number of dropped links after the maximum size was enforced. If
/// this value is 0, then no links were dropped.
pub dropped_links_count: i32,
}
impl Links {
/// Sets the value of [dropped_links_count][crate::model::span::Links::dropped_links_count].
pub fn set_dropped_links_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.dropped_links_count = v.into();
self
}
/// Sets the value of [link][crate::model::span::Links::link].
pub fn set_link<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::span::Link>,
{
use std::iter::Iterator;
self.link = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Links {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Span.Links"
}
}
/// Type of span. Can be used to specify additional relationships between spans
/// in addition to a parent/child relationship.
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct SpanKind(std::borrow::Cow<'static, str>);
impl SpanKind {
/// Creates a new SpanKind instance.
pub const fn new(v: &'static str) -> Self {
Self(std::borrow::Cow::Borrowed(v))
}
/// Gets the enum value.
pub fn value(&self) -> &str {
&self.0
}
}
/// Useful constants to work with [SpanKind](SpanKind)
pub mod span_kind {
use super::SpanKind;
/// Unspecified. Do NOT use as default.
/// Implementations MAY assume SpanKind.INTERNAL to be default.
pub const SPAN_KIND_UNSPECIFIED: SpanKind = SpanKind::new("SPAN_KIND_UNSPECIFIED");
/// Indicates that the span is used internally. Default value.
pub const INTERNAL: SpanKind = SpanKind::new("INTERNAL");
/// Indicates that the span covers server-side handling of an RPC or other
/// remote network request.
pub const SERVER: SpanKind = SpanKind::new("SERVER");
/// Indicates that the span covers the client-side wrapper around an RPC or
/// other remote request.
pub const CLIENT: SpanKind = SpanKind::new("CLIENT");
/// Indicates that the span describes producer sending a message to a broker.
/// Unlike client and server, there is no direct critical path latency
/// relationship between producer and consumer spans (e.g. publishing a
/// message to a pubsub service).
pub const PRODUCER: SpanKind = SpanKind::new("PRODUCER");
/// Indicates that the span describes consumer receiving a message from a
/// broker. Unlike client and server, there is no direct critical path
/// latency relationship between producer and consumer spans (e.g. receiving
/// a message from a pubsub service subscription).
pub const CONSUMER: SpanKind = SpanKind::new("CONSUMER");
}
impl std::convert::From<std::string::String> for SpanKind {
fn from(value: std::string::String) -> Self {
Self(std::borrow::Cow::Owned(value))
}
}
}
/// The allowed types for `[VALUE]` in a `[KEY]:[VALUE]` attribute.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct AttributeValue {
/// The type of the value.
#[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
pub value: std::option::Option<crate::model::attribute_value::Value>,
}
impl AttributeValue {
/// Sets the value of `value`.
pub fn set_value<
T: std::convert::Into<std::option::Option<crate::model::attribute_value::Value>>,
>(
mut self,
v: T,
) -> Self {
self.value = v.into();
self
}
/// The value of [value][crate::model::AttributeValue::value]
/// if it holds a `StringValue`, `None` if the field is not set or
/// holds a different branch.
pub fn get_string_value(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::TruncatableString>> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::attribute_value::Value::StringValue(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// The value of [value][crate::model::AttributeValue::value]
/// if it holds a `IntValue`, `None` if the field is not set or
/// holds a different branch.
pub fn get_int_value(&self) -> std::option::Option<&i64> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::attribute_value::Value::IntValue(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// The value of [value][crate::model::AttributeValue::value]
/// if it holds a `BoolValue`, `None` if the field is not set or
/// holds a different branch.
pub fn get_bool_value(&self) -> std::option::Option<&bool> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::attribute_value::Value::BoolValue(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [value][crate::model::AttributeValue::value]
/// to hold a `StringValue`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
pub fn set_string_value<
T: std::convert::Into<std::boxed::Box<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.value =
std::option::Option::Some(crate::model::attribute_value::Value::StringValue(v.into()));
self
}
/// Sets the value of [value][crate::model::AttributeValue::value]
/// to hold a `IntValue`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
pub fn set_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.value =
std::option::Option::Some(crate::model::attribute_value::Value::IntValue(v.into()));
self
}
/// Sets the value of [value][crate::model::AttributeValue::value]
/// to hold a `BoolValue`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.value =
std::option::Option::Some(crate::model::attribute_value::Value::BoolValue(v.into()));
self
}
}
impl wkt::message::Message for AttributeValue {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.AttributeValue"
}
}
/// Defines additional types related to AttributeValue
pub mod attribute_value {
#[allow(unused_imports)]
use super::*;
/// The type of the value.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub enum Value {
/// A string up to 256 bytes long.
StringValue(std::boxed::Box<crate::model::TruncatableString>),
/// A 64-bit signed integer.
IntValue(i64),
/// A Boolean value represented by `true` or `false`.
BoolValue(bool),
}
}
/// A call stack appearing in a trace.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StackTrace {
/// Stack frames in this stack trace. A maximum of 128 frames are allowed.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub stack_frames: std::option::Option<crate::model::stack_trace::StackFrames>,
/// The hash ID is used to conserve network bandwidth for duplicate
/// stack traces within a single trace.
///
/// Often multiple spans will have identical stack traces.
/// The first occurrence of a stack trace should contain both the
/// `stackFrame` content and a value in `stackTraceHashId`.
///
/// Subsequent spans within the same request can refer
/// to that stack trace by only setting `stackTraceHashId`.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub stack_trace_hash_id: i64,
}
impl StackTrace {
/// Sets the value of [stack_frames][crate::model::StackTrace::stack_frames].
pub fn set_stack_frames<
T: std::convert::Into<std::option::Option<crate::model::stack_trace::StackFrames>>,
>(
mut self,
v: T,
) -> Self {
self.stack_frames = v.into();
self
}
/// Sets the value of [stack_trace_hash_id][crate::model::StackTrace::stack_trace_hash_id].
pub fn set_stack_trace_hash_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.stack_trace_hash_id = v.into();
self
}
}
impl wkt::message::Message for StackTrace {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace"
}
}
/// Defines additional types related to StackTrace
pub mod stack_trace {
#[allow(unused_imports)]
use super::*;
/// Represents a single stack frame in a stack trace.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StackFrame {
/// The fully-qualified name that uniquely identifies the function or
/// method that is active in this frame (up to 1024 bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub function_name: std::option::Option<crate::model::TruncatableString>,
/// An un-mangled function name, if `function_name` is mangled.
/// To get information about name mangling, run
/// [this search](https://www.google.com/search?q=cxx+name+mangling).
/// The name can be fully-qualified (up to 1024 bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub original_function_name: std::option::Option<crate::model::TruncatableString>,
/// The name of the source file where the function call appears (up to 256
/// bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub file_name: std::option::Option<crate::model::TruncatableString>,
/// The line number in `file_name` where the function call appears.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub line_number: i64,
/// The column number where the function call appears, if available.
/// This is important in JavaScript because of its anonymous functions.
#[serde_as(as = "serde_with::DisplayFromStr")]
pub column_number: i64,
/// The binary module from where the code was loaded.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub load_module: std::option::Option<crate::model::Module>,
/// The version of the deployed source code (up to 128 bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub source_version: std::option::Option<crate::model::TruncatableString>,
}
impl StackFrame {
/// Sets the value of [function_name][crate::model::stack_trace::StackFrame::function_name].
pub fn set_function_name<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.function_name = v.into();
self
}
/// Sets the value of [original_function_name][crate::model::stack_trace::StackFrame::original_function_name].
pub fn set_original_function_name<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.original_function_name = v.into();
self
}
/// Sets the value of [file_name][crate::model::stack_trace::StackFrame::file_name].
pub fn set_file_name<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.file_name = v.into();
self
}
/// Sets the value of [line_number][crate::model::stack_trace::StackFrame::line_number].
pub fn set_line_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.line_number = v.into();
self
}
/// Sets the value of [column_number][crate::model::stack_trace::StackFrame::column_number].
pub fn set_column_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.column_number = v.into();
self
}
/// Sets the value of [load_module][crate::model::stack_trace::StackFrame::load_module].
pub fn set_load_module<T: std::convert::Into<std::option::Option<crate::model::Module>>>(
mut self,
v: T,
) -> Self {
self.load_module = v.into();
self
}
/// Sets the value of [source_version][crate::model::stack_trace::StackFrame::source_version].
pub fn set_source_version<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.source_version = v.into();
self
}
}
impl wkt::message::Message for StackFrame {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrame"
}
}
/// A collection of stack frames, which can be truncated.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StackFrames {
/// Stack frames in this call stack.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub frame: std::vec::Vec<crate::model::stack_trace::StackFrame>,
/// The number of stack frames that were dropped because there
/// were too many stack frames.
/// If this value is 0, then no stack frames were dropped.
pub dropped_frames_count: i32,
}
impl StackFrames {
/// Sets the value of [dropped_frames_count][crate::model::stack_trace::StackFrames::dropped_frames_count].
pub fn set_dropped_frames_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.dropped_frames_count = v.into();
self
}
/// Sets the value of [frame][crate::model::stack_trace::StackFrames::frame].
pub fn set_frame<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::stack_trace::StackFrame>,
{
use std::iter::Iterator;
self.frame = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StackFrames {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrames"
}
}
}
/// Binary module.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Module {
/// For example: main binary, kernel modules, and dynamic libraries
/// such as libc.so, sharedlib.so (up to 256 bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub module: std::option::Option<crate::model::TruncatableString>,
/// A unique identifier for the module, usually a hash of its
/// contents (up to 128 bytes).
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub build_id: std::option::Option<crate::model::TruncatableString>,
}
impl Module {
/// Sets the value of [module][crate::model::Module::module].
pub fn set_module<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.module = v.into();
self
}
/// Sets the value of [build_id][crate::model::Module::build_id].
pub fn set_build_id<
T: std::convert::Into<std::option::Option<crate::model::TruncatableString>>,
>(
mut self,
v: T,
) -> Self {
self.build_id = v.into();
self
}
}
impl wkt::message::Message for Module {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.Module"
}
}
/// Represents a string that might be shortened to a specified length.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct TruncatableString {
/// The shortened string. For example, if the original string is 500
/// bytes long and the limit of the string is 128 bytes, then
/// `value` contains the first 128 bytes of the 500-byte string.
///
/// Truncation always happens on a UTF8 character boundary. If there
/// are multi-byte characters in the string, then the length of the
/// shortened string might be less than the size limit.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub value: std::string::String,
/// The number of bytes removed from the original string. If this
/// value is 0, then the string was not shortened.
pub truncated_byte_count: i32,
}
impl TruncatableString {
/// Sets the value of [value][crate::model::TruncatableString::value].
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
/// Sets the value of [truncated_byte_count][crate::model::TruncatableString::truncated_byte_count].
pub fn set_truncated_byte_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.truncated_byte_count = v.into();
self
}
}
impl wkt::message::Message for TruncatableString {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.TruncatableString"
}
}
/// The request message for the `BatchWriteSpans` method.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BatchWriteSpansRequest {
/// Required. The name of the project where the spans belong. The format is
/// `projects/[PROJECT_ID]`.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
/// Required. A list of new spans. The span names must not match existing
/// spans, otherwise the results are undefined.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub spans: std::vec::Vec<crate::model::Span>,
}
impl BatchWriteSpansRequest {
/// Sets the value of [name][crate::model::BatchWriteSpansRequest::name].
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [spans][crate::model::BatchWriteSpansRequest::spans].
pub fn set_spans<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Span>,
{
use std::iter::Iterator;
self.spans = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchWriteSpansRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudtrace.v2.BatchWriteSpansRequest"
}
}