mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Initial Store & Forward Implementation (#2917)
This adds store & forward relays into dendrite for p2p. A few things have changed: - new relay api serves new http endpoints for s&f federation - updated outbound federation queueing which will attempt to forward using s&f if appropriate - database entries to track s&f relays for other nodes
This commit is contained in:
parent
48fa869fa3
commit
5b73592f5a
77 changed files with 7646 additions and 1373 deletions
|
@ -108,13 +108,16 @@ func makeDownloadAPI(
|
|||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
) http.HandlerFunc {
|
||||
counterVec := promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: name,
|
||||
Help: "Total number of media_api requests for either thumbnails or full downloads",
|
||||
},
|
||||
[]string{"code"},
|
||||
)
|
||||
var counterVec *prometheus.CounterVec
|
||||
if cfg.Matrix.Metrics.Enabled {
|
||||
counterVec = promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: name,
|
||||
Help: "Total number of media_api requests for either thumbnails or full downloads",
|
||||
},
|
||||
[]string{"code"},
|
||||
)
|
||||
}
|
||||
httpHandler := func(w http.ResponseWriter, req *http.Request) {
|
||||
req = util.RequestWithLogging(req)
|
||||
|
||||
|
@ -166,5 +169,12 @@ func makeDownloadAPI(
|
|||
vars["downloadName"],
|
||||
)
|
||||
}
|
||||
return promhttp.InstrumentHandlerCounter(counterVec, http.HandlerFunc(httpHandler))
|
||||
|
||||
var handlerFunc http.HandlerFunc
|
||||
if counterVec != nil {
|
||||
handlerFunc = promhttp.InstrumentHandlerCounter(counterVec, http.HandlerFunc(httpHandler))
|
||||
} else {
|
||||
handlerFunc = http.HandlerFunc(httpHandler)
|
||||
}
|
||||
return handlerFunc
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue