mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Filter out unrequested scopes when fetching data from archive
This commit is contained in:
parent
cbc8227550
commit
cdfa63d5ca
@ -108,11 +108,18 @@ func LoadData(job *schema.Job, metrics []string, scopes []schema.MetricScope, ct
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Avoid sending unrequested data to the client:
|
// Avoid sending unrequested data to the client:
|
||||||
if metrics != nil {
|
if metrics != nil || scopes != nil {
|
||||||
|
if metrics == nil {
|
||||||
|
metrics = make([]string, 0, len(jd))
|
||||||
|
for k := range jd {
|
||||||
|
metrics = append(metrics, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res := schema.JobData{}
|
res := schema.JobData{}
|
||||||
for _, metric := range metrics {
|
for _, metric := range metrics {
|
||||||
if perscope, ok := jd[metric]; ok {
|
if perscope, ok := jd[metric]; ok {
|
||||||
if len(scopes) > 1 {
|
if len(perscope) > 1 {
|
||||||
subset := make(map[schema.MetricScope]*schema.JobMetric)
|
subset := make(map[schema.MetricScope]*schema.JobMetric)
|
||||||
for _, scope := range scopes {
|
for _, scope := range scopes {
|
||||||
if jm, ok := perscope[scope]; ok {
|
if jm, ok := perscope[scope]; ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user