-
Notifications
You must be signed in to change notification settings - Fork 147
Open
Labels
bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Description
The _count counter is not included in data pushed to New Relic for Prometheus histograms.
Expected Behavior
The _count counter should be included.
Steps to Reproduce
Scrape a Prometheus histogram with the infrastructure agent and nri-prometheus. Note that the _count counter is not exported to New Relic.
Additional context
The summary type already has support for _count:
infrastructure-agent/pkg/integrations/v4/dm/telemetry.go
Lines 270 to 277 in dc896c4
| metricName = metric.Name + "_count" | |
| countMetric, ok := p.calculate.get(metricName, metric.Attributes, value.SampleCount, metric.Time()) | |
| if ok { | |
| result = append(result, countMetric) | |
| } else { | |
| telemetryLogger.WithField("name", metricName).WithField("metric-type", metric.Type).Debug(noCalculationMadeErrMsg) | |
| } |
But it looks like the histogram type doesn't:
infrastructure-agent/pkg/integrations/v4/dm/telemetry.go
Lines 201 to 234 in dc896c4
| metricName := metric.Name + "_sum" | |
| sumCount, ok := ph.calculate.get(metricName, metric.Attributes, float64(*value.SampleCount), metric.Time()) | |
| if ok { | |
| result = append(result, telemetry.Summary{ | |
| Name: metricName, | |
| Attributes: metric.Attributes, | |
| Count: 1, | |
| Sum: sumCount.Value, | |
| Min: math.NaN(), | |
| Max: math.NaN(), | |
| Timestamp: metric.Time(), | |
| Interval: sumCount.Interval, | |
| }) | |
| } else { | |
| telemetryLogger.WithField("name", metricName).WithField("metric-type", metric.Type).Debug(noCalculationMadeErrMsg) | |
| } | |
| metricName = metric.Name + "_bucket" | |
| for _, b := range value.Buckets { | |
| bucketAttrs := metric.CopyAttrs() | |
| bucketAttrs["le"] = fmt.Sprintf("%g", *b.UpperBound) | |
| bucketCount, ok := ph.calculate.get( | |
| metricName, | |
| bucketAttrs, | |
| float64(*b.CumulativeCount), | |
| metric.Time(), | |
| ) | |
| if ok { | |
| result = append(result, bucketCount) | |
| } else { | |
| telemetryLogger.WithField("name", metricName).WithField("metric-type", metric.Type).Debug(noCalculationMadeErrMsg) | |
| } | |
| } |
For Maintainers Only or Hero Triaging this bug
Suggested Priority (P1,P2,P3,P4,P5):
Suggested T-Shirt size (S, M, L, XL, Unknown):
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.