Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more metrics to v3/cluster/erasure-set #19714

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 38 additions & 10 deletions cmd/metrics-v3-cluster-erasure-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const (
erasureSetOnlineDrivesCount = "online_drives_count"
erasureSetHealingDrivesCount = "healing_drives_count"
erasureSetHealth = "health"
erasureSetReadTolerance = "read_tolerance"
erasureSetWriteTolerance = "write_tolerance"
erasureSetReadHealth = "read_health"
erasureSetWriteHealth = "write_health"
)

const (
Expand All @@ -53,6 +57,18 @@ var (
erasureSetHealthMD = NewGaugeMD(erasureSetHealth,
"Health of the erasure set in a pool (1=healthy, 0=unhealthy)",
poolIDL, setIDL)
erasureSetReadToleranceMD = NewGaugeMD(erasureSetReadTolerance,
"No of drive failures that can be tolerated without disrupting read operations",
poolIDL, setIDL)
erasureSetWriteToleranceMD = NewGaugeMD(erasureSetWriteTolerance,
"No of drive failures that can be tolerated without disrupting write operations",
poolIDL, setIDL)
erasureSetReadHealthMD = NewGaugeMD(erasureSetReadHealth,
"Health of the erasure set in a pool for read operations (1=healthy, 0=unhealthy)",
poolIDL, setIDL)
erasureSetWriteHealthMD = NewGaugeMD(erasureSetWriteHealth,
"Health of the erasure set in a pool for write operations (1=healthy, 0=unhealthy)",
poolIDL, setIDL)
)

func b2f(v bool) float64 {
Expand All @@ -73,16 +89,28 @@ func loadClusterErasureSetMetrics(ctx context.Context, m MetricValues, c *metric
for _, h := range result.ESHealth {
poolLV := strconv.Itoa(h.PoolID)
setLV := strconv.Itoa(h.SetID)
m.Set(erasureSetReadQuorum, float64(h.ReadQuorum),
poolIDL, poolLV, setIDL, setLV)
m.Set(erasureSetWriteQuorum, float64(h.WriteQuorum),
poolIDL, poolLV, setIDL, setLV)
m.Set(erasureSetOnlineDrivesCount, float64(h.HealthyDrives),
poolIDL, poolLV, setIDL, setLV)
m.Set(erasureSetHealingDrivesCount, float64(h.HealingDrives),
poolIDL, poolLV, setIDL, setLV)
m.Set(erasureSetHealth, b2f(h.Healthy),
poolIDL, poolLV, setIDL, setLV)
labels := []string{poolIDL, poolLV, setIDL, setLV}
m.Set(erasureSetReadQuorum, float64(h.ReadQuorum), labels...)
m.Set(erasureSetWriteQuorum, float64(h.WriteQuorum), labels...)
m.Set(erasureSetOnlineDrivesCount, float64(h.HealthyDrives), labels...)
m.Set(erasureSetHealingDrivesCount, float64(h.HealingDrives), labels...)
m.Set(erasureSetHealth, b2f(h.Healthy), labels...)

readHealthy := true
readTolerance := float64(h.HealthyDrives - h.ReadQuorum)
if readTolerance < 0 {
readHealthy = false
}
m.Set(erasureSetReadTolerance, readTolerance, labels...)
m.Set(erasureSetReadHealth, b2f(readHealthy), labels...)

writeHealthy := true
writeTolerance := float64(h.HealthyDrives + h.HealingDrives - h.WriteQuorum)
if writeTolerance < 0 {
writeHealthy = false
}
m.Set(erasureSetWriteTolerance, writeTolerance, labels...)
m.Set(erasureSetWriteHealth, b2f(writeHealthy), labels...)
}

return nil
Expand Down
4 changes: 4 additions & 0 deletions cmd/metrics-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
erasureSetOnlineDrivesCountMD,
erasureSetHealingDrivesCountMD,
erasureSetHealthMD,
erasureSetReadToleranceMD,
erasureSetWriteToleranceMD,
erasureSetReadHealthMD,
erasureSetWriteHealthMD,
},
loadClusterErasureSetMetrics,
)
Expand Down
22 changes: 13 additions & 9 deletions docs/metrics/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,19 @@ The standard metrics group for GoCollector is not shown below.

### `/cluster/erasure-set`

| Name | Type | Help | Labels |
|--------------------------------------------------|---------|---------------------------------------------------------------|------------------|
| `minio_cluster_erasure_set_overall_write_quorum` | `gauge` | Overall write quorum across pools and sets | |
| `minio_cluster_erasure_set_overall_health` | `gauge` | Overall health across pools and sets (1=healthy, 0=unhealthy) | |
| `minio_cluster_erasure_set_read_quorum` | `gauge` | Read quorum for the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_write_quorum` | `gauge` | Write quorum for the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_online_drives_count` | `gauge` | Count of online drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_healing_drives_count` | `gauge` | Count of healing drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_health` | `gauge` | Health of the erasure set in a pool (1=healthy, 0=unhealthy) | `pool_id,set_id` |
| Name | Type | Help | Labels |
|--------------------------------------------------|---------|-----------------------------------------------------------------------------------|------------------|
| `minio_cluster_erasure_set_overall_write_quorum` | `gauge` | Overall write quorum across pools and sets | |
| `minio_cluster_erasure_set_overall_health` | `gauge` | Overall health across pools and sets (1=healthy, 0=unhealthy) | |
| `minio_cluster_erasure_set_read_quorum` | `gauge` | Read quorum for the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_write_quorum` | `gauge` | Write quorum for the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_online_drives_count` | `gauge` | Count of online drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_healing_drives_count` | `gauge` | Count of healing drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_health` | `gauge` | Health of the erasure set in a pool (1=healthy, 0=unhealthy) | `pool_id,set_id` |
| `minio_cluster_erasure_set_read_tolerance` | `gauge` | No of drive failures that can be tolerated without disrupting read operations | `pool_id,set_id` |
| `minio_cluster_erasure_set_write_tolerance` | `gauge` | No of drive failures that can be tolerated without disrupting write operations | `pool_id,set_id` |
| `minio_cluster_erasure_set_read_health` | `gauge` | Health of the erasure set in a pool for read operations (1=healthy, 0=unhealthy) | `pool_id,set_id` |
| `minio_cluster_erasure_set_write_health` | `gauge` | Health of the erasure set in a pool for write operations (1=healthy, 0=unhealthy) | `pool_id,set_id` |

### `/cluster/notification`

Expand Down