tracer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRequestHeader = "X-Request-ID"

Functions

func Apply

func Apply(c *http.Client)

Apply modifies an http client's transport to inject the X-Request-ID header

func GetContextId added in v0.1.1

func GetContextId(ctx context.Context) string

GetContextId extracts the request ID from the given context

func GetRequestId

func GetRequestId(r *http.Request) string

GetRequestId extracts the request ID from the current request context

func NewFunc

func NewFunc(f func(w http.ResponseWriter, r *http.Request)) func(http.ResponseWriter, *http.Request)

NewFunc provides an HTTP HandlerFunc for injecting trace information

func NewHandler added in v0.2.0

func NewHandler(h http.Handler) http.Handler

Tracer provides an HTTP handler for injecting trace information

func SetRequestId

func SetRequestId(r *http.Request) *http.Request

SetRequestId returns a shallow copy of the origin request, with a request ID created or extracted from the X-Request-ID header

Types

type ContextKey added in v0.3.0

type ContextKey int
const (
	// Deprecated: replaced by concrete type ContextKey
	DefaultContextKey            = "id"
	ContextKeyID      ContextKey = iota
)

Jump to

Keyboard shortcuts

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