@@ -37,6 +37,9 @@ pub struct ResourceSpans {
37
37
/// A list of ScopeSpans that originate from a resource.
38
38
#[ prost( message, repeated, tag = "2" ) ]
39
39
pub scope_spans : :: prost:: alloc:: vec:: Vec < ScopeSpans > ,
40
+ /// The Schema URL, if known. This is the identifier of the Schema that the resource data
41
+ /// is recorded in. To learn more about Schema URL see
42
+ /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
40
43
/// This schema_url applies to the data in the "resource" field. It does not apply
41
44
/// to the data in the "scope_spans" field which have their own schema_url field.
42
45
#[ prost( string, tag = "3" ) ]
@@ -58,6 +61,9 @@ pub struct ScopeSpans {
58
61
/// A list of Spans that originate from an instrumentation scope.
59
62
#[ prost( message, repeated, tag = "2" ) ]
60
63
pub spans : :: prost:: alloc:: vec:: Vec < Span > ,
64
+ /// The Schema URL, if known. This is the identifier of the Schema that the span data
65
+ /// is recorded in. To learn more about Schema URL see
66
+ /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
61
67
/// This schema_url applies to all spans and span events in the "spans" field.
62
68
#[ prost( string, tag = "3" ) ]
63
69
pub schema_url : :: prost:: alloc:: string:: String ,
@@ -118,6 +124,22 @@ pub struct Span {
118
124
)
119
125
) ]
120
126
pub parent_span_id : :: prost:: alloc:: vec:: Vec < u8 > ,
127
+ /// Flags, a bit field. 8 least significant bits are the trace
128
+ /// flags as defined in W3C Trace Context specification. Readers
129
+ /// MUST not assume that 24 most significant bits will be zero.
130
+ /// To read the 8-bit W3C trace flag, use `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
131
+ ///
132
+ /// When creating span messages, if the message is logically forwarded from another source
133
+ /// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
134
+ /// be copied as-is. If creating from a source that does not have an equivalent flags field
135
+ /// (such as a runtime representation of an OpenTelemetry span), the high 24 bits MUST
136
+ /// be set to zero.
137
+ ///
138
+ /// \[Optional\].
139
+ ///
140
+ /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
141
+ #[ prost( fixed32, tag = "16" ) ]
142
+ pub flags : u32 ,
121
143
/// A description of the span's operation.
122
144
///
123
145
/// For example, the name can be a qualified method name or a file name
@@ -253,6 +275,16 @@ pub mod span {
253
275
/// then no attributes were dropped.
254
276
#[ prost( uint32, tag = "5" ) ]
255
277
pub dropped_attributes_count : u32 ,
278
+ /// Flags, a bit field. 8 least significant bits are the trace
279
+ /// flags as defined in W3C Trace Context specification. Readers
280
+ /// MUST not assume that 24 most significant bits will be zero.
281
+ /// When creating new spans, the most-significant 24-bits MUST be
282
+ /// zero. To read the 8-bit W3C trace flag (use flags &
283
+ /// SPAN_FLAGS_TRACE_FLAGS_MASK). \[Optional\].
284
+ ///
285
+ /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
286
+ #[ prost( fixed32, tag = "6" ) ]
287
+ pub flags : u32 ,
256
288
}
257
289
/// SpanKind is the type of span. Can be used to specify additional relationships between spans
258
290
/// in addition to a parent/child relationship.
@@ -388,3 +420,49 @@ pub mod status {
388
420
}
389
421
}
390
422
}
423
+ /// SpanFlags represents constants used to interpret the
424
+ /// Span.flags field, which is protobuf 'fixed32' type and is to
425
+ /// be used as bit-fields. Each non-zero value defined in this enum is
426
+ /// a bit-mask. To extract the bit-field, for example, use an
427
+ /// expression like:
428
+ ///
429
+ /// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
430
+ ///
431
+ /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
432
+ ///
433
+ /// Note that Span flags were introduced in version 1.1 of the
434
+ /// OpenTelemetry protocol. Older Span producers do not set this
435
+ /// field, consequently consumers should not rely on the absence of a
436
+ /// particular flag bit to indicate the presence of a particular feature.
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
+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
441
+ #[ repr( i32 ) ]
442
+ pub enum SpanFlags {
443
+ /// The zero value for the enum. Should not be used for comparisons.
444
+ /// Instead use bitwise "and" with the appropriate mask as shown above.
445
+ DoNotUse = 0 ,
446
+ /// Bits 0-7 are used for trace flags.
447
+ TraceFlagsMask = 255 ,
448
+ }
449
+ impl SpanFlags {
450
+ /// String value of the enum field names used in the ProtoBuf definition.
451
+ ///
452
+ /// The values are not transformed in any way and thus are considered stable
453
+ /// (if the ProtoBuf definition does not change) and safe for programmatic use.
454
+ pub fn as_str_name ( & self ) -> & ' static str {
455
+ match self {
456
+ SpanFlags :: DoNotUse => "SPAN_FLAGS_DO_NOT_USE" ,
457
+ SpanFlags :: TraceFlagsMask => "SPAN_FLAGS_TRACE_FLAGS_MASK" ,
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
+ "SPAN_FLAGS_DO_NOT_USE" => Some ( Self :: DoNotUse ) ,
464
+ "SPAN_FLAGS_TRACE_FLAGS_MASK" => Some ( Self :: TraceFlagsMask ) ,
465
+ _ => None ,
466
+ }
467
+ }
468
+ }
0 commit comments