@@ -125,20 +125,27 @@ pub struct Span {
125
125
)
126
126
) ]
127
127
pub parent_span_id : :: prost:: alloc:: vec:: Vec < u8 > ,
128
- /// Flags, a bit field. 8 least significant bits are the trace
129
- /// flags as defined in W3C Trace Context specification. Readers
130
- /// MUST not assume that 24 most significant bits will be zero.
131
- /// To read the 8-bit W3C trace flag, use `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
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`.
132
140
///
133
141
/// When creating span messages, if the message is logically forwarded from another source
134
142
/// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
135
143
/// be copied as-is. If creating from a source that does not have an equivalent flags field
136
- /// (such as a runtime representation of an OpenTelemetry span), the high 24 bits MUST
144
+ /// (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
137
145
/// be set to zero.
146
+ /// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
138
147
///
139
148
/// \[Optional\].
140
- ///
141
- /// See <https://www.w3.org/TR/trace-context-2/#trace-flags> for the flag definitions.
142
149
#[ prost( fixed32, tag = "16" ) ]
143
150
pub flags : u32 ,
144
151
/// A description of the span's operation.
@@ -297,14 +304,23 @@ pub mod span {
297
304
/// then no attributes were dropped.
298
305
#[ prost( uint32, tag = "5" ) ]
299
306
pub dropped_attributes_count : u32 ,
300
- /// Flags, a bit field. 8 least significant bits are the trace
301
- /// flags as defined in W3C Trace Context specification. Readers
302
- /// MUST not assume that 24 most significant bits will be zero.
303
- /// When creating new spans, the most-significant 24-bits MUST be
304
- /// zero. To read the 8-bit W3C trace flag (use flags &
305
- /// SPAN_FLAGS_TRACE_FLAGS_MASK). \[Optional\].
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`.
306
312
///
307
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\].
308
324
#[ prost( fixed32, tag = "6" ) ]
309
325
pub flags : u32 ,
310
326
}
@@ -468,6 +484,11 @@ pub enum SpanFlags {
468
484
DoNotUse = 0 ,
469
485
/// Bits 0-7 are used for trace flags.
470
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 ,
471
492
}
472
493
impl SpanFlags {
473
494
/// String value of the enum field names used in the ProtoBuf definition.
@@ -478,13 +499,17 @@ impl SpanFlags {
478
499
match self {
479
500
SpanFlags :: DoNotUse => "SPAN_FLAGS_DO_NOT_USE" ,
480
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" ,
481
504
}
482
505
}
483
506
/// Creates an enum from field names used in the ProtoBuf definition.
484
507
pub fn from_str_name ( value : & str ) -> :: core:: option:: Option < Self > {
485
508
match value {
486
509
"SPAN_FLAGS_DO_NOT_USE" => Some ( Self :: DoNotUse ) ,
487
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 ) ,
488
513
_ => None ,
489
514
}
490
515
}
0 commit comments