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 9, 2023
1 parent 4023ebd commit 8efaf5d
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 @@ -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 {
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 @@ -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
Expand Down

0 comments on commit 8efaf5d

Please sign in to comment.