forked from TrueCloudLab/frostfs-node
[#426] Put prometheus behind pkg/metrics
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
3c0e47e6fd
commit
b8e10571c6
19 changed files with 561 additions and 311 deletions
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/metrics"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
|
||||
nmwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
|
||||
|
@ -184,7 +185,9 @@ type cfg struct {
|
|||
|
||||
profiler profiler.Profiler
|
||||
|
||||
metrics profiler.Metrics
|
||||
metricsServer profiler.Metrics
|
||||
|
||||
metricsCollector *metrics.StorageMetrics
|
||||
|
||||
workers []worker
|
||||
|
||||
|
@ -362,6 +365,10 @@ func initCfg(path string) *cfg {
|
|||
healthStatus: atomic.NewInt32(int32(control.HealthStatus_HEALTH_STATUS_UNDEFINED)),
|
||||
}
|
||||
|
||||
if viperCfg.GetBool(cfgMetricsEnable) {
|
||||
c.metricsCollector = metrics.NewStorageMetrics()
|
||||
}
|
||||
|
||||
initLocalStorage(c)
|
||||
|
||||
return c
|
||||
|
@ -457,7 +464,7 @@ func initLocalStorage(c *cfg) {
|
|||
|
||||
ls := engine.New(
|
||||
engine.WithLogger(c.log),
|
||||
engine.WithMetrics(c.viper.GetBool(cfgMetricsEnable)),
|
||||
engine.WithMetrics(c.metricsCollector),
|
||||
)
|
||||
|
||||
for _, opts := range c.cfgObject.cfgLocalStorage.shardOpts {
|
||||
|
|
|
@ -5,11 +5,13 @@ import (
|
|||
)
|
||||
|
||||
func initMetrics(c *cfg) {
|
||||
c.metrics = profiler.NewMetrics(c.log, c.viper)
|
||||
if c.metricsCollector != nil {
|
||||
c.metricsServer = profiler.NewMetrics(c.log, c.viper)
|
||||
}
|
||||
}
|
||||
|
||||
func serveMetrics(c *cfg) {
|
||||
if c.metrics != nil {
|
||||
c.metrics.Start(c.ctx)
|
||||
if c.metricsServer != nil {
|
||||
c.metricsServer.Start(c.ctx)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,8 +345,8 @@ func initObjectService(c *cfg) {
|
|||
)
|
||||
|
||||
var firstSvc objectService.ServiceServer = aclSvc
|
||||
if c.viper.GetBool(cfgMetricsEnable) {
|
||||
firstSvc = objectService.NewMetricCollector(aclSvc)
|
||||
if c.metricsCollector != nil {
|
||||
firstSvc = objectService.NewMetricCollector(aclSvc, c.metricsCollector)
|
||||
}
|
||||
|
||||
objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue