diff --git a/cluster/calcium/metrics.go b/cluster/calcium/metrics.go index 7affcd9cf..a09046a1c 100644 --- a/cluster/calcium/metrics.go +++ b/cluster/calcium/metrics.go @@ -18,7 +18,7 @@ func (c *Calcium) InitMetrics(ctx context.Context) { logger.Error(ctx, err, "failed to get metrics description") return } - if err = metrics.InitMetrics(c.config, metricsDescriptions); err != nil { + if err = metrics.InitMetrics(ctx, c.config, metricsDescriptions); err != nil { logger.Error(ctx, err, "failed to init metrics") return } diff --git a/metrics/metrics.go b/metrics/metrics.go index 67198c57f..aa311a140 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -130,7 +130,7 @@ var Client = Metrics{} var once sync.Once // InitMetrics new a metrics obj -func InitMetrics(config types.Config, metricsDescriptions []*plugintypes.MetricsDescription) error { +func InitMetrics(ctx context.Context, config types.Config, metricsDescriptions []*plugintypes.MetricsDescription) error { hostname, err := os.Hostname() if err != nil { return err @@ -139,6 +139,10 @@ func InitMetrics(config types.Config, metricsDescriptions []*plugintypes.Metrics if err != nil { return err } + if err := rmgr.LoadPlugins(ctx, nil); err != nil { + return err + } + Client = Metrics{ Config: config, StatsdAddr: config.Statsd,