1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-02-01 13:07:51 +02:00

Use a constant padding for 64-bit B3 trace IDs (#701)

This commit is contained in:
Anthony Mirabella 2020-05-06 11:09:41 -04:00 committed by GitHub
parent 2df5f81356
commit a547cc3bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.
@ -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
}