diff --git a/apis/metrics/metrics.go b/apis/metrics/metrics.go index fa4ab8eca5..cb2e100d5a 100644 --- a/apis/metrics/metrics.go +++ b/apis/metrics/metrics.go @@ -45,8 +45,8 @@ var registerMetrics sync.Once // Register all metrics. func Register() { - // Get a custom prometheus registry. - registry := util_metrics.GetCustomPrometheusRegistry() + // Get a prometheus registry. + registry := util_metrics.GetPrometheusRegistry() registerMetrics.Do(func() { // Register the custom metrics. registry.MustRegister(ImagePullSummary) diff --git a/cri/metrics/metrics.go b/cri/metrics/metrics.go index d5fe5b6e3c..ce884e8ecb 100644 --- a/cri/metrics/metrics.go +++ b/cri/metrics/metrics.go @@ -74,8 +74,8 @@ var registerMetrics sync.Once // Register all metrics. func Register() { - // Get a custom prometheus registry. - registry := util_metrics.GetCustomPrometheusRegistry() + // Get a prometheus registry. + registry := util_metrics.GetPrometheusRegistry() registerMetrics.Do(func() { // Register the custom metrics. registry.MustRegister(PodActionsCounter) diff --git a/pkg/utils/metrics/metrics.go b/pkg/utils/metrics/metrics.go index 9112f335c3..b77d8a0793 100644 --- a/pkg/utils/metrics/metrics.go +++ b/pkg/utils/metrics/metrics.go @@ -15,17 +15,16 @@ const ( namespace = "engine" ) -// CustomPrometheusRegistry creates a custom prometheus registry. var ( - customPrometheusRegistry *prometheus.Registry - prometheusHandler http.Handler - registerMetrics sync.Once + prometheusRegistry *prometheus.Registry + prometheusHandler http.Handler + registerMetrics sync.Once ) func init() { - customPrometheusRegistry = prometheus.NewRegistry() - prometheusHandler = promhttp.HandlerFor(customPrometheusRegistry, promhttp.HandlerOpts{}) - registerDefaultMetrics(customPrometheusRegistry) + prometheusRegistry = prometheus.NewRegistry() + prometheusHandler = promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}) + registerDefaultMetrics(prometheusRegistry) } // SinceInMicroseconds gets the time since the specified start in microseconds. @@ -81,9 +80,9 @@ func NewLabelTimer(subsystem, name, help string, labels ...string) *prometheus.H }, labels) } -// GetCustomPrometheusRegistry create a custom resigtry of Prometheus. -func GetCustomPrometheusRegistry() *prometheus.Registry { - return customPrometheusRegistry +// GetPrometheusRegistry create a custom resigtry of Prometheus. +func GetPrometheusRegistry() *prometheus.Registry { + return prometheusRegistry } // GetPrometheusHandler return the prometheus handler.