Skip to content

Commit

Permalink
refactor(metrics): Refactoring metrics package with prometheus metric…
Browse files Browse the repository at this point in the history
…s naming convention (#64)

* Refactoring pkg/metrics with prometheus metrics naming convention
* increasing timeout to 20m for sanity-test

Signed-off-by: mayank <[email protected]>
  • Loading branch information
mynktl authored Jul 15, 2021
1 parent 0efaba2 commit c37e3d5
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import (
)

const (
// NfsProvisionerSubsystem is prometheus subsystem name.
NfsVolumeProvisionerSubsystem = "nfs_volume_provisioner"
// NfsProvisionerNamespace is namespace name for provisioner metrics.
NfsVolumeProvisionerNamespace = "nfs_volume_provisioner"

// PersistentVolumeSubsytem is subsystem name for persistentvolume metrics.
PersistentVolumeSubsytem = "persistentvolume"

// Metrics
// ProvisionerRequestCreate represents metrics related to create resource request.
Expand All @@ -38,35 +41,39 @@ var (
// PersistentVolumeDeleteTotal is used to collect accumulated count of persistent volumes deleted.
PersistentVolumeDeleteTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: NfsVolumeProvisionerSubsystem,
Name: "persistentvolume_delete_total",
Namespace: NfsVolumeProvisionerNamespace,
Subsystem: PersistentVolumeSubsytem,
Name: "delete_total",
Help: "Total number of persistent volumes deleted",
},
[]string{Process},
)
// PersistentVolumeDeleteFailedTotal is used to collect accumulated count of persistent volume delete failed attempts.
PersistentVolumeDeleteFailedTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: NfsVolumeProvisionerSubsystem,
Name: "persistentvolume_delete_failed_total",
Namespace: NfsVolumeProvisionerNamespace,
Subsystem: PersistentVolumeSubsytem,
Name: "delete_failed_total",
Help: "Total number of persistent volume delete failed attempts",
},
[]string{Process},
)
// PersistentVolumeCreateTotal is used to collect accumulated count of persistent volume created.
PersistentVolumeCreateTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: NfsVolumeProvisionerSubsystem,
Name: "persistentvolume_create_total",
Namespace: NfsVolumeProvisionerNamespace,
Subsystem: PersistentVolumeSubsytem,
Name: "create_total",
Help: "Total number of persistent volumes created",
},
[]string{Process},
)
// PersistentVolumeCreateFailedTotal is used to collect accumulated count of persistent volume create requests failed.
PersistentVolumeCreateFailedTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: NfsVolumeProvisionerSubsystem,
Name: "persistentvolume_create_failed_total",
Namespace: NfsVolumeProvisionerNamespace,
Subsystem: PersistentVolumeSubsytem,
Name: "create_failed_total",
Help: "Total number of persistent volume creation failed attempts",
},
[]string{Process},
Expand Down

0 comments on commit c37e3d5

Please sign in to comment.