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