Skip to content

Commit

Permalink
drop the total_ prefix from the metric name
Browse files Browse the repository at this point in the history
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: open-telemetry/opentelemetry-go#3360).
This is a breaking change.

Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed May 18, 2023
1 parent 04ee479 commit 7a5520f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/rotation/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions pkg/secrets-store/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a5520f

Please sign in to comment.