aboutsummaryrefslogtreecommitdiff
path: root/weed/stats/metrics.go
diff options
context:
space:
mode:
authorDmitry Mishin <dimm@protonmail.ch>2023-08-21 11:37:27 -0700
committerGitHub <noreply@github.com>2023-08-21 11:37:27 -0700
commit9956d93a4023874505eb6e531f930199fa7f3820 (patch)
treee063a087a8c340ec68921f3b92fa531ecd377d65 /weed/stats/metrics.go
parent88fca2b0da66c8753309b9d1a6d419f4184a3f44 (diff)
downloadseaweedfs-9956d93a4023874505eb6e531f930199fa7f3820.tar.xz
seaweedfs-9956d93a4023874505eb6e531f930199fa7f3820.zip
Add disk type to prometheus metrics (#4736)
* Add disk type to prometheus metrics * Del metrics * Disk type as readable string --------- Co-authored-by: Dima Mishin <dimm@dimm.dev>
Diffstat (limited to 'weed/stats/metrics.go')
-rw-r--r--weed/stats/metrics.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index dda4d95e5..af4f26e4c 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -176,7 +176,7 @@ var (
Subsystem: "volumeServer",
Name: "volumes",
Help: "Number of volumes or shards.",
- }, []string{"collection", "type"})
+ }, []string{"collection", "type", "disk"})
VolumeServerReadOnlyVolumeGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
@@ -299,7 +299,6 @@ func JoinHostPort(host string, port int) string {
return net.JoinHostPort(host, portStr)
}
-
func StartMetricsServer(ip string, port int) {
if port == 0 {
return
@@ -316,11 +315,10 @@ func SourceName(port uint32) string {
return net.JoinHostPort(hostname, strconv.Itoa(int(port)))
}
-// todo - can be changed to DeletePartialMatch when https://github.com/prometheus/client_golang/pull/1013 gets released
func DeleteCollectionMetrics(collection string) {
VolumeServerDiskSizeGauge.DeleteLabelValues(collection, "normal")
for _, volume_type := range readOnlyVolumeTypes {
- VolumeServerReadOnlyVolumeGauge.DeleteLabelValues(collection, volume_type)
+ VolumeServerReadOnlyVolumeGauge.DeletePartialMatch(prometheus.Labels{"collection": collection, "type": volume_type})
}
- VolumeServerVolumeCounter.DeleteLabelValues(collection, "volume")
+ VolumeServerVolumeCounter.DeletePartialMatch(prometheus.Labels{"collection": collection, "type": "volume"})
}