Skip to content

Commit

Permalink
Remove the confusing package-level variable (#2152)
Browse files Browse the repository at this point in the history
This is unncessarily a package level variable and at the same time, the name is confusing. It should be called "empty" instead of dummy. But no need to have it as a package-level variable, hence this change removes it.
  • Loading branch information
rakyll authored Nov 20, 2020
1 parent 8ceddba commit cc0a999
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions receiver/prometheusreceiver/internal/metricsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ var (
errNoDataToBuild = errors.New("there's no data to build")
errNoBoundaryLabel = errors.New("given metricType has no BucketLabel or QuantileLabel")
errEmptyBoundaryLabel = errors.New("BucketLabel or QuantileLabel is empty")

dummyMetrics = make([]*metricspb.Metric, 0)
)

type metricBuilder struct {
Expand Down Expand Up @@ -140,7 +138,7 @@ func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) error
func (b *metricBuilder) Build() ([]*metricspb.Metric, int, int, error) {
if !b.hasData {
if b.hasInternalMetric {
return dummyMetrics, 0, 0, nil
return make([]*metricspb.Metric, 0), 0, 0, nil
}
return nil, 0, 0, errNoDataToBuild
}
Expand Down

0 comments on commit cc0a999

Please sign in to comment.