frostfs-s3-gw/cmd/s3-gw/app-metrics.go

21 lines
406 B
Go
Raw Normal View History

2020-07-06 09:18:16 +00:00
package main
import (
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/viper"
2020-07-12 23:00:47 +00:00
"go.uber.org/zap"
2020-07-06 09:18:16 +00:00
)
func attachMetrics(r *mux.Router, v *viper.Viper, l *zap.Logger) {
2020-07-07 11:25:13 +00:00
if !v.GetBool(cfgEnableMetrics) {
2020-07-06 09:18:16 +00:00
return
}
2020-07-12 23:00:47 +00:00
l.Info("enable metrics")
r.PathPrefix(systemPath+"/metrics").
Subrouter().
StrictSlash(true).
Handle("", promhttp.Handler())
2020-07-06 09:18:16 +00:00
}