mirror of
https://github.com/minio/minio.git
synced 2025-04-09 14:10:10 -04: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" {
|
if runtime.GOOS == "windows" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
metrics = make([]Metric, 0, 20)
|
|
||||||
p, err := procfs.Self()
|
p, err := procfs.Self()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogOnceIf(ctx, err, string(nodeMetricNamespace))
|
logger.LogOnceIf(ctx, err, string(nodeMetricNamespace))
|
||||||
@ -1227,6 +1227,8 @@ func getMinioProcMetrics() *MetricsGroup {
|
|||||||
stat, _ := p.Stat()
|
stat, _ := p.Stat()
|
||||||
startTime, _ := stat.StartTime()
|
startTime, _ := stat.StartTime()
|
||||||
|
|
||||||
|
metrics = make([]Metric, 0, 20)
|
||||||
|
|
||||||
if openFDs > 0 {
|
if openFDs > 0 {
|
||||||
metrics = append(metrics,
|
metrics = append(metrics,
|
||||||
Metric{
|
Metric{
|
||||||
@ -1794,7 +1796,6 @@ func getMinioHealingMetrics() *MetricsGroup {
|
|||||||
cacheInterval: 10 * time.Second,
|
cacheInterval: 10 * time.Second,
|
||||||
}
|
}
|
||||||
mg.RegisterRead(func(_ context.Context) (metrics []Metric) {
|
mg.RegisterRead(func(_ context.Context) (metrics []Metric) {
|
||||||
metrics = make([]Metric, 0, 5)
|
|
||||||
bgSeq, exists := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID)
|
bgSeq, exists := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID)
|
||||||
if !exists {
|
if !exists {
|
||||||
return
|
return
|
||||||
@ -1804,6 +1805,7 @@ func getMinioHealingMetrics() *MetricsGroup {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metrics = make([]Metric, 0, 5)
|
||||||
metrics = append(metrics, Metric{
|
metrics = append(metrics, Metric{
|
||||||
Description: getHealLastActivityTimeMD(),
|
Description: getHealLastActivityTimeMD(),
|
||||||
Value: float64(time.Since(bgSeq.lastHealActivity)),
|
Value: float64(time.Since(bgSeq.lastHealActivity)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user