You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-08-10 22:31:50 +02:00
Add flag to determine whether SpanContext is remote (#1701)
* Add remote property to SpanContext * Set SpanContext.remote when extracting context in TraceContext propagator * Ensure remote flag is set when inserting remote SpanContext into context * Ensure tests are expecting remote flag in SpanContext where appropriate * Update CHANGELOG.md * Apply PR feedback Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0fe65e6bd2
commit
860d5d86e7
@@ -133,6 +133,7 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
scc.TraceFlags = opts[0] & trace.FlagsSampled
|
||||
|
||||
scc.TraceState = parseTraceState(carrier.Get(tracestateHeader))
|
||||
scc.Remote = true
|
||||
|
||||
sc := trace.NewSpanContext(scc)
|
||||
if !sc.IsValid() {
|
||||
|
@@ -40,6 +40,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -49,6 +50,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -58,6 +60,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -67,6 +70,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -75,6 +79,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -84,6 +89,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -93,6 +99,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -102,6 +109,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceFlags: trace.FlagsSampled,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
}
|
||||
@@ -302,6 +310,7 @@ func TestTraceStatePropagation(t *testing.T) {
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
TraceState: state,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -314,6 +323,7 @@ func TestTraceStatePropagation(t *testing.T) {
|
||||
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -326,6 +336,7 @@ func TestTraceStatePropagation(t *testing.T) {
|
||||
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
||||
TraceID: traceID,
|
||||
SpanID: spanID,
|
||||
Remote: true,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user