Skip to content

Indicate if a span's parent or link is remote using 2 bit flag as described in OTEP 0182 #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5be7554
Add parent_span_is_remote to Span message
estolfo Jun 13, 2023
963731b
Use enum for ParentSpanIsRemote
estolfo Aug 15, 2023
f30d0d0
Adjust enum name
estolfo Aug 15, 2023
ab87539
Add extra comment about unset value from older clients
estolfo Aug 15, 2023
3c8aba1
Remove misleading documentation
estolfo Aug 22, 2023
56977e3
Update names
estolfo Aug 22, 2023
1fd036d
Remove ParentSpanIsRemote attribute
estolfo Sep 18, 2023
daec0cd
Add defintion of 2 bit parent is remote flag
estolfo Sep 18, 2023
a7daf8c
Include enum for interpreting ParentIsRemote flag and update document…
estolfo Sep 19, 2023
94e1b51
Add constants and enum for interpreting bits 8 and 9 of a Link's flags
estolfo Sep 27, 2023
01a2a77
One constant for link and parent is remote mask
estolfo Sep 27, 2023
1835bd5
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Sep 27, 2023
c617b92
Adjust flags documentation ordering
estolfo Sep 28, 2023
da143e3
Merge parent and link is remote enums into one
estolfo Sep 28, 2023
0da5616
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
4c08a3c
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
db81726
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
c6b1980
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
48344ff
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
dfd7b05
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 12, 2023
b450e01
Change doc references to updated enum name
estolfo Oct 12, 2023
e830767
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 16, 2023
08b77c9
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 16, 2023
c9eeed0
Adjust formatting of comments
estolfo Oct 16, 2023
f5d1bae
Update opentelemetry/proto/trace/v1/trace.proto
estolfo Oct 17, 2023
8a2733a
Remove enum, describe values in comment
estolfo Nov 28, 2023
06fce08
Split isremote into two masks
estolfo Jan 11, 2024
0b1963c
Update references to isremote masks
estolfo Jan 11, 2024
75e874b
Update inconsistency in docs formatting
estolfo Jan 11, 2024
d9ca797
Merge branch 'main' into span-remote-parent
estolfo Jan 23, 2024
4c02150
Add Changelog entry
estolfo Jan 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Full list of differences found in [this compare](https://github.com/open-telemet

### Added

* Add `flags` field to `Span` and `Span/Link` for W3C-specified Trace Context flags .
* Add `flags` field to `Span` and `Span/Link` for W3C-specified Trace Context flags.
[#503](https://github.com/open-telemetry/opentelemetry-proto/pull/503)
* Indicate if a `Span`'s parent or link is remote using 2 bit flag.
[#484](https://github.com/open-telemetry/opentelemetry-proto/pull/484)

### Changed

Expand Down
50 changes: 36 additions & 14 deletions opentelemetry/proto/trace/v1/trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,27 @@ message Span {
// field must be empty. The ID is an 8-byte array.
bytes parent_span_id = 4;

// Flags, a bit field. 8 least significant bits are the trace
// flags as defined in W3C Trace Context specification. Readers
// MUST not assume that 24 most significant bits will be zero.
// To read the 8-bit W3C trace flag, use `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
// Flags, a bit field.
//
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
// Context specification. To read the 8-bit W3C trace flag, use
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
//
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
//
// Bits 8 and 9 represent the 3 states of whether a span's parent
// is remote. The states are (unknown, is not remote, is remote).
// To read whether the value is known, use `flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK`.
// To read whether the span is remote, use `flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK`.
//
// When creating span messages, if the message is logically forwarded from another source
// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
// be copied as-is. If creating from a source that does not have an equivalent flags field
// (such as a runtime representation of an OpenTelemetry span), the high 24 bits MUST
// (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
// be set to zero.
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
//
// [Optional].
//
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
fixed32 flags = 16;

// A description of the span's operation.
Expand Down Expand Up @@ -259,14 +266,23 @@ message Span {
// then no attributes were dropped.
uint32 dropped_attributes_count = 5;

// Flags, a bit field. 8 least significant bits are the trace
// flags as defined in W3C Trace Context specification. Readers
// MUST not assume that 24 most significant bits will be zero.
// When creating new spans, the most-significant 24-bits MUST be
// zero. To read the 8-bit W3C trace flag (use flags &
// SPAN_FLAGS_TRACE_FLAGS_MASK). [Optional].
// Flags, a bit field.
//
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
// Context specification. To read the 8-bit W3C trace flag, use
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
//
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
//
// Bits 8 and 9 represent the 3 states of whether the link is remote.
// The states are (unknown, is not remote, is remote).
// To read whether the value is known, use `flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK`.
// To read whether the link is remote, use `flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK`.
//
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
// When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
//
// [Optional].
fixed32 flags = 6;
}

Expand Down Expand Up @@ -329,5 +345,11 @@ enum SpanFlags {
// Bits 0-7 are used for trace flags.
SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;

// Bits 8-31 are reserved for future use.
// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100;
SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200;

// Bits 10-31 are reserved for future use.
}