@@ -55,6 +55,9 @@ message ResourceSpans {
5555 // A list of ScopeSpans that originate from a resource.
5656 repeated ScopeSpans scope_spans = 2 ;
5757
58+ // The Schema URL, if known. This is the identifier of the Schema that the resource data
59+ // is recorded in. To learn more about Schema URL see
60+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
5861 // This schema_url applies to the data in the "resource" field. It does not apply
5962 // to the data in the "scope_spans" field which have their own schema_url field.
6063 string schema_url = 3 ;
@@ -70,6 +73,9 @@ message ScopeSpans {
7073 // A list of Spans that originate from an instrumentation scope.
7174 repeated Span spans = 2 ;
7275
76+ // The Schema URL, if known. This is the identifier of the Schema that the span data
77+ // is recorded in. To learn more about Schema URL see
78+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
7379 // This schema_url applies to all spans and span events in the "spans" field.
7480 string schema_url = 3 ;
7581}
@@ -103,6 +109,29 @@ message Span {
103109 // field must be empty. The ID is an 8-byte array.
104110 bytes parent_span_id = 4 ;
105111
112+ // Flags, a bit field.
113+ //
114+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
115+ // Context specification. To read the 8-bit W3C trace flag, use
116+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
117+ //
118+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
119+ //
120+ // Bits 8 and 9 represent the 3 states of whether a span's parent
121+ // is remote. The states are (unknown, is not remote, is remote).
122+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
123+ // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
124+ //
125+ // When creating span messages, if the message is logically forwarded from another source
126+ // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
127+ // be copied as-is. If creating from a source that does not have an equivalent flags field
128+ // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
129+ // be set to zero.
130+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
131+ //
132+ // [Optional].
133+ fixed32 flags = 16 ;
134+
106135 // A description of the span's operation.
107136 //
108137 // For example, the name can be a qualified method name or a file name
@@ -236,6 +265,25 @@ message Span {
236265 // dropped_attributes_count is the number of dropped attributes. If the value is 0,
237266 // then no attributes were dropped.
238267 uint32 dropped_attributes_count = 5 ;
268+
269+ // Flags, a bit field.
270+ //
271+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
272+ // Context specification. To read the 8-bit W3C trace flag, use
273+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
274+ //
275+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
276+ //
277+ // Bits 8 and 9 represent the 3 states of whether the link is remote.
278+ // The states are (unknown, is not remote, is remote).
279+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
280+ // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
281+ //
282+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
283+ // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
284+ //
285+ // [Optional].
286+ fixed32 flags = 6 ;
239287 }
240288
241289 // links is a collection of Links, which are references from this span to a span
@@ -274,3 +322,34 @@ message Status {
274322 // The status code.
275323 StatusCode code = 3 ;
276324}
325+
326+ // SpanFlags represents constants used to interpret the
327+ // Span.flags field, which is protobuf 'fixed32' type and is to
328+ // be used as bit-fields. Each non-zero value defined in this enum is
329+ // a bit-mask. To extract the bit-field, for example, use an
330+ // expression like:
331+ //
332+ // (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
333+ //
334+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
335+ //
336+ // Note that Span flags were introduced in version 1.1 of the
337+ // OpenTelemetry protocol. Older Span producers do not set this
338+ // field, consequently consumers should not rely on the absence of a
339+ // particular flag bit to indicate the presence of a particular feature.
340+ enum SpanFlags {
341+ // The zero value for the enum. Should not be used for comparisons.
342+ // Instead use bitwise "and" with the appropriate mask as shown above.
343+ SPAN_FLAGS_DO_NOT_USE = 0 ;
344+
345+ // Bits 0-7 are used for trace flags.
346+ SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF ;
347+
348+ // Bits 8 and 9 are used to indicate that the parent span or link span is remote.
349+ // Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
350+ // Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
351+ SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100 ;
352+ SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200 ;
353+
354+ // Bits 10-31 are reserved for future use.
355+ }
0 commit comments