mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Create metrics slice when necessary (#17809)
This commit is contained in:
parent
8666c55ca6
commit
23e4895dfc
@ -1214,7 +1214,7 @@ func getMinioProcMetrics() *MetricsGroup {
|
||||
if runtime.GOOS == "windows" {
|
||||
return nil
|
||||
}
|
||||
metrics = make([]Metric, 0, 20)
|
||||
|
||||
p, err := procfs.Self()
|
||||
if err != nil {
|
||||
logger.LogOnceIf(ctx, err, string(nodeMetricNamespace))
|
||||
@ -1227,6 +1227,8 @@ func getMinioProcMetrics() *MetricsGroup {
|
||||
stat, _ := p.Stat()
|
||||
startTime, _ := stat.StartTime()
|
||||
|
||||
metrics = make([]Metric, 0, 20)
|
||||
|
||||
if openFDs > 0 {
|
||||
metrics = append(metrics,
|
||||
Metric{
|
||||
@ -1794,7 +1796,6 @@ func getMinioHealingMetrics() *MetricsGroup {
|
||||
cacheInterval: 10 * time.Second,
|
||||
}
|
||||
mg.RegisterRead(func(_ context.Context) (metrics []Metric) {
|
||||
metrics = make([]Metric, 0, 5)
|
||||
bgSeq, exists := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID)
|
||||
if !exists {
|
||||
return
|
||||
@ -1804,6 +1805,7 @@ func getMinioHealingMetrics() *MetricsGroup {
|
||||
return
|
||||
}
|
||||
|
||||
metrics = make([]Metric, 0, 5)
|
||||
metrics = append(metrics, Metric{
|
||||
Description: getHealLastActivityTimeMD(),
|
||||
Value: float64(time.Since(bgSeq.lastHealActivity)),
|
||||
|
Loading…
Reference in New Issue
Block a user