Skip to content

Commit

Permalink
Merge pull request #35 from alicerum/rename-metrics
Browse files Browse the repository at this point in the history
Rename csi shares amount metric
  • Loading branch information
openshift-merge-robot committed Dec 9, 2021
2 parents 2d349bf + b0dec8e commit 90bfe3e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const (
cm = "configmap"
secret = "secret"

cmCountName = sharesSubsystem + separator + cm + separator + "total"
secretCountName = sharesSubsystem + separator + secret + separator + "total"
cmCountName = sharesSubsystem + separator + cm
secretCountName = sharesSubsystem + separator + secret

MetricsPort = 6000
)
Expand Down
36 changes: 18 additions & 18 deletions pkg/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ func TestMetrics(t *testing.T) {
{
name: "One secret, one config map",
expected: []string{
"# HELP openshift_csi_share_configmap_total Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap_total gauge",
"openshift_csi_share_configmap_total 1",
"# HELP openshift_csi_share_secret_total Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret_total gauge",
"openshift_csi_share_secret_total 1",
"# HELP openshift_csi_share_configmap Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap gauge",
"openshift_csi_share_configmap 1",
"# HELP openshift_csi_share_secret Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret gauge",
"openshift_csi_share_secret 1",
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{
Expand Down Expand Up @@ -108,12 +108,12 @@ func TestMetrics(t *testing.T) {
{
name: "Two secrets, no config maps",
expected: []string{
"# HELP openshift_csi_share_secret_total Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret_total gauge",
"openshift_csi_share_secret_total 2",
"# HELP openshift_csi_share_configmap_total Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap_total gauge",
"openshift_csi_share_configmap_total 0",
"# HELP openshift_csi_share_secret Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret gauge",
"openshift_csi_share_secret 2",
"# HELP openshift_csi_share_configmap Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap gauge",
"openshift_csi_share_configmap 0",
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{
Expand Down Expand Up @@ -142,12 +142,12 @@ func TestMetrics(t *testing.T) {
{
name: "No secrets, two config maps",
expected: []string{
"# HELP openshift_csi_share_configmap_total Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap_total gauge",
"openshift_csi_share_configmap_total 2",
"# HELP openshift_csi_share_secret_total Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret_total gauge",
"openshift_csi_share_secret_total 0",
"# HELP openshift_csi_share_configmap Counts ConfigMap objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_configmap gauge",
"openshift_csi_share_configmap 2",
"# HELP openshift_csi_share_secret Counts Secret objects shared by the CSI shared resource driver",
"# TYPE openshift_csi_share_secret gauge",
"openshift_csi_share_secret 0",
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{},
Expand Down
12 changes: 6 additions & 6 deletions pkg/metrics/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ func TestMetricQueries(t *testing.T) {
{
name: "One secret, one config map",
expected: []queryResult{
{"openshift_csi_share_configmap_total", 1},
{"openshift_csi_share_secret_total", 1},
{"openshift_csi_share_configmap", 1},
{"openshift_csi_share_secret", 1},
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{
Expand Down Expand Up @@ -144,8 +144,8 @@ func TestMetricQueries(t *testing.T) {
{
name: "Two secrets, no config maps",
expected: []queryResult{
{"openshift_csi_share_secret_total", 2},
{"openshift_csi_share_configmap_total", 0},
{"openshift_csi_share_secret", 2},
{"openshift_csi_share_configmap", 0},
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{
Expand Down Expand Up @@ -174,8 +174,8 @@ func TestMetricQueries(t *testing.T) {
{
name: "No secrets, two config maps",
expected: []queryResult{
{"openshift_csi_share_configmap_total", 2},
{"openshift_csi_share_secret_total", 0},
{"openshift_csi_share_configmap", 2},
{"openshift_csi_share_secret", 0},
},
secretLister: &fakeSecretShareLister{
secretShares: []*v1alpha1.SharedSecret{},
Expand Down

0 comments on commit 90bfe3e

Please sign in to comment.