mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-22 14:41:01 +01:00
fix(metrics): Disable compression on prometheus/client_golang's handler
Fixes #406 Root cause seems to be that promhttp.Handler() has its own gzip compression https://github.com/prometheus/client_golang/issues/622
This commit is contained in:
parent
90bb8f7b5f
commit
24e207c0c6
@ -8,13 +8,16 @@ import (
|
||||
static "github.com/TwiN/gatus/v5/web"
|
||||
"github.com/TwiN/health"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
func CreateRouter(cfg *config.Config) *mux.Router {
|
||||
router := mux.NewRouter()
|
||||
if cfg.Metrics {
|
||||
router.Handle("/metrics", promhttp.Handler()).Methods("GET")
|
||||
router.Handle("/metrics", promhttp.InstrumentMetricHandler(prometheus.DefaultRegisterer, promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
|
||||
DisableCompression: true,
|
||||
}))).Methods("GET")
|
||||
}
|
||||
router.Use(GzipHandler)
|
||||
api := router.PathPrefix("/api").Subrouter()
|
||||
|
Loading…
Reference in New Issue
Block a user