Documentation ¶
Index ¶
- Constants
- Variables
- func Handler(name string, handler http.Handler) http.Handler
- func HandlerFunc(name string, f func(http.ResponseWriter, *http.Request)) http.HandlerFunc
- func ServeMetrics()
- func SetBucketSuffixes(bs map[string]string)
- func SetBuckets(b map[string]string)
- func SetupTracer(ctx context.Context) func()
- func WrapTransport(t http.RoundTripper) http.RoundTripper
Constants ¶
View Source
const CeTypeHeader string = "ce-type"
Variables ¶
View Source
var Transport = WrapTransport(http.DefaultTransport)
Transport is an http.RoundTripper that records metrics for each request.
Functions ¶
func HandlerFunc ¶
func HandlerFunc(name string, f func(http.ResponseWriter, *http.Request)) http.HandlerFunc
Handler wraps a given http handler func in standard metrics handlers.
func ServeMetrics ¶
func ServeMetrics()
ServeMetrics serves the metrics endpoint if the METRICS_PORT env var is set.
func SetBucketSuffixes ¶
func SetBuckets ¶
func SetupTracer ¶
Fractions >= 1 will always sample. Fractions < 0 are treated as zero. To respect the parent trace's `SampledFlag`, the `TraceIDRatioBased` sampler should be used as a delegate of a `Parent` sampler.
Expected usage:
defer metrics.SetupTracer(ctx)()
func WrapTransport ¶
func WrapTransport(t http.RoundTripper) http.RoundTripper
WrapTransport wraps an http.RoundTripper with instrumentation.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.