mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Allow partially missing data on system view
This commit is contained in:
parent
8facef21a9
commit
a9f6da7595
@ -211,7 +211,7 @@ func (ccms *CCMetricStore) LoadData(job *schema.Job, metrics []string, scopes []
|
||||
}
|
||||
|
||||
if len(errors) != 0 {
|
||||
return jobData, fmt.Errorf("cc-metric-store: errors: %s", strings.Join(errors, ","))
|
||||
return jobData, fmt.Errorf("cc-metric-store: %s", strings.Join(errors, ", "))
|
||||
}
|
||||
|
||||
return jobData, nil
|
||||
@ -528,7 +528,7 @@ func (ccms *CCMetricStore) LoadNodeData(cluster, partition string, metrics, node
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = resBody
|
||||
var errors []string
|
||||
data := make(map[string]map[string][]*schema.JobMetric)
|
||||
for i, res := range resBody.Results {
|
||||
var query ApiQuery
|
||||
@ -541,7 +541,7 @@ func (ccms *CCMetricStore) LoadNodeData(cluster, partition string, metrics, node
|
||||
metric := ccms.toLocalName(query.Metric)
|
||||
qdata := res[0]
|
||||
if qdata.Error != nil {
|
||||
return nil, fmt.Errorf("fetching %s for node %s failed: %s", metric, query.Hostname, *qdata.Error)
|
||||
errors = append(errors, fmt.Sprintf("fetching %s for node %s failed: %s", metric, query.Hostname, *qdata.Error))
|
||||
}
|
||||
|
||||
if qdata.Avg.IsNaN() || qdata.Min.IsNaN() || qdata.Max.IsNaN() {
|
||||
@ -574,5 +574,9 @@ func (ccms *CCMetricStore) LoadNodeData(cluster, partition string, metrics, node
|
||||
})
|
||||
}
|
||||
|
||||
if len(errors) != 0 {
|
||||
return data, fmt.Errorf("cc-metric-store: %s", strings.Join(errors, ", "))
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ func LoadData(job *schema.Job, metrics []string, scopes []schema.MetricScope, ct
|
||||
jd, err = repo.LoadData(job, metrics, scopes, ctx)
|
||||
if err != nil {
|
||||
if len(jd) != 0 {
|
||||
log.Errorf("partial error: %s (some data will be returned)", err.Error())
|
||||
log.Errorf("partial error: %s", err.Error())
|
||||
} else {
|
||||
return err, 0, 0
|
||||
}
|
||||
@ -174,7 +174,11 @@ func LoadNodeData(cluster, partition string, metrics, nodes []string, scopes []s
|
||||
|
||||
data, err := repo.LoadNodeData(cluster, partition, metrics, nodes, scopes, from, to, ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if len(data) != 0 {
|
||||
log.Errorf("partial error: %s", err.Error())
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user