From 9eeee92d36128660906ccbd4575bcb746c364335 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 20 Jul 2023 07:52:32 -0700 Subject: [PATCH] Add deletemarker_total metric (#17689) --- cmd/metrics-v2.go | 86 +++++++++++++++++++++++---------- docs/metrics/prometheus/list.md | 2 + 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/cmd/metrics-v2.go b/cmd/metrics-v2.go index 49cc8b03f..1781dd25d 100644 --- a/cmd/metrics-v2.go +++ b/cmd/metrics-v2.go @@ -161,28 +161,29 @@ const ( type MetricName string const ( - authTotal MetricName = "auth_total" - canceledTotal MetricName = "canceled_total" - errorsTotal MetricName = "errors_total" - headerTotal MetricName = "header_total" - healTotal MetricName = "heal_total" - hitsTotal MetricName = "hits_total" - inflightTotal MetricName = "inflight_total" - invalidTotal MetricName = "invalid_total" - limitTotal MetricName = "limit_total" - missedTotal MetricName = "missed_total" - waitingTotal MetricName = "waiting_total" - incomingTotal MetricName = "incoming_total" - objectTotal MetricName = "object_total" - versionTotal MetricName = "version_total" - offlineTotal MetricName = "offline_total" - onlineTotal MetricName = "online_total" - openTotal MetricName = "open_total" - readTotal MetricName = "read_total" - timestampTotal MetricName = "timestamp_total" - writeTotal MetricName = "write_total" - total MetricName = "total" - freeInodes MetricName = "free_inodes" + authTotal MetricName = "auth_total" + canceledTotal MetricName = "canceled_total" + errorsTotal MetricName = "errors_total" + headerTotal MetricName = "header_total" + healTotal MetricName = "heal_total" + hitsTotal MetricName = "hits_total" + inflightTotal MetricName = "inflight_total" + invalidTotal MetricName = "invalid_total" + limitTotal MetricName = "limit_total" + missedTotal MetricName = "missed_total" + waitingTotal MetricName = "waiting_total" + incomingTotal MetricName = "incoming_total" + objectTotal MetricName = "object_total" + versionTotal MetricName = "version_total" + deleteMarkerTotal MetricName = "deletemarker_total" + offlineTotal MetricName = "offline_total" + onlineTotal MetricName = "online_total" + openTotal MetricName = "open_total" + readTotal MetricName = "read_total" + timestampTotal MetricName = "timestamp_total" + writeTotal MetricName = "write_total" + total MetricName = "total" + freeInodes MetricName = "free_inodes" failedCount MetricName = "failed_count" failedBytes MetricName = "failed_bytes" @@ -584,6 +585,16 @@ func getClusterUsageVersionsTotalMD() MetricDescription { } } +func getClusterUsageDeleteMarkersTotalMD() MetricDescription { + return MetricDescription{ + Namespace: clusterMetricNamespace, + Subsystem: usageSubsystem, + Name: deleteMarkerTotal, + Help: "Total number of delete markers in a cluster", + Type: gaugeMetric, + } +} + func getBucketUsageObjectsTotalMD() MetricDescription { return MetricDescription{ Namespace: bucketMetricNamespace, @@ -604,6 +615,16 @@ func getBucketUsageVersionsTotalMD() MetricDescription { } } +func getBucketUsageDeleteMarkersTotalMD() MetricDescription { + return MetricDescription{ + Namespace: bucketMetricNamespace, + Subsystem: usageSubsystem, + Name: deleteMarkerTotal, + Help: "Total number of delete markers", + Type: gaugeMetric, + } +} + func getBucketRepLatencyMD() MetricDescription { return MetricDescription{ Namespace: bucketMetricNamespace, @@ -2263,10 +2284,11 @@ func getClusterUsageMetrics() *MetricsGroup { }) var ( - clusterSize uint64 - clusterBuckets uint64 - clusterObjectsCount uint64 - clusterVersionsCount uint64 + clusterSize uint64 + clusterBuckets uint64 + clusterObjectsCount uint64 + clusterVersionsCount uint64 + clusterDeleteMarkersCount uint64 ) clusterObjectSizesHistogram := map[string]uint64{} @@ -2276,6 +2298,7 @@ func getClusterUsageMetrics() *MetricsGroup { clusterSize += usage.Size clusterObjectsCount += usage.ObjectsCount clusterVersionsCount += usage.VersionsCount + clusterDeleteMarkersCount += usage.DeleteMarkersCount for k, v := range usage.ObjectSizesHistogram { v1, ok := clusterObjectSizesHistogram[k] if !ok { @@ -2311,6 +2334,11 @@ func getClusterUsageMetrics() *MetricsGroup { Value: float64(clusterVersionsCount), }) + metrics = append(metrics, Metric{ + Description: getClusterUsageDeleteMarkersTotalMD(), + Value: float64(clusterDeleteMarkersCount), + }) + metrics = append(metrics, Metric{ Description: getClusterObjectDistributionMD(), Histogram: clusterObjectSizesHistogram, @@ -2385,6 +2413,12 @@ func getBucketUsageMetrics() *MetricsGroup { VariableLabels: map[string]string{"bucket": bucket}, }) + metrics = append(metrics, Metric{ + Description: getBucketUsageDeleteMarkersTotalMD(), + Value: float64(usage.DeleteMarkersCount), + VariableLabels: map[string]string{"bucket": bucket}, + }) + metrics = append(metrics, Metric{ Description: getBucketRepReceivedBytesMD(), Value: float64(stats.ReplicaSize), diff --git a/docs/metrics/prometheus/list.md b/docs/metrics/prometheus/list.md index 14ef6f675..f079fd9ea 100644 --- a/docs/metrics/prometheus/list.md +++ b/docs/metrics/prometheus/list.md @@ -24,6 +24,7 @@ These metrics can be obtained from any MinIO server once per collection. | `minio_cluster_usage_object_total` | Total number of objects in a cluster | | `minio_cluster_usage_total_bytes` | Total cluster usage in bytes | | `minio_cluster_usage_version_total` | Total number of versions (includes delete marker) in a cluster | +| `minio_cluster_usage_deletemarker_total` | Total number of delete markers in a cluster | | `minio_cluster_usage_total_bytes` | Total cluster usage in bytes | | `minio_cluster_buckets_total` | Total number of buckets in the cluster | | `minio_cluster_disk_offline_total` | Total drives offline. | @@ -125,6 +126,7 @@ These metrics can be obtained from any MinIO server once per collection. | `minio_bucket_traffic_sent_bytes` | Total number of S3 bytes sent for this bucket. | | `minio_bucket_usage_object_total` | Total number of objects. | | `minio_bucket_usage_version_total` | Total number of versions (includes delete marker) | +| `minio_bucket_usage_deletemarker_total` | Total number of delete markers. | | `minio_bucket_usage_total_bytes` | Total bucket size in bytes. | | `minio_bucket_requests_4xx_errors_total` | Total number of S3 requests with (4xx) errors on a bucket. | | `minio_bucket_requests_5xx_errors_total` | Total number of S3 requests with (5xx) errors on a bucket. |