Merge pull request #1005 from huanggze/monit
fix crash when monitoring component is disabled
This commit is contained in:
@@ -40,6 +40,9 @@ func GetNamespacesWithMetrics(namespaces []*v1.Namespace) []*v1.Namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rawMetrics := GetNamespaceMetrics(params)
|
rawMetrics := GetNamespaceMetrics(params)
|
||||||
|
if rawMetrics == nil {
|
||||||
|
return namespaces
|
||||||
|
}
|
||||||
|
|
||||||
for _, result := range rawMetrics.Results {
|
for _, result := range rawMetrics.Results {
|
||||||
for _, data := range result.Data.Result {
|
for _, data := range result.Data.Result {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func (rawMetrics *Response) SortBy(sortMetricName string, sortType string) (*Res
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if sortMetricName == "" {
|
if sortMetricName == "" || rawMetrics == nil {
|
||||||
return rawMetrics, -1
|
return rawMetrics, -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user