mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
ignore unreadable metrics on certain closed systems (#14234)
fixes #14233
This commit is contained in:
parent
63a2e0bab6
commit
01e550a9be
@ -942,94 +942,109 @@ func getMinioProcMetrics() *MetricsGroup {
|
|||||||
logger.LogOnceIf(ctx, err, nodeMetricNamespace)
|
logger.LogOnceIf(ctx, err, nodeMetricNamespace)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var openFDs int
|
|
||||||
openFDs, err = p.FileDescriptorsLen()
|
openFDs, _ := p.FileDescriptorsLen()
|
||||||
if err != nil {
|
l, _ := p.Limits()
|
||||||
logger.LogOnceIf(ctx, err, getMinioFDOpenMD())
|
io, _ := p.IO()
|
||||||
return
|
stat, _ := p.Stat()
|
||||||
}
|
startTime, _ := stat.StartTime()
|
||||||
l, err := p.Limits()
|
|
||||||
if err != nil {
|
if openFDs > 0 {
|
||||||
logger.LogOnceIf(ctx, err, getMinioFDLimitMD())
|
metrics = append(metrics,
|
||||||
return
|
Metric{
|
||||||
}
|
Description: getMinioFDOpenMD(),
|
||||||
io, err := p.IO()
|
Value: float64(openFDs),
|
||||||
if err != nil {
|
},
|
||||||
logger.LogOnceIf(ctx, err, ioSubsystem)
|
)
|
||||||
return
|
|
||||||
}
|
|
||||||
stat, err := p.Stat()
|
|
||||||
if err != nil {
|
|
||||||
logger.LogOnceIf(ctx, err, processSubsystem)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
startTime, err := stat.StartTime()
|
|
||||||
if err != nil {
|
|
||||||
logger.LogOnceIf(ctx, err, startTime)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics = append(metrics,
|
if l.OpenFiles > 0 {
|
||||||
Metric{
|
metrics = append(metrics,
|
||||||
Description: getMinioFDOpenMD(),
|
Metric{
|
||||||
Value: float64(openFDs),
|
Description: getMinioFDLimitMD(),
|
||||||
},
|
Value: float64(l.OpenFiles),
|
||||||
)
|
})
|
||||||
metrics = append(metrics,
|
}
|
||||||
Metric{
|
|
||||||
Description: getMinioFDLimitMD(),
|
if io.SyscR > 0 {
|
||||||
Value: float64(l.OpenFiles),
|
metrics = append(metrics,
|
||||||
})
|
Metric{
|
||||||
metrics = append(metrics,
|
Description: getMinIOProcessSysCallRMD(),
|
||||||
Metric{
|
Value: float64(io.SyscR),
|
||||||
Description: getMinIOProcessSysCallRMD(),
|
})
|
||||||
Value: float64(io.SyscR),
|
}
|
||||||
})
|
|
||||||
metrics = append(metrics,
|
if io.SyscW > 0 {
|
||||||
Metric{
|
metrics = append(metrics,
|
||||||
Description: getMinIOProcessSysCallWMD(),
|
Metric{
|
||||||
Value: float64(io.SyscW),
|
Description: getMinIOProcessSysCallWMD(),
|
||||||
})
|
Value: float64(io.SyscW),
|
||||||
metrics = append(metrics,
|
})
|
||||||
Metric{
|
}
|
||||||
Description: getMinioProcessIOReadBytesMD(),
|
|
||||||
Value: float64(io.ReadBytes),
|
if io.ReadBytes > 0 {
|
||||||
})
|
metrics = append(metrics,
|
||||||
metrics = append(metrics,
|
Metric{
|
||||||
Metric{
|
Description: getMinioProcessIOReadBytesMD(),
|
||||||
Description: getMinioProcessIOWriteBytesMD(),
|
Value: float64(io.ReadBytes),
|
||||||
Value: float64(io.WriteBytes),
|
})
|
||||||
})
|
}
|
||||||
metrics = append(metrics,
|
|
||||||
Metric{
|
if io.WriteBytes > 0 {
|
||||||
Description: getMinioProcessIOReadCachedBytesMD(),
|
metrics = append(metrics,
|
||||||
Value: float64(io.RChar),
|
Metric{
|
||||||
})
|
Description: getMinioProcessIOWriteBytesMD(),
|
||||||
metrics = append(metrics,
|
Value: float64(io.WriteBytes),
|
||||||
Metric{
|
})
|
||||||
Description: getMinioProcessIOWriteCachedBytesMD(),
|
}
|
||||||
Value: float64(io.WChar),
|
|
||||||
})
|
if io.RChar > 0 {
|
||||||
metrics = append(metrics,
|
metrics = append(metrics,
|
||||||
Metric{
|
Metric{
|
||||||
Description: getMinIOProcessStartTimeMD(),
|
Description: getMinioProcessIOReadCachedBytesMD(),
|
||||||
Value: startTime,
|
Value: float64(io.RChar),
|
||||||
})
|
})
|
||||||
metrics = append(metrics,
|
}
|
||||||
Metric{
|
|
||||||
Description: getMinIOProcessUptimeMD(),
|
if io.WChar > 0 {
|
||||||
Value: time.Since(globalBootTime).Seconds(),
|
metrics = append(metrics,
|
||||||
})
|
Metric{
|
||||||
metrics = append(metrics,
|
Description: getMinioProcessIOWriteCachedBytesMD(),
|
||||||
Metric{
|
Value: float64(io.WChar),
|
||||||
Description: getMinIOProcessResidentMemory(),
|
})
|
||||||
Value: float64(stat.ResidentMemory()),
|
}
|
||||||
})
|
|
||||||
metrics = append(metrics,
|
if startTime > 0 {
|
||||||
Metric{
|
metrics = append(metrics,
|
||||||
Description: getMinIOProcessCPUTime(),
|
Metric{
|
||||||
Value: stat.CPUTime(),
|
Description: getMinIOProcessStartTimeMD(),
|
||||||
})
|
Value: startTime,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if !globalBootTime.IsZero() {
|
||||||
|
metrics = append(metrics,
|
||||||
|
Metric{
|
||||||
|
Description: getMinIOProcessUptimeMD(),
|
||||||
|
Value: time.Since(globalBootTime).Seconds(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if stat.ResidentMemory() > 0 {
|
||||||
|
metrics = append(metrics,
|
||||||
|
Metric{
|
||||||
|
Description: getMinIOProcessResidentMemory(),
|
||||||
|
Value: float64(stat.ResidentMemory()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if stat.CPUTime() > 0 {
|
||||||
|
metrics = append(metrics,
|
||||||
|
Metric{
|
||||||
|
Description: getMinIOProcessCPUTime(),
|
||||||
|
Value: stat.CPUTime(),
|
||||||
|
})
|
||||||
|
}
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
return mg
|
return mg
|
||||||
|
Loading…
Reference in New Issue
Block a user