mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 19:03:09 -06:00
Proper instrumenthandler fix
This commit is contained in:
parent
8f6ee9de9c
commit
f0e81464c1
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
|
|
@ -80,13 +81,14 @@ func makeDownloadAPI(
|
|||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
) http.HandlerFunc {
|
||||
handlerInfo := prometheus.NewCounterVec(
|
||||
return promhttp.InstrumentHandlerCounter(
|
||||
promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: name,
|
||||
Help: "Total number of media_api requests for either thumbnails or full downloads",
|
||||
},
|
||||
[]string{name},
|
||||
)
|
||||
return promhttp.InstrumentHandlerCounter(handlerInfo, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
[]string{"code"},
|
||||
), http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
req = util.RequestWithLogging(req)
|
||||
|
||||
// Set common headers returned regardless of the outcome of the request
|
||||
|
|
@ -107,5 +109,6 @@ func makeDownloadAPI(
|
|||
activeThumbnailGeneration,
|
||||
name == "thumbnail",
|
||||
)
|
||||
}))
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue