mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-01-15 17:21:46 +01:00
filter metrics for NodeMetrics query
This commit is contained in:
@@ -756,10 +756,16 @@ func (r *queryResolver) NodeMetrics(ctx context.Context, cluster string, nodes [
|
|||||||
return nil, errors.New("you need to be administrator or support staff for this query")
|
return nil, errors.New("you need to be administrator or support staff for this query")
|
||||||
}
|
}
|
||||||
|
|
||||||
if metrics == nil {
|
defaultMetrics := make([]string, 0)
|
||||||
for _, mc := range archive.GetCluster(cluster).MetricConfig {
|
for _, mc := range archive.GetCluster(cluster).MetricConfig {
|
||||||
metrics = append(metrics, mc.Name)
|
defaultMetrics = append(defaultMetrics, mc.Name)
|
||||||
}
|
}
|
||||||
|
if metrics == nil {
|
||||||
|
metrics = defaultMetrics
|
||||||
|
} else {
|
||||||
|
metrics = slices.DeleteFunc(metrics, func(metric string) bool {
|
||||||
|
return !slices.Contains(defaultMetrics, metric) // Remove undefined metrics.
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := metricdispatch.LoadNodeData(cluster, metrics, nodes, scopes, from, to, ctx)
|
data, err := metricdispatch.LoadNodeData(cluster, metrics, nodes, scopes, from, to, ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user