Documentation ¶
Index ¶
- func InstrumentHandler(reg prometheus.Registerer, metricsOpts prometheus.Opts, ...) http.Handler
- func StandardHandlerLabeller(req *http.Request, resp *http.Response) prometheus.Labels
- func StandardRoundTripLabeller(req *http.Request, resp *http.Response) prometheus.Labels
- type ForcedCacheTransport
- type MonitoredRoundTripper
- type RateLimitedRoundTripper
- type RoundTripperFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentHandler ¶
func InstrumentHandler(reg prometheus.Registerer, metricsOpts prometheus.Opts, labeller func(req *http.Request, resp *http.Response) prometheus.Labels, h http.Handler) http.Handler
func StandardHandlerLabeller ¶
Types ¶
type ForcedCacheTransport ¶
type ForcedCacheTransport struct { Transport http.RoundTripper CacheDuration time.Duration }
ForcedCacheTransport forces the cache headers of http responses so subsequent caching libraries can cache the responses regardless of their original contents
type MonitoredRoundTripper ¶
type MonitoredRoundTripper struct { // Transport allows to customize the underneath RoundTripper // If not provided, http.DefaultTransport will be used Transport http.RoundTripper CallsCounter *prometheus.CounterVec Timings prometheus.HistogramVec Labeller func(req *http.Request, resp *http.Response) prometheus.Labels }
func NewMonitoredRoundTripper ¶
func NewMonitoredRoundTripper(reg prometheus.Registerer, metricsOpts prometheus.Opts, labeller func(req *http.Request, resp *http.Response) prometheus.Labels) *MonitoredRoundTripper
type RateLimitedRoundTripper ¶
type RateLimitedRoundTripper struct { // Transport allows to customize the underneath RoundTripper // If not provided, http.DefaultTransport will be used Transport http.RoundTripper // KeyFunc allows to group how requests will be grouped for rate limiting // the default behaviour returns the request method with full URL // ensuring that all calls to a specific endpoint will be serialized KeyFunc func(req *http.Request) string ConcurrentCallsLimit int // contains filtered or unexported fields }
RateLimitedRoundTripper ensures similar requests are serialised instead of run in parallel A tipical use is to use this in front of a caching layer to reduce the request rate to the upstream services
Click to show internal directories.
Click to hide internal directories.