Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Do not strip leading zeros from span IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstadler committed Jan 29, 2021
1 parent 540f6a1 commit 7ac480b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/jaegertracing/SpanContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ class SpanContext : public opentracing::SpanContext {
void print(Stream& out) const
{
_traceID.print(out);
out << ':' << std::hex << _spanID << ':' << std::hex << _parentID << ':'
<< std::hex << static_cast<size_t>(_flags);
out << ':' << std::setw(16) << std::setfill('0') << std::hex << _spanID
<< ':' << std::setw(16) << std::setfill('0') << std::hex << _parentID
<< ':' << std::hex << static_cast<size_t>(_flags);
}

void ForeachBaggageItem(
Expand Down
2 changes: 1 addition & 1 deletion src/jaegertracing/SpanContextTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST(SpanContext, testFormatting)
SpanContext spanContext(TraceID(255, 255), 0, 0, 0, SpanContext::StrMap());
std::ostringstream oss;
oss << spanContext;
ASSERT_EQ("00000000000000ff00000000000000ff:0:0:0", oss.str());
ASSERT_EQ("00000000000000ff00000000000000ff:0000000000000000:0000000000000000:0", oss.str());
}

TEST(SpanContext, testBaggage)
Expand Down

0 comments on commit 7ac480b

Please # to comment.