b3

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package b3 implements serialization and deserialization logic for Zipkin B3 Headers.

Index

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

func GetGRPCHeader(md *metadata.MD, key string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL