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    /// ```text
201    /// "/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"
202    /// "/http/server_latency": 300
203    /// "example.com/myattribute": true
204    /// "example.com/score": 10.239
205    /// ```
206    ///
207    /// Attribute keys MUST be unique (it is not allowed to have more than one
208    /// attribute with the same key).
209    ///
210    /// The attribute values SHOULD NOT contain empty values.
211    /// The attribute values SHOULD NOT contain bytes values.
212    /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
213    /// double values.
214    /// The attribute values SHOULD NOT contain kvlist values.
215    /// The behavior of software that receives attributes containing such values can be unpredictable.
216    /// These restrictions can change in a minor release.
217    /// The restrictions take origin from the OpenTelemetry specification:
218    /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
219    #[prost(message, repeated, tag = "9")]
220    pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
221    /// dropped_attributes_count is the number of attributes that were discarded. Attributes
222    /// can be discarded because their keys are too long or because there are too many
223    /// attributes. If this value is 0, then no attributes were dropped.
224    #[prost(uint32, tag = "10")]
225    pub dropped_attributes_count: u32,
226    /// events is a collection of Event items.
227    #[prost(message, repeated, tag = "11")]
228    pub events: ::prost::alloc::vec::Vec<span::Event>,
229    /// dropped_events_count is the number of dropped events. If the value is 0, then no
230    /// events were dropped.
231    #[prost(uint32, tag = "12")]
232    pub dropped_events_count: u32,
233    /// links is a collection of Links, which are references from this span to a span
234    /// in the same or different trace.
235    #[prost(message, repeated, tag = "13")]
236    pub links: ::prost::alloc::vec::Vec<span::Link>,
237    /// dropped_links_count is the number of dropped links after the maximum size was
238    /// enforced. If this value is 0, then no links were dropped.
239    #[prost(uint32, tag = "14")]
240    pub dropped_links_count: u32,
241    /// An optional final status for this span. Semantically when Status isn't set, it means
242    /// span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).
243    #[prost(message, optional, tag = "15")]
244    pub status: ::core::option::Option<Status>,
245}
246/// Nested message and enum types in `Span`.
247pub mod span {
248    /// Event is a time-stamped annotation of the span, consisting of user-supplied
249    /// text description and key-value pairs.
250    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
251    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
252    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
253    #[cfg_attr(feature = "with-serde", serde(default))]
254    #[derive(Clone, PartialEq, ::prost::Message)]
255    pub struct Event {
256        /// time_unix_nano is the time the event occurred.
257        #[prost(fixed64, tag = "1")]
258        #[cfg_attr(
259            feature = "with-serde",
260            serde(
261                serialize_with = "crate::proto::serializers::serialize_u64_to_string",
262                deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
263            )
264        )]
265        pub time_unix_nano: u64,
266        /// name of the event.
267        /// This field is semantically required to be set to non-empty string.
268        #[prost(string, tag = "2")]
269        pub name: ::prost::alloc::string::String,
270        /// attributes is a collection of attribute key/value pairs on the event.
271        /// Attribute keys MUST be unique (it is not allowed to have more than one
272        /// attribute with the same key).
273        ///
274        /// The attribute values SHOULD NOT contain empty values.
275        /// The attribute values SHOULD NOT contain bytes values.
276        /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
277        /// double values.
278        /// The attribute values SHOULD NOT contain kvlist values.
279        /// The behavior of software that receives attributes containing such values can be unpredictable.
280        /// These restrictions can change in a minor release.
281        /// The restrictions take origin from the OpenTelemetry specification:
282        /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
283        #[prost(message, repeated, tag = "3")]
284        pub attributes: ::prost::alloc::vec::Vec<
285            super::super::super::common::v1::KeyValue,
286        >,
287        /// dropped_attributes_count is the number of dropped attributes. If the value is 0,
288        /// then no attributes were dropped.
289        #[prost(uint32, tag = "4")]
290        pub dropped_attributes_count: u32,
291    }
292    /// A pointer from the current span to another span in the same trace or in a
293    /// different trace. For example, this can be used in batching operations,
294    /// where a single batch handler processes multiple requests from different
295    /// traces or when the handler receives a request from a different project.
296    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
297    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
298    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
299    #[cfg_attr(feature = "with-serde", serde(default))]
300    #[derive(Clone, PartialEq, ::prost::Message)]
301    pub struct Link {
302        /// A unique identifier of a trace that this linked span is part of. The ID is a
303        /// 16-byte array.
304        #[prost(bytes = "vec", tag = "1")]
305        #[cfg_attr(
306            feature = "with-serde",
307            serde(
308                serialize_with = "crate::proto::serializers::serialize_to_hex_string",
309                deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
310            )
311        )]
312        pub trace_id: ::prost::alloc::vec::Vec<u8>,
313        /// A unique identifier for the linked span. The ID is an 8-byte array.
314        #[prost(bytes = "vec", tag = "2")]
315        #[cfg_attr(
316            feature = "with-serde",
317            serde(
318                serialize_with = "crate::proto::serializers::serialize_to_hex_string",
319                deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
320            )
321        )]
322        pub span_id: ::prost::alloc::vec::Vec<u8>,
323        /// The trace_state associated with the link.
324        #[prost(string, tag = "3")]
325        pub trace_state: ::prost::alloc::string::String,
326        /// attributes is a collection of attribute key/value pairs on the link.
327        /// Attribute keys MUST be unique (it is not allowed to have more than one
328        /// attribute with the same key).
329        ///
330        /// The attribute values SHOULD NOT contain empty values.
331        /// The attribute values SHOULD NOT contain bytes values.
332        /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
333        /// double values.
334        /// The attribute values SHOULD NOT contain kvlist values.
335        /// The behavior of software that receives attributes containing such values can be unpredictable.
336        /// These restrictions can change in a minor release.
337        /// The restrictions take origin from the OpenTelemetry specification:
338        /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
339        #[prost(message, repeated, tag = "4")]
340        pub attributes: ::prost::alloc::vec::Vec<
341            super::super::super::common::v1::KeyValue,
342        >,
343        /// dropped_attributes_count is the number of dropped attributes. If the value is 0,
344        /// then no attributes were dropped.
345        #[prost(uint32, tag = "5")]
346        pub dropped_attributes_count: u32,
347        /// Flags, a bit field.
348        ///
349        /// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
350        /// Context specification. To read the 8-bit W3C trace flag, use
351        /// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
352        ///
353        /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
354        ///
355        /// Bits 8 and 9 represent the 3 states of whether the link is remote.
356        /// The states are (unknown, is not remote, is remote).
357        /// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
358        /// To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
359        ///
360        /// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
361        /// When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
362        ///
363        /// \[Optional\].
364        #[prost(fixed32, tag = "6")]
365        pub flags: u32,
366    }
367    /// SpanKind is the type of span. Can be used to specify additional relationships between spans
368    /// in addition to a parent/child relationship.
369    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
370    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
371    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
372    #[derive(
373        Clone,
374        Copy,
375        Debug,
376        PartialEq,
377        Eq,
378        Hash,
379        PartialOrd,
380        Ord,
381        ::prost::Enumeration
382    )]
383    #[repr(i32)]
384    pub enum SpanKind {
385        /// Unspecified. Do NOT use as default.
386        /// Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
387        Unspecified = 0,
388        /// Indicates that the span represents an internal operation within an application,
389        /// as opposed to an operation happening at the boundaries. Default value.
390        Internal = 1,
391        /// Indicates that the span covers server-side handling of an RPC or other
392        /// remote network request.
393        Server = 2,
394        /// Indicates that the span describes a request to some remote service.
395        Client = 3,
396        /// Indicates that the span describes a producer sending a message to a broker.
397        /// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
398        /// between producer and consumer spans. A PRODUCER span ends when the message was accepted
399        /// by the broker while the logical processing of the message might span a much longer time.
400        Producer = 4,
401        /// Indicates that the span describes consumer receiving a message from a broker.
402        /// Like the PRODUCER kind, there is often no direct critical path latency relationship
403        /// between producer and consumer spans.
404        Consumer = 5,
405    }
406    impl SpanKind {
407        /// String value of the enum field names used in the ProtoBuf definition.
408        ///
409        /// The values are not transformed in any way and thus are considered stable
410        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
411        pub fn as_str_name(&self) -> &'static str {
412            match self {
413                Self::Unspecified => "SPAN_KIND_UNSPECIFIED",
414                Self::Internal => "SPAN_KIND_INTERNAL",
415                Self::Server => "SPAN_KIND_SERVER",
416                Self::Client => "SPAN_KIND_CLIENT",
417                Self::Producer => "SPAN_KIND_PRODUCER",
418                Self::Consumer => "SPAN_KIND_CONSUMER",
419            }
420        }
421        /// Creates an enum from field names used in the ProtoBuf definition.
422        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
423            match value {
424                "SPAN_KIND_UNSPECIFIED" => Some(Self::Unspecified),
425                "SPAN_KIND_INTERNAL" => Some(Self::Internal),
426                "SPAN_KIND_SERVER" => Some(Self::Server),
427                "SPAN_KIND_CLIENT" => Some(Self::Client),
428                "SPAN_KIND_PRODUCER" => Some(Self::Producer),
429                "SPAN_KIND_CONSUMER" => Some(Self::Consumer),
430                _ => None,
431            }
432        }
433    }
434}
435/// The Status type defines a logical error model that is suitable for different
436/// programming environments, including REST APIs and RPC APIs.
437#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
438#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
439#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
440#[cfg_attr(feature = "with-serde", serde(default))]
441#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
442pub struct Status {
443    /// A developer-facing human readable error message.
444    #[prost(string, tag = "2")]
445    pub message: ::prost::alloc::string::String,
446    /// The status code.
447    #[prost(enumeration = "status::StatusCode", tag = "3")]
448    pub code: i32,
449}
450/// Nested message and enum types in `Status`.
451pub mod status {
452    /// For the semantics of status codes see
453    /// <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status>
454    #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
455    #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
456    #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
457    #[derive(
458        Clone,
459        Copy,
460        Debug,
461        PartialEq,
462        Eq,
463        Hash,
464        PartialOrd,
465        Ord,
466        ::prost::Enumeration
467    )]
468    #[repr(i32)]
469    pub enum StatusCode {
470        /// The default status.
471        Unset = 0,
472        /// The Span has been validated by an Application developer or Operator to
473        /// have completed successfully.
474        Ok = 1,
475        /// The Span contains an error.
476        Error = 2,
477    }
478    impl StatusCode {
479        /// String value of the enum field names used in the ProtoBuf definition.
480        ///
481        /// The values are not transformed in any way and thus are considered stable
482        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
483        pub fn as_str_name(&self) -> &'static str {
484            match self {
485                Self::Unset => "STATUS_CODE_UNSET",
486                Self::Ok => "STATUS_CODE_OK",
487                Self::Error => "STATUS_CODE_ERROR",
488            }
489        }
490        /// Creates an enum from field names used in the ProtoBuf definition.
491        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
492            match value {
493                "STATUS_CODE_UNSET" => Some(Self::Unset),
494                "STATUS_CODE_OK" => Some(Self::Ok),
495                "STATUS_CODE_ERROR" => Some(Self::Error),
496                _ => None,
497            }
498        }
499    }
500}
501/// SpanFlags represents constants used to interpret the
502/// Span.flags field, which is protobuf 'fixed32' type and is to
503/// be used as bit-fields. Each non-zero value defined in this enum is
504/// a bit-mask.  To extract the bit-field, for example, use an
505/// expression like:
506///
507/// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
508///
509/// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
510///
511/// Note that Span flags were introduced in version 1.1 of the
512/// OpenTelemetry protocol.  Older Span producers do not set this
513/// field, consequently consumers should not rely on the absence of a
514/// particular flag bit to indicate the presence of a particular feature.
515#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
516#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
517#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
518#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
519#[repr(i32)]
520pub enum SpanFlags {
521    /// The zero value for the enum. Should not be used for comparisons.
522    /// Instead use bitwise "and" with the appropriate mask as shown above.
523    DoNotUse = 0,
524    /// Bits 0-7 are used for trace flags.
525    TraceFlagsMask = 255,
526    /// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
527    /// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
528    /// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
529    ContextHasIsRemoteMask = 256,
530    ContextIsRemoteMask = 512,
531}
532impl SpanFlags {
533    /// String value of the enum field names used in the ProtoBuf definition.
534    ///
535    /// The values are not transformed in any way and thus are considered stable
536    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
537    pub fn as_str_name(&self) -> &'static str {
538        match self {
539            Self::DoNotUse => "SPAN_FLAGS_DO_NOT_USE",
540            Self::TraceFlagsMask => "SPAN_FLAGS_TRACE_FLAGS_MASK",
541            Self::ContextHasIsRemoteMask => "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK",
542            Self::ContextIsRemoteMask => "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK",
543        }
544    }
545    /// Creates an enum from field names used in the ProtoBuf definition.
546    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
547        match value {
548            "SPAN_FLAGS_DO_NOT_USE" => Some(Self::DoNotUse),
549            "SPAN_FLAGS_TRACE_FLAGS_MASK" => Some(Self::TraceFlagsMask),
550            "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK" => Some(Self::ContextHasIsRemoteMask),
551            "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK" => Some(Self::ContextIsRemoteMask),
552            _ => None,
553        }
554    }
555}