Skip to content

Commit

Permalink
resolve conflicts with master
Browse files Browse the repository at this point in the history
  • Loading branch information
huyan0 committed Aug 28, 2020
1 parent 83f0376 commit 1529156
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions exporter/prometheusremotewriteexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (prwe *prwExporter) pushMetrics(ctx context.Context, md pdata.Metrics) (int
defer prwe.wg.Done()
select {
case <-prwe.closeChan:
return pdatautil.MetricCount(md), errors.Errorf("shutdown has been called")
return pdatautil.MetricCount(md), errors.New("shutdown has been called")
default:
tsMap := map[string]*prompb.TimeSeries{}
dropped := 0
Expand Down Expand Up @@ -119,7 +119,7 @@ func (prwe *prwExporter) pushMetrics(ctx context.Context, md pdata.Metrics) (int
}

if dropped != 0 {
return dropped, errors.Errorf(strings.Join(errs, "\n"))
return dropped, errors.New(strings.Join(errs, "\n"))
}

return 0, nil
Expand All @@ -137,7 +137,7 @@ func (prwe *prwExporter) handleScalarMetric(tsMap map[string]*prompb.TimeSeries,
// int points
case otlp.MetricDescriptor_MONOTONIC_INT64, otlp.MetricDescriptor_INT64:
if metric.Int64DataPoints == nil {
return errors.Errorf("nil data point field in metric" + metric.GetMetricDescriptor().Name)
return errors.New("nil data point field in metric" + metric.GetMetricDescriptor().Name)
}

for _, pt := range metric.Int64DataPoints {
Expand All @@ -158,7 +158,7 @@ func (prwe *prwExporter) handleScalarMetric(tsMap map[string]*prompb.TimeSeries,
// double points
case otlp.MetricDescriptor_MONOTONIC_DOUBLE, otlp.MetricDescriptor_DOUBLE:
if metric.DoubleDataPoints == nil {
return errors.Errorf("nil data point field in metric" + metric.GetMetricDescriptor().Name)
return errors.New("nil data point field in metric" + metric.GetMetricDescriptor().Name)
}
for _, pt := range metric.DoubleDataPoints {

Expand All @@ -175,7 +175,7 @@ func (prwe *prwExporter) handleScalarMetric(tsMap map[string]*prompb.TimeSeries,
return nil
}

return errors.Errorf("invalid metric type: wants int or double data points")
return errors.New("invalid metric type: wants int or double data points")
}

// export sends a Snappy-compressed WriteRequest containing TimeSeries to a remote write endpoint in order
Expand Down Expand Up @@ -222,7 +222,8 @@ func (prwe *prwExporter) export(ctx context.Context, tsMap map[string]*prompb.Ti
if scanner.Scan() {
line = scanner.Text()
}
return errors.Errorf("server returned HTTP status %s: %s", httpResp.Status, line)
errMsg := "server returned HTTP status " + httpResp.Status + ": " + line
return errors.New(errMsg)
}
return nil
}

0 comments on commit 1529156

Please sign in to comment.