Skip to content

Commit 784e183

Browse files
committed
lowercase labels
1 parent 32905d7 commit 784e183

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"os/exec"
1010
"sort"
11+
"strings"
1112
"time"
1213

1314
"github.com/prometheus/client_golang/prometheus"
@@ -312,13 +313,11 @@ func main() {
312313
clusterNodes.WithLabelValues("expected_up").Set(float64(metrics.Node.ExpectedUp))
313314
clusterNodes.WithLabelValues("DC").Set(float64(metrics.Node.DC))
314315

315-
// this will produce a metric like this:
316-
// cluster_resources{node="dma-dog-hana01" resource_name="RA1" role="master"} 1
316+
// this produce a metric like: cluster_resources{node="dma-dog-hana01" resource_name="RA1" role="master"} 1
317317
for _, nod := range status.Nodes.Node {
318318
for _, rsc := range nod.Resources {
319-
// if there is the same resource just add it. At each iteration it will be destroyed this metric so
320-
// this is safe.
321-
clusterResources.WithLabelValues(nod.Name, rsc.ID, rsc.Role).Inc()
319+
// increment if same resource is present
320+
clusterResources.WithLabelValues(strings.ToLower(nod.Name), strings.ToLower(rsc.ID), strings.ToLower(rsc.Role)).Inc()
322321
}
323322
}
324323
// TODO: this is historically, we might don't need to do like this. investigate on this later

0 commit comments

Comments
 (0)