mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
Add node cpu & memory metrics to Prometheus cluster endpoint (#12214)
This commit is contained in:
parent
ff36baeaa7
commit
c8aa56ccd7
@ -120,6 +120,8 @@ const (
|
|||||||
lastActivityTime = "last_activity_nano_seconds"
|
lastActivityTime = "last_activity_nano_seconds"
|
||||||
startTime = "starttime_seconds"
|
startTime = "starttime_seconds"
|
||||||
upTime = "uptime_seconds"
|
upTime = "uptime_seconds"
|
||||||
|
memory = "resident_memory_bytes"
|
||||||
|
cpu = "cpu_total_seconds"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -821,6 +823,24 @@ func getMinIOProcessUptimeMD() MetricDescription {
|
|||||||
Type: gaugeMetric,
|
Type: gaugeMetric,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func getMinIOProcessResidentMemory() MetricDescription {
|
||||||
|
return MetricDescription{
|
||||||
|
Namespace: nodeMetricNamespace,
|
||||||
|
Subsystem: processSubsystem,
|
||||||
|
Name: memory,
|
||||||
|
Help: "Resident memory size in bytes.",
|
||||||
|
Type: gaugeMetric,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func getMinIOProcessCPUTime() MetricDescription {
|
||||||
|
return MetricDescription{
|
||||||
|
Namespace: nodeMetricNamespace,
|
||||||
|
Subsystem: processSubsystem,
|
||||||
|
Name: cpu,
|
||||||
|
Help: "Total user and system CPU time spent in seconds.",
|
||||||
|
Type: counterMetric,
|
||||||
|
}
|
||||||
|
}
|
||||||
func getMinioProcMetrics() MetricsGroup {
|
func getMinioProcMetrics() MetricsGroup {
|
||||||
return MetricsGroup{
|
return MetricsGroup{
|
||||||
id: "MinioProcMetrics",
|
id: "MinioProcMetrics",
|
||||||
@ -913,6 +933,16 @@ func getMinioProcMetrics() MetricsGroup {
|
|||||||
Description: getMinIOProcessUptimeMD(),
|
Description: getMinIOProcessUptimeMD(),
|
||||||
Value: time.Since(globalBootTime).Seconds(),
|
Value: time.Since(globalBootTime).Seconds(),
|
||||||
})
|
})
|
||||||
|
metrics = append(metrics,
|
||||||
|
Metric{
|
||||||
|
Description: getMinIOProcessResidentMemory(),
|
||||||
|
Value: float64(stat.ResidentMemory()),
|
||||||
|
})
|
||||||
|
metrics = append(metrics,
|
||||||
|
Metric{
|
||||||
|
Description: getMinIOProcessCPUTime(),
|
||||||
|
Value: float64(stat.CPUTime()),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user