22 lines
775 B
Go
22 lines
775 B
Go
// Package constants define constant variable
|
|
package constants
|
|
|
|
// Internal context keys for trace values set by StartTrace middleware.
|
|
// These are gin/stdlib context keys only — actual W3C header propagation
|
|
// (traceparent / tracestate) is handled automatically by the OTel propagator.
|
|
const (
|
|
HeaderTraceID = "trace-id"
|
|
HeaderSpanID = "span-id"
|
|
HeaderParentSpanID = "parent-span-id"
|
|
)
|
|
|
|
// 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)
|
|
)
|