opentelemetry_proto/proto/tonic/
opentelemetry.proto.trace.v1.rs

1// This file is @generated by prost-build.
2/// TracesData represents the traces data that can be stored in a persistent storage,
3/// OR can be embedded by other protocols that transfer OTLP traces data but do
4/// not implement the OTLP protocol.
5///
6/// The main difference between this message and collector protocol is that
7/// in this message there will not be any "control" or "metadata" specific to
8/// OTLP protocol.
9///
10/// When new fields are added into this message, the OTLP request MUST be updated
11/// as well.
12#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
13#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
14#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct TracesData {
17    /// An array of ResourceSpans.
18    /// For data coming from a single resource this array will typically contain
19    /// one element. Intermediary nodes that receive data from multiple origins
20    /// typically batch the data before forwarding further and in that case this
21    /// array will contain multiple elements.
22    #[prost(message, repeated, tag = "1")]
23    pub resource_spans: ::prost::alloc::vec::Vec<ResourceSpans>,
24}
25/// A collection of ScopeSpans from a Resource.
26#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
27#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
28#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
29#[cfg_attr(feature = "with-serde", serde(default))]
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct ResourceSpans {
32    /// The resource for the spans in this message.
33    /// If this field is not set then no resource info is known.
34    #[prost(message, optional, tag = "1")]
35    pub resource: ::core::option::Option<super::super::resource::v1::Resource>,
36    /// A list of ScopeSpans that originate from a resource.
37    #[prost(message, repeated, tag = "2")]
38    pub scope_spans: ::prost::alloc::vec::Vec<ScopeSpans>,
39    /// The Schema URL, if known. This is the identifier of the Schema that the resource data
40    /// is recorded in. Notably, the last part of the URL path is the version number of the
41    /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
42    /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
43    /// This schema_url applies to the data in the "resource" field. It does not apply
44    /// to the data in the "scope_spans" field which have their own schema_url field.
45    #[prost(string, tag = "3")]
46    pub schema_url: ::prost::alloc::string::String,
47}
48/// A collection of Spans produced by an InstrumentationScope.
49#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
50#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
51#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
52#[cfg_attr(feature = "with-serde", serde(default))]
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct ScopeSpans {
55    /// The instrumentation scope information for the spans in this message.
56    /// Semantically when InstrumentationScope isn't set, it is equivalent with
57    /// an empty instrumentation scope name (unknown).
58    #[prost(message, optional, tag = "1")]
59    pub scope: ::core::option::Option<super::super::common::v1::InstrumentationScope>,
60    /// A list of Spans that originate from an instrumentation scope.
61    #[prost(message, repeated, tag = "2")]
62    pub spans: ::prost::alloc::vec::Vec<Span>,
63    /// The Schema URL, if known. This is the identifier of the Schema that the span data
64    /// is recorded in. Notably, the last part of the URL path is the version number of the
65    /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
66    /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
67    /// This schema_url applies to all spans and span events in the "spans" field.
68    #[prost(string, tag = "3")]
69    pub schema_url: ::prost::alloc::string::String,
70}
71/// A Span represents a single operation performed by a single component of the system.
72///
73/// The next available field id is 17.
74#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
75#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
76#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
77#[cfg_attr(feature = "with-serde", serde(default))]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct Span {
80    /// A unique identifier for a trace. All spans from the same trace share
81    /// the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
82    /// of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
83    /// is zero-length and thus is also invalid).
84    ///
85    /// This field is required.
86    #[prost(bytes = "vec", tag = "1")]
87    #[cfg_attr(
88        feature = "with-serde",
89        serde(
90            serialize_with = "crate::proto::serializers::serialize_to_hex_string",
91            deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
92        )
93    )]
94    pub trace_id: ::prost::alloc::vec::Vec<u8>,
95    /// A unique identifier for a span within a trace, assigned when the span
96    /// is created. The ID is an 8-byte array. An ID with all zeroes OR of length
97    /// other than 8 bytes is considered invalid (empty string in OTLP/JSON
98    /// is zero-length and thus is also invalid).
99    ///
100    /// This field is required.
101    #[prost(bytes = "vec", tag = "2")]
102    #[cfg_attr(
103        feature = "with-serde",
104        serde(
105            serialize_with = "crate::proto::serializers::serialize_to_hex_string",
106            deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
107        )
108    )]
109    pub span_id: ::prost::alloc::vec::Vec<u8>,
110    /// trace_state conveys information about request position in multiple distributed tracing graphs.
111    /// It is a trace_state in w3c-trace-context format: <https://www.w3.org/TR/trace-context/#tracestate-header>
112    /// See also <https://github.com/w3c/distributed-tracing> for more details about this field.
113    #[prost(string, tag = "3")]
114    pub trace_state: ::prost::alloc::string::String,
115    /// The `span_id` of this span's parent span. If this is a root span, then this
116    /// field must be empty. The ID is an 8-byte array.
117    #[prost(bytes = "vec", tag = "4")]
118    #[cfg_attr(
119        feature = "with-serde",
120        serde(
121            serialize_with = "crate::proto::serializers::serialize_to_hex_string",
122            deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
123        )
124    )]
125    pub parent_span_id: ::prost::alloc::vec::Vec<u8>,
126    /// Flags, a bit field.
127    ///
128    /// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
129    /// Context specification. To read the 8-bit W3C trace flag, use
130    /// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
131    ///
132    /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
133    ///
134    /// Bits 8 and 9 represent the 3 states of whether a span's parent
135    /// is remote. The states are (unknown, is not remote, is remote).
136    /// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
137    /// To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
138    ///
139    /// When creating span messages, if the message is logically forwarded from another source
140    /// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
141    /// be copied as-is. If creating from a source that does not have an equivalent flags field
142    /// (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
143    /// be set to zero.
144    /// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
145    ///
146    /// \[Optional\].
147    #[prost(fixed32, tag = "16")]
148    pub flags: u32,
149    /// A description of the span's operation.
150    ///
151    /// For example, the name can be a qualified method name or a file name
152    /// and a line number where the operation is called. A best practice is to use
153    /// the same display name at the same call point in an application.
154    /// This makes it easier to correlate spans in different traces.
155    ///
156    /// This field is semantically required to be set to non-empty string.
157    /// Empty value is equivalent to an unknown span name.
158    ///
159    /// This field is required.
160    #[prost(string, tag = "5")]
161    pub name: ::prost::alloc::string::String,
162    /// Distinguishes between spans generated in a particular context. For example,
163    /// two spans with the same name may be distinguished using `CLIENT` (caller)
164    /// and `SERVER` (callee) to identify queueing latency associated with the span.
165    #[prost(enumeration = "span::SpanKind", tag = "6")]
166    pub kind: i32,
167    /// start_time_unix_nano is the start time of the span. On the client side, this is the time
168    /// kept by the local machine where the span execution starts. On the server side, this
169    /// is the time when the server's application handler starts running.
170    /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
171    ///
172    /// This field is semantically required and it is expected that end_time >= start_time.
173    #[prost(fixed64, tag = "7")]
174    #[cfg_attr(
175        feature = "with-serde",
176        serde(
177            serialize_with = "crate::proto::serializers::serialize_u64_to_string",
178            deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
179        )
180    )]
181    pub start_time_unix_nano: u64,
182    /// end_time_unix_nano is the end time of the span. On the client side, this is the time
183    /// kept by the local machine where the span execution ends. On the server side, this
184    /// is the time when the server application handler stops running.
185    /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
186    ///
187    /// This field is semantically required and it is expected that end_time >= start_time.
188    #[prost(fixed64, tag = "8")]
189    #[cfg_attr(
190        feature = "with-serde",
191        serde(
192            serialize_with = "crate::proto::serializers::serialize_u64_to_string",
193            deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
194        )
195    )]
196    pub end_time_unix_nano: u64,
197    /// attributes is a collection of key/value pairs. Note, global attributes
198    /// like server name can be set using the resource API. Examples of attributes:
199    ///
200    ///      "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
201    ///      "/http/server_latency": 300
202    ///      "example.com/myattribute": true
203    ///      "example.com/score": 10.239
204    ///
205    /// The OpenTelemetry API specification further restricts the allowed value types:
206    /// <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute>
207    /// Attribute keys MUST be unique (it is not allowed to have more than one
208    /// attribute with the same key).
209    #[prost(message, repeated, tag = "9")]
210    pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
211    /// dropped_attributes_count is the number of attributes that were discarded. Attributes
212    /// can be discarded because their keys are too long or because there are too many
213    /// attributes. If this value is 0, then no attributes were dropped.
214    #[prost(uint32, tag = "10")]
215    pub dropped_attributes_count: u32,
216    /// events is a collection of Event items.
217    #[prost(message, repeated, tag = "11")]
218    pub events: ::prost::alloc::vec::Vec<span::Event>,
219    /// dropped_events_count is the number of dropped events. If the value is 0, then no
220    /// events were dropped.
221    #[prost(uint32, tag = "12")]
222    pub dropped_events_count: u32,
223    /// links is a collection of Links, which are references from this span to a span
224    /// in the same or different trace.
225    #[prost(message, repeated, tag = "13")]
226    pub links: ::prost::alloc::vec::Vec<span::Link>,
227    /// dropped_links_count is the number of dropped links after the maximum size was
228    /// enforced. If this value is 0, then no links were dropped.
229    #[prost(uint32, tag = "14")]
230    pub dropped_links_count: u32,
231    /// An optional final status for this span. Semantically when Status isn't set, it means
232    /// span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).
233    #[prost(message, optional, tag = "15")]
234    pub status: ::core::option::Option<Status>,
235}
236/// Nested message and enum types in `Span`.
237pub mod span {
238    /// Event is a time-stamped annotation of the span, consisting of user-supplied
239    /// text description and key-value pairs.
240    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
241    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
242    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
243    #[cfg_attr(feature = "with-serde", serde(default))]
244    #[derive(Clone, PartialEq, ::prost::Message)]
245    pub struct Event {
246        /// time_unix_nano is the time the event occurred.
247        #[prost(fixed64, tag = "1")]
248        #[cfg_attr(
249            feature = "with-serde",
250            serde(
251                serialize_with = "crate::proto::serializers::serialize_u64_to_string",
252                deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
253            )
254        )]
255        pub time_unix_nano: u64,
256        /// name of the event.
257        /// This field is semantically required to be set to non-empty string.
258        #[prost(string, tag = "2")]
259        pub name: ::prost::alloc::string::String,
260        /// attributes is a collection of attribute key/value pairs on the event.
261        /// Attribute keys MUST be unique (it is not allowed to have more than one
262        /// attribute with the same key).
263        #[prost(message, repeated, tag = "3")]
264        pub attributes: ::prost::alloc::vec::Vec<
265            super::super::super::common::v1::KeyValue,
266        >,
267        /// dropped_attributes_count is the number of dropped attributes. If the value is 0,
268        /// then no attributes were dropped.
269        #[prost(uint32, tag = "4")]
270        pub dropped_attributes_count: u32,
271    }
272    /// A pointer from the current span to another span in the same trace or in a
273    /// different trace. For example, this can be used in batching operations,
274    /// where a single batch handler processes multiple requests from different
275    /// traces or when the handler receives a request from a different project.
276    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
277    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
278    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
279    #[cfg_attr(feature = "with-serde", serde(default))]
280    #[derive(Clone, PartialEq, ::prost::Message)]
281    pub struct Link {
282        /// A unique identifier of a trace that this linked span is part of. The ID is a
283        /// 16-byte array.
284        #[prost(bytes = "vec", tag = "1")]
285        #[cfg_attr(
286            feature = "with-serde",
287            serde(
288                serialize_with = "crate::proto::serializers::serialize_to_hex_string",
289                deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
290            )
291        )]
292        pub trace_id: ::prost::alloc::vec::Vec<u8>,
293        /// A unique identifier for the linked span. The ID is an 8-byte array.
294        #[prost(bytes = "vec", tag = "2")]
295        #[cfg_attr(
296            feature = "with-serde",
297            serde(
298                serialize_with = "crate::proto::serializers::serialize_to_hex_string",
299                deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
300            )
301        )]
302        pub span_id: ::prost::alloc::vec::Vec<u8>,
303        /// The trace_state associated with the link.
304        #[prost(string, tag = "3")]
305        pub trace_state: ::prost::alloc::string::String,
306        /// attributes is a collection of attribute key/value pairs on the link.
307        /// Attribute keys MUST be unique (it is not allowed to have more than one
308        /// attribute with the same key).
309        #[prost(message, repeated, tag = "4")]
310        pub attributes: ::prost::alloc::vec::Vec<
311            super::super::super::common::v1::KeyValue,
312        >,
313        /// dropped_attributes_count is the number of dropped attributes. If the value is 0,
314        /// then no attributes were dropped.
315        #[prost(uint32, tag = "5")]
316        pub dropped_attributes_count: u32,
317        /// Flags, a bit field.
318        ///
319        /// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
320        /// Context specification. To read the 8-bit W3C trace flag, use
321        /// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
322        ///
323        /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
324        ///
325        /// Bits 8 and 9 represent the 3 states of whether the link is remote.
326        /// The states are (unknown, is not remote, is remote).
327        /// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
328        /// To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
329        ///
330        /// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
331        /// When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
332        ///
333        /// \[Optional\].
334        #[prost(fixed32, tag = "6")]
335        pub flags: u32,
336    }
337    /// SpanKind is the type of span. Can be used to specify additional relationships between spans
338    /// in addition to a parent/child relationship.
339    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
340    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
341    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
342    #[derive(
343        Clone,
344        Copy,
345        Debug,
346        PartialEq,
347        Eq,
348        Hash,
349        PartialOrd,
350        Ord,
351        ::prost::Enumeration
352    )]
353    #[repr(i32)]
354    pub enum SpanKind {
355        /// Unspecified. Do NOT use as default.
356        /// Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
357        Unspecified = 0,
358        /// Indicates that the span represents an internal operation within an application,
359        /// as opposed to an operation happening at the boundaries. Default value.
360        Internal = 1,
361        /// Indicates that the span covers server-side handling of an RPC or other
362        /// remote network request.
363        Server = 2,
364        /// Indicates that the span describes a request to some remote service.
365        Client = 3,
366        /// Indicates that the span describes a producer sending a message to a broker.
367        /// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
368        /// between producer and consumer spans. A PRODUCER span ends when the message was accepted
369        /// by the broker while the logical processing of the message might span a much longer time.
370        Producer = 4,
371        /// Indicates that the span describes consumer receiving a message from a broker.
372        /// Like the PRODUCER kind, there is often no direct critical path latency relationship
373        /// between producer and consumer spans.
374        Consumer = 5,
375    }
376    impl SpanKind {
377        /// String value of the enum field names used in the ProtoBuf definition.
378        ///
379        /// The values are not transformed in any way and thus are considered stable
380        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
381        pub fn as_str_name(&self) -> &'static str {
382            match self {
383                Self::Unspecified => "SPAN_KIND_UNSPECIFIED",
384                Self::Internal => "SPAN_KIND_INTERNAL",
385                Self::Server => "SPAN_KIND_SERVER",
386                Self::Client => "SPAN_KIND_CLIENT",
387                Self::Producer => "SPAN_KIND_PRODUCER",
388                Self::Consumer => "SPAN_KIND_CONSUMER",
389            }
390        }
391        /// Creates an enum from field names used in the ProtoBuf definition.
392        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
393            match value {
394                "SPAN_KIND_UNSPECIFIED" => Some(Self::Unspecified),
395                "SPAN_KIND_INTERNAL" => Some(Self::Internal),
396                "SPAN_KIND_SERVER" => Some(Self::Server),
397                "SPAN_KIND_CLIENT" => Some(Self::Client),
398                "SPAN_KIND_PRODUCER" => Some(Self::Producer),
399                "SPAN_KIND_CONSUMER" => Some(Self::Consumer),
400                _ => None,
401            }
402        }
403    }
404}
405/// The Status type defines a logical error model that is suitable for different
406/// programming environments, including REST APIs and RPC APIs.
407#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
408#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
409#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
410#[cfg_attr(feature = "with-serde", serde(default))]
411#[derive(Clone, PartialEq, ::prost::Message)]
412pub struct Status {
413    /// A developer-facing human readable error message.
414    #[prost(string, tag = "2")]
415    pub message: ::prost::alloc::string::String,
416    /// The status code.
417    #[prost(enumeration = "status::StatusCode", tag = "3")]
418    pub code: i32,
419}
420/// Nested message and enum types in `Status`.
421pub mod status {
422    /// For the semantics of status codes see
423    /// <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status>
424    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
425    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
426    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
427    #[derive(
428        Clone,
429        Copy,
430        Debug,
431        PartialEq,
432        Eq,
433        Hash,
434        PartialOrd,
435        Ord,
436        ::prost::Enumeration
437    )]
438    #[repr(i32)]
439    pub enum StatusCode {
440        /// The default status.
441        Unset = 0,
442        /// The Span has been validated by an Application developer or Operator to
443        /// have completed successfully.
444        Ok = 1,
445        /// The Span contains an error.
446        Error = 2,
447    }
448    impl StatusCode {
449        /// String value of the enum field names used in the ProtoBuf definition.
450        ///
451        /// The values are not transformed in any way and thus are considered stable
452        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
453        pub fn as_str_name(&self) -> &'static str {
454            match self {
455                Self::Unset => "STATUS_CODE_UNSET",
456                Self::Ok => "STATUS_CODE_OK",
457                Self::Error => "STATUS_CODE_ERROR",
458            }
459        }
460        /// Creates an enum from field names used in the ProtoBuf definition.
461        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
462            match value {
463                "STATUS_CODE_UNSET" => Some(Self::Unset),
464                "STATUS_CODE_OK" => Some(Self::Ok),
465                "STATUS_CODE_ERROR" => Some(Self::Error),
466                _ => None,
467            }
468        }
469    }
470}
471/// SpanFlags represents constants used to interpret the
472/// Span.flags field, which is protobuf 'fixed32' type and is to
473/// be used as bit-fields. Each non-zero value defined in this enum is
474/// a bit-mask.  To extract the bit-field, for example, use an
475/// expression like:
476///
477///    (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
478///
479/// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
480///
481/// Note that Span flags were introduced in version 1.1 of the
482/// OpenTelemetry protocol.  Older Span producers do not set this
483/// field, consequently consumers should not rely on the absence of a
484/// particular flag bit to indicate the presence of a particular feature.
485#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
486#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
487#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
488#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
489#[repr(i32)]
490pub enum SpanFlags {
491    /// The zero value for the enum. Should not be used for comparisons.
492    /// Instead use bitwise "and" with the appropriate mask as shown above.
493    DoNotUse = 0,
494    /// Bits 0-7 are used for trace flags.
495    TraceFlagsMask = 255,
496    /// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
497    /// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
498    /// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
499    ContextHasIsRemoteMask = 256,
500    ContextIsRemoteMask = 512,
501}
502impl SpanFlags {
503    /// String value of the enum field names used in the ProtoBuf definition.
504    ///
505    /// The values are not transformed in any way and thus are considered stable
506    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
507    pub fn as_str_name(&self) -> &'static str {
508        match self {
509            Self::DoNotUse => "SPAN_FLAGS_DO_NOT_USE",
510            Self::TraceFlagsMask => "SPAN_FLAGS_TRACE_FLAGS_MASK",
511            Self::ContextHasIsRemoteMask => "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK",
512            Self::ContextIsRemoteMask => "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK",
513        }
514    }
515    /// Creates an enum from field names used in the ProtoBuf definition.
516    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
517        match value {
518            "SPAN_FLAGS_DO_NOT_USE" => Some(Self::DoNotUse),
519            "SPAN_FLAGS_TRACE_FLAGS_MASK" => Some(Self::TraceFlagsMask),
520            "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK" => Some(Self::ContextHasIsRemoteMask),
521            "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK" => Some(Self::ContextIsRemoteMask),
522            _ => None,
523        }
524    }
525}