Skip to content
Closed
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions ddprof-lib/src/main/cpp/flightRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,9 +1699,11 @@ void Recording::writeContextSnapshot(Buffer *buf, Context &context) {
void Recording::writeCurrentContext(Buffer *buf) {
u64 spanId = 0;
u64 rootSpanId = 0;
bool hasContext = ContextApi::get(spanId, rootSpanId);
// spanId/rootSpanId are initialized to 0 above; ContextApi::get() only updates them
// on success, so 0s are always written when there is no valid context.
// on success, so 0s are always written when there is no active span.
// hasContext gates sidecar reads: getOtelTagEncoding() must only be called
// when valid=1 (see thread.h read invariant).
bool hasContext = ContextApi::get(spanId, rootSpanId);
buf->putVar64(spanId);
buf->putVar64(rootSpanId);

Expand Down
Loading