diff options
author | Valery Piashchynski <[email protected]> | 2021-08-13 02:44:58 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-08-13 02:44:58 +0300 |
commit | 4f59820cc72f4d02d5167311f708b4df41973269 (patch) | |
tree | f6d90422eb50d62de14ed8cbcce8e11c5510d1e1 /plugins/metrics | |
parent | 8cdac2daf2fc4a1a95ddebca585f4ec38beff210 (diff) |
Update deprecated prometheus collectors.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/metrics')
-rw-r--r-- | plugins/metrics/plugin.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index 1f65e313..d285e609 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -8,6 +8,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spiral/errors" "github.com/spiral/roadrunner/v2/plugins/config" @@ -53,24 +54,24 @@ func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error { p.registry = prometheus.NewRegistry() // Default - err = p.registry.Register(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})) + err = p.registry.Register(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})) if err != nil { return errors.E(op, err) } // Default - err = p.registry.Register(prometheus.NewGoCollector()) + err = p.registry.Register(collectors.NewGoCollector()) if err != nil { return errors.E(op, err) } - collectors, err := p.cfg.getCollectors() + cl, err := p.cfg.getCollectors() if err != nil { return errors.E(op, err) } // Register invocation will be later in the Serve method - for k, v := range collectors { + for k, v := range cl { p.collectors.Store(k, v) } |