Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

[zipkin] Encode span IDs as full 16-hex strings #601

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions zipkin/propagation.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func (p Propagator) Inject(

textMapWriter.Set("x-b3-traceid", sc.TraceID().String())
if sc.ParentID() != 0 {
textMapWriter.Set("x-b3-parentspanid", strconv.FormatUint(uint64(sc.ParentID()), 16))
textMapWriter.Set("x-b3-parentspanid", sc.ParentID().String())
}
textMapWriter.Set("x-b3-spanid", strconv.FormatUint(uint64(sc.SpanID()), 16))
textMapWriter.Set("x-b3-spanid", sc.SpanID().String())
if sc.IsSampled() {
textMapWriter.Set("x-b3-sampled", "1")
} else {
Expand Down
20 changes: 10 additions & 10 deletions zipkin/propagation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ var (
var (
rootSampledHeader = opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-sampled": "1",
"baggage-foo": "bar",
}
nonRootSampledHeader = opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-parentspanid": "1",
"x-b3-spanid": "0000000000000002",
"x-b3-parentspanid": "0000000000000001",
"x-b3-sampled": "1",
}
nonRootNonSampledHeader = opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-parentspanid": "1",
"x-b3-spanid": "0000000000000002",
"x-b3-parentspanid": "0000000000000001",
"x-b3-sampled": "0",
}
rootSampledBooleanHeader = opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-sampled": "true",
"baggage-foo": "bar",
}
nonRootSampledBooleanHeader = opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-parentspanid": "1",
"x-b3-sampled": "true",
}
Expand All @@ -69,12 +69,12 @@ var (
}
sampled128bitTraceID = opentracing.TextMapCarrier{
"x-b3-traceid": "463ac35c9f6413ad48485a3953bb6124",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-sampled": "1",
}
invalidTraceID = opentracing.TextMapCarrier{
"x-b3-traceid": "00000000000000000000000000000000",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-sampled": "1",
}
)
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestCustomBaggagePrefix(t *testing.T) {
assert.Nil(t, err)
m := opentracing.TextMapCarrier{
"x-b3-traceid": "0000000000000001",
"x-b3-spanid": "2",
"x-b3-spanid": "0000000000000002",
"x-b3-sampled": "1",
"emoji:)foo": "bar",
}
Expand Down