Skip to content

Commit

Permalink
[chore] prometheusreceiver: remove unnecessary member, hasData equiva…
Browse files Browse the repository at this point in the history
…lent len is not 0 (open-telemetry#13941)

Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Sep 7, 2022
1 parent e016e1d commit 52793ae
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions receiver/prometheusreceiver/internal/metricsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func convToMetricType(metricType textparse.MetricType) (pmetric.MetricDataType,

type metricBuilder struct {
families map[string]*metricFamily
hasData bool
mc MetadataCache
useStartTimeMetric bool
startTimeMetricRegex *regexp.Regexp
Expand Down Expand Up @@ -167,8 +166,6 @@ func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) error
b.startTime = v
}

b.hasData = true

curMF, ok := b.families[metricName]
if !ok {
familyName := normalizeMetricName(metricName)
Expand All @@ -186,7 +183,7 @@ func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) error
// appendMetrics appends all metrics to the given slice.
// The only error returned by this function is errNoDataToBuild.
func (b *metricBuilder) appendMetrics(metrics pmetric.MetricSlice) error {
if !b.hasData {
if len(b.families) == 0 {
return errNoDataToBuild
}

Expand Down

0 comments on commit 52793ae

Please sign in to comment.