frostfs-s3-gw/cmd/s3-gw/app_metrics.go
Denis Kirillov 9f823bd65a [TrueCloudLab#26] Add billing metrics to separate registry
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-02-10 10:55:38 +03:00

25 lines
549 B
Go

package main
import (
"net/http"
"github.com/spf13/viper"
"go.uber.org/zap"
)
// 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")),
}
}