mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-08 18:16:59 +00:00
Refactor InstrumentHandlerCounter definition
This commit is contained in:
parent
2baf5baa75
commit
9b5d6c9745
@ -85,14 +85,14 @@ func makeDownloadAPI(
|
||||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
) http.HandlerFunc {
|
||||
return promhttp.InstrumentHandlerCounter(
|
||||
promauto.NewCounterVec(
|
||||
counterVec := promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: name,
|
||||
Help: "Total number of media_api requests for either thumbnails or full downloads",
|
||||
},
|
||||
[]string{"code"},
|
||||
), http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
)
|
||||
httpHandler := func(w http.ResponseWriter, req *http.Request) {
|
||||
req = util.RequestWithLogging(req)
|
||||
|
||||
// Set common headers returned regardless of the outcome of the request
|
||||
@ -112,6 +112,6 @@ func makeDownloadAPI(
|
||||
activeThumbnailGeneration,
|
||||
name == "thumbnail",
|
||||
)
|
||||
},
|
||||
))
|
||||
}
|
||||
return promhttp.InstrumentHandlerCounter(counterVec, http.HandlerFunc(httpHandler))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user