Skip to content

Commit 9bee0e8

Browse files
authored
load plugins when init metrics (#608)
1 parent 3038a70 commit 9bee0e8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cluster/calcium/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func (c *Calcium) InitMetrics(ctx context.Context) {
1818
logger.Error(ctx, err, "failed to get metrics description")
1919
return
2020
}
21-
if err = metrics.InitMetrics(c.config, metricsDescriptions); err != nil {
21+
if err = metrics.InitMetrics(ctx, c.config, metricsDescriptions); err != nil {
2222
logger.Error(ctx, err, "failed to init metrics")
2323
return
2424
}

metrics/metrics.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ var Client = Metrics{}
130130
var once sync.Once
131131

132132
// InitMetrics new a metrics obj
133-
func InitMetrics(config types.Config, metricsDescriptions []*plugintypes.MetricsDescription) error {
133+
func InitMetrics(ctx context.Context, config types.Config, metricsDescriptions []*plugintypes.MetricsDescription) error {
134134
hostname, err := os.Hostname()
135135
if err != nil {
136136
return err
@@ -139,6 +139,10 @@ func InitMetrics(config types.Config, metricsDescriptions []*plugintypes.Metrics
139139
if err != nil {
140140
return err
141141
}
142+
if err := rmgr.LoadPlugins(ctx, nil); err != nil {
143+
return err
144+
}
145+
142146
Client = Metrics{
143147
Config: config,
144148
StatsdAddr: config.Statsd,

0 commit comments

Comments
 (0)