mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
fix: Create metrics slice when necessary in getCacheMetrics() (#17711)
This commit is contained in:
parent
2da4bd5f1a
commit
a7fb3a3853
@ -1863,12 +1863,12 @@ func getCacheMetrics() *MetricsGroup {
|
||||
cacheInterval: 10 * time.Second,
|
||||
}
|
||||
mg.RegisterRead(func(ctx context.Context) (metrics []Metric) {
|
||||
metrics = make([]Metric, 0, 20)
|
||||
cacheObjLayer := newCachedObjectLayerFn()
|
||||
// Service not initialized yet
|
||||
if cacheObjLayer == nil {
|
||||
return
|
||||
}
|
||||
metrics = make([]Metric, 0, 20)
|
||||
metrics = append(metrics, Metric{
|
||||
Description: getCacheHitsTotalMD(),
|
||||
Value: float64(cacheObjLayer.CacheStats().getHits()),
|
||||
|
Loading…
Reference in New Issue
Block a user