Documentation
¶
Overview ¶
Package http provides helper to propagate monkit traces via HTTP calls.
Index ¶
- func TraceHandler(c http.Handler, scope *monkit.Scope, allowedBaggage ...string) http.Handler
- func TraceRequest(ctx context.Context, scope *monkit.Scope, cl Client, req *http.Request) (resp *http.Response, err error)
- func Wrap(w http.ResponseWriter) (http.ResponseWriter, func() int)
- type Client
- type HeaderGetter
- type HeaderSetter
- type TraceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TraceHandler ¶
TraceHandler wraps a HTTPHandler and import trace information from header.
func TraceRequest ¶
func TraceRequest(ctx context.Context, scope *monkit.Scope, cl Client, req *http.Request) ( resp *http.Response, err error)
TraceRequest will perform an HTTP request, creating a new Span for the HTTP request and sending the Span in the HTTP request headers. Compare to http.Client.Do.
func Wrap ¶
func Wrap(w http.ResponseWriter) (http.ResponseWriter, func() int)
Wrap wraps original writer + provides func to retrieve statusCode, implements http.Flusher if original writer also did it.
Types ¶
type HeaderGetter ¶
HeaderGetter is an interface that http.Header matches for RequestFromHeader
type HeaderSetter ¶
HeaderSetter is an interface that http.Header matches for TraceInfo.SetHeader
type TraceInfo ¶
TraceInfo is a structure representing an incoming RPC request. Every field is optional.
func TraceInfoFromHeader ¶
func TraceInfoFromHeader(header HeaderGetter, allowedBaggage ...string) (rv TraceInfo)
TraceInfoFromHeader will create a TraceInfo object given a http.Header or anything that matches the HeaderGetter interface.
func TraceInfoFromSpan ¶
func TraceInfoFromSpan(s *monkit.Span) TraceInfo
func (TraceInfo) SetHeader ¶
func (r TraceInfo) SetHeader(header HeaderSetter)
SetHeader will take a TraceInfo and fill out an http.Header, or anything that matches the HeaderSetter interface.