[chore/bugfix] Fix double gzip on prometheus endpoint (#2383)

* [chore] Move "/metrics" into separate API module

* use our own gzip middleware for prom
This commit is contained in:
tobi 2023-11-23 19:10:51 +01:00 committed by GitHub
commit 2b9cf56f56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 22 deletions

View file

@ -293,6 +293,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
var (
authModule = api.NewAuth(dbService, processor, idp, routerSession, sessionName) // auth/oauth paths
clientModule = api.NewClient(dbService, processor) // api client endpoints
metricsModule = api.NewMetrics() // Metrics endpoints
fileserverModule = api.NewFileserver(processor) // fileserver endpoints
wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints
nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint
@ -322,6 +323,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
// apply throttling *after* rate limiting
authModule.Route(router, clLimit, clThrottle, gzip)
clientModule.Route(router, clLimit, clThrottle, gzip)
metricsModule.Route(router, clLimit, clThrottle, gzip)
fileserverModule.Route(router, fsLimit, fsThrottle)
wellKnownModule.Route(router, gzip, s2sLimit, s2sThrottle)
nodeInfoModule.Route(router, s2sLimit, s2sThrottle, gzip)

View file

@ -212,6 +212,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
var (
authModule = api.NewAuth(state.DB, processor, idp, routerSession, sessionName) // auth/oauth paths
clientModule = api.NewClient(state.DB, processor) // api client endpoints
metricsModule = api.NewMetrics() // Metrics endpoints
fileserverModule = api.NewFileserver(processor) // fileserver endpoints
wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints
nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint
@ -222,6 +223,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
// these should be routed in order
authModule.Route(router)
clientModule.Route(router)
metricsModule.Route(router)
fileserverModule.Route(router)
wellKnownModule.Route(router)
nodeInfoModule.Route(router)