Documentation ¶
Overview ¶
Package b3 implements serialization and deserialization logic for Zipkin B3 Headers.
Index ¶
- Constants
- Variables
- func ExtractGRPC(md *metadata.MD) propagation.Extractor
- func ExtractHTTP(r *http.Request) propagation.Extractor
- func GetGRPCHeader(md *metadata.MD, key string) string
- func InjectGRPC(md *metadata.MD) propagation.Injector
- func InjectHTTP(r *http.Request) propagation.Injector
- func ParseHeaders(hdrTraceID, hdrSpanID, hdrParentSpanID, hdrSampled, hdrFlags string) (*model.SpanContext, error)
Constants ¶
View Source
const ( TraceID = "x-b3-traceid" SpanID = "x-b3-spanid" ParentSpanID = "x-b3-parentspanid" Sampled = "x-b3-sampled" Flags = "x-b3-flags" )
Default B3 Header keys
Variables ¶
View Source
var ( ErrInvalidSampledHeader = errors.New("invalid B3 Sampled header found") ErrInvalidFlagsHeader = errors.New("invalid B3 Flags header found") ErrInvalidTraceIDHeader = errors.New("invalid B3 TraceID header found") ErrInvalidSpanIDHeader = errors.New("invalid B3 SpanID header found") ErrInvalidParentSpanIDHeader = errors.New("invalid B3 ParentSpanID header found") ErrInvalidScope = errors.New("require either both TraceID and SpanID or none") ErrInvalidScopeParent = errors.New("ParentSpanID requires both TraceID and SpanID to be available") ErrEmptyContext = errors.New("empty request context") )
Common Header Extraction / Injection errors
Functions ¶
func ExtractGRPC ¶
func ExtractGRPC(md *metadata.MD) propagation.Extractor
ExtractGRPC will extract a span.Context from the gRPC Request metadata if found in B3 header format.
func ExtractHTTP ¶
func ExtractHTTP(r *http.Request) propagation.Extractor
ExtractHTTP will extract a span.Context from the HTTP Request if found in B3 header format.
func GetGRPCHeader ¶
GetGRPCHeader retrieves the last value found for a particular key. If key is not found it returns an empty string.
func InjectGRPC ¶
func InjectGRPC(md *metadata.MD) propagation.Injector
InjectGRPC will inject a span.Context into gRPC metadata.
func InjectHTTP ¶
func InjectHTTP(r *http.Request) propagation.Injector
InjectHTTP will inject a span.Context into a HTTP Request
func ParseHeaders ¶
func ParseHeaders( hdrTraceID, hdrSpanID, hdrParentSpanID, hdrSampled, hdrFlags string, ) (*model.SpanContext, error)
ParseHeaders takes values found from B3 Headers and tries to reconstruct a SpanContext.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.