From 9f00afd8d53d40b03eaa2bd4b94ca1fae478f763 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 13 Nov 2023 14:46:15 +0800 Subject: [PATCH] fix(metric): Modify pvc namespace label name The label `namespace` will be used by the Prometheus collector. Change it to `pvc_namespace` Signed-off-by: James Lu --- metrics_collector/types.go | 2 +- metrics_collector/volume_collector.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/metrics_collector/types.go b/metrics_collector/types.go index 8bd7a61387..c476261518 100644 --- a/metrics_collector/types.go +++ b/metrics_collector/types.go @@ -26,7 +26,7 @@ const ( managerLabel = "manager" backupLabel = "backup" pvcLabel = "pvc" - namespaceLabel = "namespace" + pvcNamespaceLabel = "pvc_namespace" ) type metricInfo struct { diff --git a/metrics_collector/volume_collector.go b/metrics_collector/volume_collector.go index 06e7e904e2..2a4a69d406 100644 --- a/metrics_collector/volume_collector.go +++ b/metrics_collector/volume_collector.go @@ -52,7 +52,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "capacity_bytes"), "Configured size in bytes for this volume", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -62,7 +62,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "actual_size_bytes"), "Actual space used by each replica of the volume on the corresponding node", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -72,7 +72,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "state"), "State of this volume", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -82,7 +82,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "robustness"), "Robustness of this volume", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -92,7 +92,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "read_throughput"), "Read throughput of this volume (Bytes/s)", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -102,7 +102,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "write_throughput"), "Write throughput of this volume (Bytes/s)", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -112,7 +112,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "read_iops"), "Read IOPS of this volume", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -122,7 +122,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "write_iops"), "Write IOPS of this volume", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -132,7 +132,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "read_latency"), "Read latency of this volume (ns)", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue, @@ -142,7 +142,7 @@ func NewVolumeCollector( Desc: prometheus.NewDesc( prometheus.BuildFQName(longhornName, subsystemVolume, "write_latency"), "Write latency of this volume (ns)", - []string{nodeLabel, volumeLabel, pvcLabel, namespaceLabel}, + []string{nodeLabel, volumeLabel, pvcLabel, pvcNamespaceLabel}, nil, ), Type: prometheus.GaugeValue,