Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit 9eafe7a

Browse files
Sergey KanzhelevSergey Kanzhelev
authored andcommitted
fix build definition and allow for the empty tracestate
1 parent bc08c92 commit 9eafe7a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.vsts/ci-myget-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ steps:
4141
displayName: test
4242
inputs:
4343
command: "test"
44-
projects: "test/**/*.csproj"
44+
projects: "test/**/*.Tests.csproj"
4545
arguments: "--configuration Release"
4646

4747
- task: PublishTestResults@2

src/OpenCensus/Trace/Propagation/TraceContextFormat.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,32 @@ public override ISpanContext Extract<T>(T carrier, Func<T, string, IEnumerable<s
7272
{
7373
if (string.IsNullOrWhiteSpace(tracestate))
7474
{
75-
discardTracestate = true;
76-
break;
75+
continue;
7776
}
7877

7978
// tracestate: rojo=00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01,congo=BleGNlZWRzIHRohbCBwbGVhc3VyZS4
8079
var keyStartIdx = 0;
8180
var length = tracestate.Length;
8281
while (keyStartIdx < length)
8382
{
83+
// first skip any prefix commas and OWS
84+
var c = tracestate[keyStartIdx];
85+
while (c == ' ' || c == '\t' || c == ',')
86+
{
87+
keyStartIdx++;
88+
if (keyStartIdx == length)
89+
{
90+
break;
91+
}
92+
93+
c = tracestate[keyStartIdx];
94+
}
95+
96+
if (keyStartIdx == length)
97+
{
98+
break;
99+
}
100+
84101
var keyEndIdx = tracestate.IndexOf("=", keyStartIdx);
85102

86103
if (keyEndIdx == -1)

0 commit comments

Comments
 (0)