forked from TrueCloudLab/frostfs-node
Add Inner Ring code
This commit is contained in:
parent
dadfd90dcd
commit
b7b5079934
400 changed files with 11420 additions and 8690 deletions
32
pkg/util/profiler/metrics.go
Normal file
32
pkg/util/profiler/metrics.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package profiler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Metrics is an interface of metric tool.
|
||||
type Metrics interface {
|
||||
Start(ctx context.Context)
|
||||
Stop()
|
||||
}
|
||||
|
||||
const metricsKey = "metrics"
|
||||
|
||||
// NewMetrics is a metric tool's constructor.
|
||||
func NewMetrics(l *zap.Logger, v *viper.Viper) Metrics {
|
||||
if !v.GetBool(metricsKey + ".enabled") {
|
||||
l.Debug("metrics server disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
return newHTTPServer(httpParams{
|
||||
Key: metricsKey,
|
||||
Viper: v,
|
||||
Logger: l,
|
||||
Handler: promhttp.Handler(),
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue