From 121699b1835259ac8c99e84f09a30d55f6fec784 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 8259008a8..87cb0c6e5 100644 --- a/pkg/rotation/stats_reporter.go +++ b/pkg/rotation/stats_reporter.go @@ -48,12 +48,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", metric.WithDescription("Total number of rotation reconciles")); err != nil { + if r.rotationReconcileTotal, err = meter.Int64Counter("rotation_reconcile", metric.WithDescription("Total number of rotation reconciles")); err != nil { return nil, err } - if r.rotationReconcileErrorTotal, err = meter.Int64Counter("total_rotation_reconcile_error", metric.WithDescription("Total number of rotation reconciles with error")); err != nil { + if r.rotationReconcileErrorTotal, err = meter.Int64Counter("rotation_reconcile_error", metric.WithDescription("Total number of rotation reconciles with error")); err != nil { return nil, err } if r.rotationReconcileDuration, err = meter.Float64Histogram("rotation_reconcile_duration_sec", metric.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 4ca5f2fba..e7dc5c17c 100644 --- a/pkg/secrets-store/stats_reporter.go +++ b/pkg/secrets-store/stats_reporter.go @@ -55,22 +55,22 @@ func NewStatsReporter() (StatsReporter, error) { r := &reporter{} meter := global.Meter("secretsstore") - if r.nodePublishTotal, err = meter.Int64Counter("total_node_publish", metric.WithDescription("Total number of node publish calls")); err != nil { + if r.nodePublishTotal, err = meter.Int64Counter("node_publish", metric.WithDescription("Total number of node publish calls")); err != nil { return nil, err } - if r.nodeUnPublishTotal, err = meter.Int64Counter("total_node_unpublish", metric.WithDescription("Total number of node unpublish calls")); err != nil { + if r.nodeUnPublishTotal, err = meter.Int64Counter("node_unpublish", metric.WithDescription("Total number of node unpublish calls")); err != nil { return nil, err } - if r.nodePublishErrorTotal, err = meter.Int64Counter("total_node_publish_error", metric.WithDescription("Total number of node publish calls with error")); err != nil { + if r.nodePublishErrorTotal, err = meter.Int64Counter("node_publish_error", metric.WithDescription("Total number of node publish calls with error")); err != nil { return nil, err } - if r.nodeUnPublishErrorTotal, err = meter.Int64Counter("total_node_unpublish_error", metric.WithDescription("Total number of node unpublish calls with error")); err != nil { + if r.nodeUnPublishErrorTotal, err = meter.Int64Counter("node_unpublish_error", metric.WithDescription("Total number of node unpublish calls with error")); err != nil { return nil, err } - if r.syncK8sSecretTotal, err = meter.Int64Counter("total_sync_k8s_secret", metric.WithDescription("Total number of k8s secrets synced")); err != nil { + if r.syncK8sSecretTotal, err = meter.Int64Counter("sync_k8s_secret", metric.WithDescription("Total number of k8s secrets synced")); err != nil { return nil, err } - if r.syncK8sSecretDuration, err = meter.Float64Histogram("sync_k8s_secret_duration_sec", metric.WithDescription("Distribution of how long it took to sync k8s secret")); err != nil { + if r.syncK8sSecretDuration, err = meter.Float64Histogram("k8s_secret_duration_sec", metric.WithDescription("Distribution of how long it took to sync k8s secret")); err != nil { return nil, err } return r, nil