mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Enable/Disable internal metrics (#2899)
Basically enables us to use `test.WithAllDatabases` when testing internal HTTP APIs, as this would otherwise result in Prometheus complaining about already registered metric names.
This commit is contained in:
parent
b65f89e61e
commit
e245a26f6b
20 changed files with 164 additions and 154 deletions
|
@ -16,24 +16,25 @@ package inthttp
|
|||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/userapi/api"
|
||||
)
|
||||
|
||||
// addRoutesLoginToken adds routes for all login token API calls.
|
||||
func addRoutesLoginToken(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
||||
func addRoutesLoginToken(internalAPIMux *mux.Router, s api.UserInternalAPI, enableMetrics bool) {
|
||||
internalAPIMux.Handle(
|
||||
PerformLoginTokenCreationPath,
|
||||
httputil.MakeInternalRPCAPI("UserAPIPerformLoginTokenCreation", s.PerformLoginTokenCreation),
|
||||
httputil.MakeInternalRPCAPI("UserAPIPerformLoginTokenCreation", enableMetrics, s.PerformLoginTokenCreation),
|
||||
)
|
||||
|
||||
internalAPIMux.Handle(
|
||||
PerformLoginTokenDeletionPath,
|
||||
httputil.MakeInternalRPCAPI("UserAPIPerformLoginTokenDeletion", s.PerformLoginTokenDeletion),
|
||||
httputil.MakeInternalRPCAPI("UserAPIPerformLoginTokenDeletion", enableMetrics, s.PerformLoginTokenDeletion),
|
||||
)
|
||||
|
||||
internalAPIMux.Handle(
|
||||
QueryLoginTokenPath,
|
||||
httputil.MakeInternalRPCAPI("UserAPIQueryLoginToken", s.QueryLoginToken),
|
||||
httputil.MakeInternalRPCAPI("UserAPIQueryLoginToken", enableMetrics, s.QueryLoginToken),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue