http

package
v0.23.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 10

Documentation

Index

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.

Jump to

Keyboard shortcuts

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