diff --git a/metricdata/cc-metric-store.go b/metricdata/cc-metric-store.go index b1e69d0..78d8750 100644 --- a/metricdata/cc-metric-store.go +++ b/metricdata/cc-metric-store.go @@ -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 } diff --git a/metricdata/metricdata.go b/metricdata/metricdata.go index 361aba7..d4d9817 100644 --- a/metricdata/metricdata.go +++ b/metricdata/metricdata.go @@ -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 {