mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: crash in prometherus metrics collector (#12244)
node_health metrics crashes in gateway mode, in gateway mode ignore node health metrics. fixes #12243
This commit is contained in:
parent
af0c65be93
commit
d495cb68d3
@ -1041,6 +1041,10 @@ func getNodeHealthMetrics() MetricsGroup {
|
|||||||
id: "NodeHealthMetrics",
|
id: "NodeHealthMetrics",
|
||||||
cachedRead: cachedRead,
|
cachedRead: cachedRead,
|
||||||
read: func(_ context.Context) (metrics []Metric) {
|
read: func(_ context.Context) (metrics []Metric) {
|
||||||
|
if globalIsGateway {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
metrics = make([]Metric, 0, 16)
|
||||||
nodesUp, nodesDown := GetPeerOnlineCount()
|
nodesUp, nodesDown := GetPeerOnlineCount()
|
||||||
metrics = append(metrics, Metric{
|
metrics = append(metrics, Metric{
|
||||||
Description: getNodeOnlineTotalMD(),
|
Description: getNodeOnlineTotalMD(),
|
||||||
@ -1276,17 +1280,13 @@ func getBucketUsageMetrics() MetricsGroup {
|
|||||||
id: "BucketUsageMetrics",
|
id: "BucketUsageMetrics",
|
||||||
cachedRead: cachedRead,
|
cachedRead: cachedRead,
|
||||||
read: func(ctx context.Context) (metrics []Metric) {
|
read: func(ctx context.Context) (metrics []Metric) {
|
||||||
metrics = make([]Metric, 0, 50)
|
|
||||||
objLayer := newObjectLayerFn()
|
objLayer := newObjectLayerFn()
|
||||||
// Service not initialized yet
|
// Service not initialized yet
|
||||||
if objLayer == nil {
|
if objLayer == nil || globalIsGateway {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if globalIsGateway {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metrics = make([]Metric, 0, 50)
|
||||||
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objLayer)
|
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objLayer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -1369,11 +1369,7 @@ func getLocalStorageMetrics() MetricsGroup {
|
|||||||
read: func(ctx context.Context) (metrics []Metric) {
|
read: func(ctx context.Context) (metrics []Metric) {
|
||||||
objLayer := newObjectLayerFn()
|
objLayer := newObjectLayerFn()
|
||||||
// Service not initialized yet
|
// Service not initialized yet
|
||||||
if objLayer == nil {
|
if objLayer == nil || globalIsGateway {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if globalIsGateway {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,11 +1411,7 @@ func getClusterStorageMetrics() MetricsGroup {
|
|||||||
read: func(ctx context.Context) (metrics []Metric) {
|
read: func(ctx context.Context) (metrics []Metric) {
|
||||||
objLayer := newObjectLayerFn()
|
objLayer := newObjectLayerFn()
|
||||||
// Service not initialized yet
|
// Service not initialized yet
|
||||||
if objLayer == nil {
|
if objLayer == nil || globalIsGateway {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if globalIsGateway {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user