Skip to content

Commit

Permalink
fixed #104 (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwen5 authored Sep 7, 2022
1 parent 8098ff5 commit 04916eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion source/tracing_context_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ TracingContextImpl::TracingContextImpl(
SpanContextExtensionPtr parent_ext_span_context, RandomGenerator& random)
: parent_span_context_(std::move(parent_span_context)),
parent_ext_span_context_(std::move(parent_ext_span_context)) {
segment_store_.set_traceid(random.uuid());
segment_store_.set_traceid(
parent_span_context_ ? parent_span_context_->traceId() : random.uuid());
segment_store_.set_tracesegmentid(random.uuid());
segment_store_.set_service(service_name);
segment_store_.set_serviceinstance(instance_name);
Expand Down
4 changes: 2 additions & 2 deletions test/tracing_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ TEST_F(TracingContextTest, SW8CreateTest) {
span2->endSpan();

std::string expect_sw8(
"1-dXVpZA==-dXVpZA==-1-bWVzaA==-c2VydmljZV8w-c2FtcGxlMQ==-"
"1-MQ==-dXVpZA==-1-bWVzaA==-c2VydmljZV8w-c2FtcGxlMQ==-"
"MTAuMC4wLjE6NDQz");

EXPECT_EQ(expect_sw8, *sc.createSW8HeaderValue(target_address));
Expand Down Expand Up @@ -388,7 +388,7 @@ TEST_F(TracingContextTest, TraceLogTest) {
TracingContextImpl sc(config_.service_name(), config_.instance_name(),
span_ctx_, span_ext_ctx_, random_);
EXPECT_EQ(
"test\", \"SW_CTX\": [\"mesh\",\"service_0\",\"uuid\",\"uuid\",\"-1\"]}",
"test\", \"SW_CTX\": [\"mesh\",\"service_0\",\"1\",\"uuid\",\"-1\"]}",
sc.logMessage("test"));
}

Expand Down

0 comments on commit 04916eb

Please sign in to comment.