Documentation ¶
Index ¶
- func InstrumentedRoundTripper(tripper http.RoundTripper, m *ClientMetrics) http.RoundTripper
- type ClientMetrics
- type InstrumentationMiddleware
- func NewInstrumentationMiddleware(reg prometheus.Registerer, buckets []float64) InstrumentationMiddleware
- func NewNopInstrumentationMiddleware() InstrumentationMiddleware
- func NewTenantInstrumentationMiddleware(tenantHeaderName string, reg prometheus.Registerer, buckets []float64) InstrumentationMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentedRoundTripper ¶ added in v0.23.0
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 ¶ added in v0.23.0
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 ¶ added in v0.23.0
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.
func NewTenantInstrumentationMiddleware ¶ added in v0.28.0
func NewTenantInstrumentationMiddleware(tenantHeaderName string, reg prometheus.Registerer, buckets []float64) InstrumentationMiddleware
NewTenantInstrumentationMiddleware provides the same instrumentation as defaultInstrumentationMiddleware, but with a tenant label fetched from the given tenantHeaderName header. Passing nil as buckets uses the default buckets.