2025-10-15 17:08:32 +08:00
|
|
|
// Package constants define constant variable
|
|
|
|
|
package constants
|
|
|
|
|
|
|
|
|
|
// Assuming the B3 specification
|
|
|
|
|
const (
|
|
|
|
|
HeaderTraceID = "X-B3-TraceId"
|
|
|
|
|
HeaderSpanID = "X-B3-SpanId"
|
|
|
|
|
HeaderParentSpanID = "X-B3-ParentSpanId"
|
|
|
|
|
)
|
2026-04-23 16:48:32 +08:00
|
|
|
|
|
|
|
|
// traceCtxKey is an unexported type for context keys to avoid collisions with other packages.
|
|
|
|
|
type traceCtxKey string
|
|
|
|
|
|
|
|
|
|
// Typed context keys for trace values — use these with context.WithValue / ctx.Value.
|
|
|
|
|
var (
|
|
|
|
|
CtxKeyTraceID = traceCtxKey(HeaderTraceID)
|
|
|
|
|
CtxKeySpanID = traceCtxKey(HeaderSpanID)
|
|
|
|
|
CtxKeyParentSpanID = traceCtxKey(HeaderParentSpanID)
|
|
|
|
|
)
|