Skip to content
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a1d43e8
chore: added full trace flags implementation and tests
nikhilmantri0902 Oct 2, 2025
acc6f2e
chore: added changelog entry
nikhilmantri0902 Oct 2, 2025
27a12dc
chore: removed getattr method and unnecessay int typecasts
nikhilmantri0902 Oct 3, 2025
f6e8ef1
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
nikhilmantri0902 Oct 3, 2025
858e16b
chore: minor updates as per review
nikhilmantri0902 Oct 11, 2025
92a8960
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
xrmx Oct 14, 2025
142ba3a
fix: tox lint errors
nikhilmantri0902 Oct 15, 2025
37312bf
fix: pylint error
nikhilmantri0902 Oct 15, 2025
55e7a3a
fix: added fixes for the failing test cases
nikhilmantri0902 Oct 19, 2025
ec02a22
fix:merged main
nikhilmantri0902 Oct 19, 2025
fb5aec8
fix: precommit formatting
nikhilmantri0902 Oct 22, 2025
0696540
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
xrmx Oct 30, 2025
3be6a7b
Update CHANGELOG.md
xrmx Oct 30, 2025
9e581fb
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
xrmx Oct 30, 2025
04be919
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
xrmx Oct 31, 2025
c7a1222
fix: PR comments
nikhilmantri0902 Nov 2, 2025
01afe45
fix: failing workflow
nikhilmantri0902 Nov 3, 2025
f5eb8de
Merge branch 'main' into feat/otlpspanexporter_traceflags_bits07
xrmx Nov 5, 2025
37cc7bb
chore: merged main
nikhilmantri0902 Jan 21, 2026
630d80a
chore: Moved the # pylint: disable=no-member comment to the class level
nikhilmantri0902 Jan 22, 2026
c17bf89
chore: Remove test-specific handling from _span_flags and add trace_f…
nikhilmantri0902 Jan 22, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ def _span_flags(
child_trace_flags: int, parent_span_context: Optional[SpanContext]
) -> int:
# Lower 8 bits: W3C TraceFlags
# Handle TraceFlags objects, regular ints, and test mocks
# TraceFlags is an int subclass, but we handle Mock objects in tests
try:
flags = (
int(child_trace_flags) & PB2SpanFlags.SPAN_FLAGS_TRACE_FLAGS_MASK
)
except (TypeError, ValueError):
# If conversion fails (e.g., Mock object), default to 0
flags = child_trace_flags & PB2SpanFlags.SPAN_FLAGS_TRACE_FLAGS_MASK
except TypeError:
# If bitwise operation fails (e.g., Mock object in tests), default to 0
flags = 0
# Always indicate whether parent remote information is known
flags |= PB2SpanFlags.SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK
Expand Down Expand Up @@ -169,26 +167,14 @@ def _encode_links(links: Sequence[Link]) -> Sequence[PB2SPan.Link]:
if links:
pb2_links = []
for link in links:
# For links, encode trace_flags and is_remote from the link's context
# Handle TraceFlags objects, regular ints, and test mocks
try:
flags = (
int(link.context.trace_flags)
& PB2SpanFlags.SPAN_FLAGS_TRACE_FLAGS_MASK
)
except (TypeError, ValueError):
# If conversion fails (e.g., Mock object), default to 0
flags = 0
flags |= PB2SpanFlags.SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK
if link.context.is_remote:
flags |= PB2SpanFlags.SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK

# For links, we encode the link's own context (not treating it as parent-child)
# The link context's is_remote indicates if the linked span is from a remote process
encoded_link = PB2SPan.Link(
trace_id=_encode_trace_id(link.context.trace_id),
span_id=_encode_span_id(link.context.span_id),
attributes=_encode_attributes(link.attributes),
dropped_attributes_count=link.dropped_attributes,
flags=flags,
flags=_span_flags(link.context.trace_flags, link.context),
)
pb2_links.append(encoded_link)
return pb2_links
Expand Down
Loading