Add cluster and bucket replication metrics in metrics-v3 (#19546)

endpoint: /minio/metrics/v3/cluster/replication
metrics:
- average_active_workers
- average_queued_bytes
- average_queued_count
- average_transfer_rate
- current_active_workers
- current_transfer_rate
- last_minute_queued_bytes
- last_minute_queued_count
- max_active_workers
- max_queued_bytes
- max_queued_count
- max_transfer_rate
- recent_backlog_count

endpoint: /minio/metrics/v3/api/bucket/replication
metrics:
- last_hour_failed_bytes
- last_hour_failed_count
- last_minute_failed_bytes
- last_minute_failed_count
- latency_ms
- proxied_delete_tagging_requests_total
- proxied_get_requests_failures
- proxied_get_requests_total
- proxied_get_tagging_requests_failures
- proxied_get_tagging_requests_total
- proxied_head_requests_failures
- proxied_head_requests_total
- proxied_put_tagging_requests_failures
- proxied_put_tagging_requests_total
- sent_bytes
- sent_count
- total_failed_bytes
- total_failed_count
- proxied_delete_tagging_requests_failures
This commit is contained in:
Shireesh Anjal
2024-05-23 13:11:18 +05:30
committed by GitHub
parent 6d5bc045bc
commit 7981509cc8
6 changed files with 395 additions and 45 deletions

View File

@@ -72,6 +72,8 @@ const (
GaugeMT
// HistogramMT - represents a histogram metric.
HistogramMT
// rangeL - represents a range label.
rangeL = "range"
)
func (mt MetricType) String() string {
@@ -225,7 +227,7 @@ func (m *MetricValues) Set(name MetricName, value float64, labels ...string) {
}
if len(labels)/2 != len(validLabels) {
panic(fmt.Sprintf("not all labels were given values"))
panic("not all labels were given values")
}
v, ok := m.values[name]
@@ -284,6 +286,14 @@ func (m *MetricValues) SetHistogram(name MetricName, hist *prometheus.HistogramV
}
}
// SetHistogramValues - sets values for the given MetricName using the provided map of
// range to value.
func SetHistogramValues[V uint64 | int64 | float64](m MetricValues, name MetricName, values map[string]V, labels ...string) {
for rng, val := range values {
m.Set(name, float64(val), append(labels, rangeL, rng)...)
}
}
// MetricsLoaderFn - represents a function to load metrics from the
// metricsCache.
//