frostfs-s3-gw/cmd/s3-gw/app_metrics.go

26 lines
549 B
Go
Raw Normal View History

2020-07-06 09:18:16 +00:00
package main
import (
"net/http"
2020-07-06 09:18:16 +00:00
"github.com/spf13/viper"
2020-07-12 23:00:47 +00:00
"go.uber.org/zap"
2020-07-06 09:18:16 +00:00
)
// NewPrometheusService creates a new service for gathering prometheus metrics.
func NewPrometheusService(v *viper.Viper, log *zap.Logger, handler http.Handler) *Service {
if log == nil {
return nil
}
return &Service{
Server: &http.Server{
Addr: v.GetString(cfgPrometheusAddress),
Handler: handler,
},
enabled: v.GetBool(cfgPrometheusEnabled),
serviceType: "Prometheus",
log: log.With(zap.String("service", "Prometheus")),
}
2020-07-06 09:18:16 +00:00
}