Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ var (
},
[]string{"handler"},
)
requestsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "thanos_http_requests_total",
Help: "Tracks the number of HTTP requests.",
}, []string{"code", "handler", "method"},
)
responseSize = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "thanos_http_response_size_bytes",
Expand Down Expand Up @@ -67,7 +73,10 @@ func instrumentHandler(handlerName string, handler http.HandlerFunc) http.Handle
requestDuration.MustCurryWith(prometheus.Labels{"handler": handlerName}),
promhttp.InstrumentHandlerResponseSize(
responseSize.MustCurryWith(prometheus.Labels{"handler": handlerName}),
handler,
promhttp.InstrumentHandlerCounter(
requestsTotal.MustCurryWith(prometheus.Labels{"handler": handlerName}),
handler,
),
),
)
}
Expand All @@ -92,6 +101,7 @@ func NewHandler(logger log.Logger, o *Options) *Handler {
if o.Registry != nil {
o.Registry.MustRegister(
requestDuration,
requestsTotal,
responseSize,
)
}
Expand Down