Skip to content

Commit 51eef56

Browse files
authored
Rename SpanContext.HasRemoteParent to SpanContext.IsRemote (#529)
1 parent d65d7c0 commit 51eef56

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

api/include/opentelemetry/trace/span_context.h

+9-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace trace_api = opentelemetry::trace;
2626

2727
/* SpanContext contains the state that must propagate to child Spans and across
2828
* process boundaries. It contains the identifiers TraceId and SpanId,
29-
* TraceFlags, TraceState, and whether it has a remote parent.
29+
* TraceFlags, TraceState, and whether it was propagated from a remote parent.
3030
*
3131
* TODO: This is currently a placeholder class and requires revisiting
3232
*/
@@ -38,14 +38,14 @@ class SpanContext final
3838
*
3939
* @param sampled_flag a required parameter specifying if child spans should be
4040
* sampled
41-
* @param has_remote_parent a required parameter specifying if this context has
42-
* a remote parent
41+
* @param is_remote true if this context was propagated from a remote parent.
4342
*/
44-
SpanContext(bool sampled_flag, bool has_remote_parent)
43+
SpanContext(bool sampled_flag, bool is_remote)
4544
: trace_id_(),
4645
span_id_(),
4746
trace_flags_(trace_api::TraceFlags((uint8_t)sampled_flag)),
48-
remote_parent_(has_remote_parent){};
47+
is_remote_(is_remote)
48+
{}
4949

5050
// @returns whether this context is valid
5151
bool IsValid() const noexcept { return trace_id_.IsValid() && span_id_.IsValid(); }
@@ -57,14 +57,8 @@ class SpanContext final
5757

5858
const trace_api::SpanId &span_id() const noexcept { return span_id_; }
5959

60-
SpanContext(TraceId trace_id,
61-
SpanId span_id,
62-
TraceFlags trace_flags,
63-
bool has_remote_parent) noexcept
64-
: trace_id_(trace_id),
65-
span_id_(span_id),
66-
trace_flags_(trace_flags),
67-
remote_parent_(has_remote_parent)
60+
SpanContext(TraceId trace_id, SpanId span_id, TraceFlags trace_flags, bool is_remote) noexcept
61+
: trace_id_(trace_id), span_id_(span_id), trace_flags_(trace_flags), is_remote_(is_remote)
6862
{}
6963

7064
SpanContext(const SpanContext &ctx) = default;
@@ -77,7 +71,7 @@ class SpanContext final
7771
trace_flags() == that.trace_flags();
7872
}
7973

80-
bool HasRemoteParent() const noexcept { return remote_parent_; }
74+
bool IsRemote() const noexcept { return is_remote_; }
8175

8276
static SpanContext GetInvalid() { return SpanContext(false, false); }
8377

@@ -87,7 +81,7 @@ class SpanContext final
8781
trace_api::TraceId trace_id_;
8882
trace_api::SpanId span_id_;
8983
trace_api::TraceFlags trace_flags_;
90-
bool remote_parent_ = false;
84+
bool is_remote_ = false;
9185
};
9286
} // namespace trace
9387
OPENTELEMETRY_END_NAMESPACE

api/test/trace/propagation/http_text_format_test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ TEST(HTTPTextFormatTest, SetRemoteSpan)
111111
EXPECT_EQ(Hex(span->GetContext().trace_id()), "4bf92f3577b34da6a3ce929d0e0e4736");
112112
EXPECT_EQ(Hex(span->GetContext().span_id()), "0102030405060708");
113113
EXPECT_EQ(span->GetContext().IsSampled(), true);
114-
EXPECT_EQ(span->GetContext().HasRemoteParent(), true);
114+
EXPECT_EQ(span->GetContext().IsRemote(), true);
115115
}
116116

117117
TEST(HTTPTextFormatTest, GetCurrentSpan)

api/test/trace/span_context_test.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ TEST(SpanContextTest, IsSampled)
1717
ASSERT_EQ(s2.IsSampled(), false);
1818
}
1919

20-
TEST(SpanContextTest, HasRemoteParent)
20+
TEST(SpanContextTest, IsRemote)
2121
{
2222
SpanContext s1(true, true);
2323

24-
ASSERT_EQ(s1.HasRemoteParent(), true);
24+
ASSERT_EQ(s1.IsRemote(), true);
2525

2626
SpanContext s2(true, false);
2727

28-
ASSERT_EQ(s2.HasRemoteParent(), false);
28+
ASSERT_EQ(s2.IsRemote(), false);
2929
}
3030

3131
TEST(SpanContextTest, TraceFlags)

0 commit comments

Comments
 (0)