Documentation
¶
Index ¶
- Constants
- func CopyAll(outReq *http.Request, req *http.Request)
- func CopyAllSecure(outReq *http.Request, req *http.Request)
- func EnsureRootSpan(ctx context.Context, operationName string) (context.Context, trace.Span)
- func ExtractTraceContext(req *http.Request) context.Context
- func InjectTraceHeaders(ctx context.Context, req *http.Request, format string)
- func ParseTraceparent(traceparent string) (traceID, spanID string, sampled bool, err error)
- func SetProxyHeaders(outReq *http.Request, req *http.Request)
- type TraceInfo
Constants ¶
View Source
const ( TraceFormatOTEL = "otel" TraceFormatDatadog = "datadog" TraceFormatBoth = "both" )
Trace format constants
View Source
const ( TraceparentHeader = "traceparent" TracestateHeader = "tracestate" )
W3C Trace Context headers
View Source
const ( DatadogTraceIDHeader = "x-datadog-trace-id" DatadogParentIDHeader = "x-datadog-parent-id" DatadogSamplingPriorityHeader = "x-datadog-sampling-priority" DatadogOriginHeader = "x-datadog-origin" )
Datadog trace headers
Variables ¶
This section is empty.
Functions ¶
func EnsureRootSpan ¶
EnsureRootSpan creates a root span if none exists in the context Returns the context with span and the span itself
func ExtractTraceContext ¶
ExtractTraceContext extracts trace context from incoming request headers Supports both W3C traceparent and Datadog headers
func InjectTraceHeaders ¶
InjectTraceHeaders injects trace headers into outgoing request based on format
func ParseTraceparent ¶
ParseTraceparent parses a W3C traceparent header value
Types ¶
type TraceInfo ¶
type TraceInfo struct {
TraceID string // 128-bit hex (OTEL format)
SpanID string // 64-bit hex (OTEL format)
DDTraceID string // 64-bit decimal (Datadog format - lower 64 bits of trace ID)
DDSpanID string // 64-bit decimal (Datadog format)
Sampled bool
HasValidTrace bool
}
TraceInfo contains extracted trace information
func GetTraceInfo ¶
GetTraceInfo extracts trace information from context in both formats
Click to show internal directories.
Click to hide internal directories.