mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
add lock metrics per node (#16943)
This commit is contained in:
@@ -77,7 +77,7 @@ func init() {
|
||||
return allMetrics
|
||||
}()
|
||||
|
||||
nodeCollector = newMinioCollectorNode([]*MetricsGroup{
|
||||
nodeGroups := []*MetricsGroup{
|
||||
getNodeHealthMetrics(),
|
||||
getLocalDriveStorageMetrics(),
|
||||
getCacheMetrics(),
|
||||
@@ -86,7 +86,10 @@ func init() {
|
||||
getMinioVersionMetrics(),
|
||||
getS3TTFBMetric(),
|
||||
getNotificationMetrics(),
|
||||
})
|
||||
getDistLockMetrics(),
|
||||
}
|
||||
|
||||
nodeCollector = newMinioCollectorNode(nodeGroups)
|
||||
clusterCollector = newMinioClusterCollector(allMetricsGroups)
|
||||
}
|
||||
|
||||
@@ -1663,6 +1666,53 @@ func getCacheMetrics() *MetricsGroup {
|
||||
return mg
|
||||
}
|
||||
|
||||
func getDistLockMetrics() *MetricsGroup {
|
||||
mg := &MetricsGroup{
|
||||
cacheInterval: 1 * time.Second,
|
||||
}
|
||||
mg.RegisterRead(func(ctx context.Context) []Metric {
|
||||
if !globalIsDistErasure {
|
||||
return []Metric{}
|
||||
}
|
||||
|
||||
st := globalLockServer.stats()
|
||||
|
||||
metrics := make([]Metric, 0, 3)
|
||||
metrics = append(metrics, Metric{
|
||||
Description: MetricDescription{
|
||||
Namespace: minioNamespace,
|
||||
Subsystem: "locks",
|
||||
Name: "total",
|
||||
Help: "Number of current locks on this peer",
|
||||
Type: gaugeMetric,
|
||||
},
|
||||
Value: float64(st.Total),
|
||||
})
|
||||
metrics = append(metrics, Metric{
|
||||
Description: MetricDescription{
|
||||
Namespace: minioNamespace,
|
||||
Subsystem: "locks",
|
||||
Name: "write_total",
|
||||
Help: "Number of current WRITE locks on this peer",
|
||||
Type: gaugeMetric,
|
||||
},
|
||||
Value: float64(st.Writes),
|
||||
})
|
||||
metrics = append(metrics, Metric{
|
||||
Description: MetricDescription{
|
||||
Namespace: minioNamespace,
|
||||
Subsystem: "locks",
|
||||
Name: "read_total",
|
||||
Help: "Number of current READ locks on this peer",
|
||||
Type: gaugeMetric,
|
||||
},
|
||||
Value: float64(st.Reads),
|
||||
})
|
||||
return metrics
|
||||
})
|
||||
return mg
|
||||
}
|
||||
|
||||
func getNotificationMetrics() *MetricsGroup {
|
||||
mg := &MetricsGroup{
|
||||
cacheInterval: 10 * time.Second,
|
||||
|
||||
Reference in New Issue
Block a user