From 8efaf5d0b65a82549150eb7a8f2bd34bf27b7991 Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Tue, 9 May 2023 00:00:33 +0000 Subject: [PATCH] drop the total_ prefix from the metric name For prometheus counters, by default they're appending _total if it's monotonic counter. Removing the total_ prefix as it's redundant in the name (xref: https://github.com/open-telemetry/opentelemetry-go/pull/3360). This is a breaking change. Signed-off-by: Anish Ramasekar --- pkg/rotation/stats_reporter.go | 6 +++--- pkg/secrets-store/stats_reporter.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/rotation/stats_reporter.go b/pkg/rotation/stats_reporter.go index 509c73b1d..cadb8462e 100644 --- a/pkg/rotation/stats_reporter.go +++ b/pkg/rotation/stats_reporter.go @@ -49,12 +49,12 @@ type StatsReporter interface { func newStatsReporter() (StatsReporter, error) { var err error r := &reporter{} - meter := global.Meter("rotation") + meter := global.Meter("secretsstore") - if r.rotationReconcileTotal, err = meter.Int64Counter("total_rotation_reconcile", instrument.WithDescription("Total number of rotation reconciles")); err != nil { + if r.rotationReconcileTotal, err = meter.Int64Counter("rotation_reconcile", instrument.WithDescription("Total number of rotation reconciles")); err != nil { return nil, err } - if r.rotationReconcileErrorTotal, err = meter.Int64Counter("total_rotation_reconcile_error", instrument.WithDescription("Total number of rotation reconciles with error")); err != nil { + if r.rotationReconcileErrorTotal, err = meter.Int64Counter("rotation_reconcile_error", instrument.WithDescription("Total number of rotation reconciles with error")); err != nil { return nil, err } if r.rotationReconcileDuration, err = meter.Float64Histogram("rotation_reconcile_duration_sec", instrument.WithDescription("Distribution of how long it took to rotate secrets-store content for pods")); err != nil { diff --git a/pkg/secrets-store/stats_reporter.go b/pkg/secrets-store/stats_reporter.go index 4dabb45b0..4daeec74e 100644 --- a/pkg/secrets-store/stats_reporter.go +++ b/pkg/secrets-store/stats_reporter.go @@ -56,22 +56,22 @@ func NewStatsReporter() (StatsReporter, error) { r := &reporter{} meter := global.Meter("secretsstore") - if r.nodePublishTotal, err = meter.Int64Counter("total_node_publish", instrument.WithDescription("Total number of node publish calls")); err != nil { + if r.nodePublishTotal, err = meter.Int64Counter("node_publish", instrument.WithDescription("Total number of node publish calls")); err != nil { return nil, err } - if r.nodeUnPublishTotal, err = meter.Int64Counter("total_node_unpublish", instrument.WithDescription("Total number of node unpublish calls")); err != nil { + if r.nodeUnPublishTotal, err = meter.Int64Counter("node_unpublish", instrument.WithDescription("Total number of node unpublish calls")); err != nil { return nil, err } - if r.nodePublishErrorTotal, err = meter.Int64Counter("total_node_publish_error", instrument.WithDescription("Total number of node publish calls with error")); err != nil { + if r.nodePublishErrorTotal, err = meter.Int64Counter("node_publish_error", instrument.WithDescription("Total number of node publish calls with error")); err != nil { return nil, err } - if r.nodeUnPublishErrorTotal, err = meter.Int64Counter("total_node_unpublish_error", instrument.WithDescription("Total number of node unpublish calls with error")); err != nil { + if r.nodeUnPublishErrorTotal, err = meter.Int64Counter("node_unpublish_error", instrument.WithDescription("Total number of node unpublish calls with error")); err != nil { return nil, err } - if r.syncK8sSecretTotal, err = meter.Int64Counter("total_sync_k8s_secret", instrument.WithDescription("Total number of k8s secrets synced")); err != nil { + if r.syncK8sSecretTotal, err = meter.Int64Counter("sync_k8s_secret", instrument.WithDescription("Total number of k8s secrets synced")); err != nil { return nil, err } - if r.syncK8sSecretDuration, err = meter.Float64Histogram("sync_k8s_secret_duration_sec", instrument.WithDescription("Distribution of how long it took to sync k8s secret")); err != nil { + if r.syncK8sSecretDuration, err = meter.Float64Histogram("k8s_secret_duration_sec", instrument.WithDescription("Distribution of how long it took to sync k8s secret")); err != nil { return nil, err } return r, nil