Skip to content

Commit

Permalink
Use a constant padding for 64-bit B3 trace IDs (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneurysm9 authored May 6, 2020
1 parent 2df5f81 commit a547cc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/trace/b3_propagator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
B3SpanIDHeader = "X-B3-SpanId"
B3SampledHeader = "X-B3-Sampled"
B3ParentSpanIDHeader = "X-B3-ParentSpanId"
b3TraceIDPadding = "0000000000000000"
)

// B3 propagator serializes SpanContext to/from B3 Headers.
Expand Down Expand Up @@ -89,7 +90,7 @@ func (b3 B3) Extract(ctx context.Context, supplier propagation.HTTPSupplier) con

func fixB3TID(in string) string {
if len(in) == 16 {
in = strings.Repeat("0", 16) + in
in = b3TraceIDPadding + in
}
return in
}
Expand Down

0 comments on commit a547cc3

Please sign in to comment.