Help us shape the future of Go! Take the 2026 Go Developer Survey

http

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentedRoundTripper

func InstrumentedRoundTripper(tripper http.RoundTripper, m *ClientMetrics) http.RoundTripper

InstrumentedRoundTripper instruments the given roundtripper with metrics that are registered in the provided ClientMetrics.

Types

type ClientMetrics

type ClientMetrics struct {
	// contains filtered or unexported fields
}

ClientMetrics holds a collection of metrics that can be used to instrument a http client. By setting this field in HTTPClientConfig, NewHTTPClient will create an instrumented client.

func NewClientMetrics

func NewClientMetrics(reg prometheus.Registerer) *ClientMetrics

NewClientMetrics creates a new instance of ClientMetrics. It will also register the metrics with the included register. This ClientMetrics should be re-used for diff clients with the same purpose. e.g. 1 ClientMetrics should be used for all the clients that talk to Alertmanager.

type InstrumentationMiddleware

type InstrumentationMiddleware interface {
	// NewHandler wraps the given HTTP handler for instrumentation.
	NewHandler(handlerName string, handler http.Handler) http.HandlerFunc
}

InstrumentationMiddleware holds necessary metrics to instrument an http.Server and provides necessary behaviors.

func NewInstrumentationMiddleware

func NewInstrumentationMiddleware(reg prometheus.Registerer, buckets []float64) InstrumentationMiddleware

NewInstrumentationMiddleware provides default InstrumentationMiddleware. Passing nil as buckets uses the default buckets.

func NewNopInstrumentationMiddleware

func NewNopInstrumentationMiddleware() InstrumentationMiddleware

NewNopInstrumentationMiddleware provides a InstrumentationMiddleware which does nothing.

Jump to

Keyboard shortcuts

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