Add minio_bucket_usage_version_total metric to Prometheus (#17023)

This commit is contained in:
Anis Eleuch 2023-04-13 04:08:07 +01:00 committed by GitHub
parent bdad3730f7
commit a42650c065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,6 +155,7 @@ const (
waitingTotal MetricName = "waiting_total" waitingTotal MetricName = "waiting_total"
incomingTotal MetricName = "incoming_total" incomingTotal MetricName = "incoming_total"
objectTotal MetricName = "object_total" objectTotal MetricName = "object_total"
versionTotal MetricName = "version_total"
offlineTotal MetricName = "offline_total" offlineTotal MetricName = "offline_total"
onlineTotal MetricName = "online_total" onlineTotal MetricName = "online_total"
openTotal MetricName = "open_total" openTotal MetricName = "open_total"
@ -509,6 +510,16 @@ func getBucketUsageObjectsTotalMD() MetricDescription {
} }
} }
func getBucketUsageVersionsTotalMD() MetricDescription {
return MetricDescription{
Namespace: bucketMetricNamespace,
Subsystem: usageSubsystem,
Name: versionTotal,
Help: "Total number of versions",
Type: gaugeMetric,
}
}
func getBucketRepLatencyMD() MetricDescription { func getBucketRepLatencyMD() MetricDescription {
return MetricDescription{ return MetricDescription{
Namespace: bucketMetricNamespace, Namespace: bucketMetricNamespace,
@ -1995,6 +2006,12 @@ func getBucketUsageMetrics() *MetricsGroup {
VariableLabels: map[string]string{"bucket": bucket}, VariableLabels: map[string]string{"bucket": bucket},
}) })
metrics = append(metrics, Metric{
Description: getBucketUsageVersionsTotalMD(),
Value: float64(usage.VersionsCount),
VariableLabels: map[string]string{"bucket": bucket},
})
metrics = append(metrics, Metric{ metrics = append(metrics, Metric{
Description: getBucketRepReceivedBytesMD(), Description: getBucketRepReceivedBytesMD(),
Value: float64(stats.ReplicaSize), Value: float64(stats.ReplicaSize),