diff --git a/CHANGELOG.md b/CHANGELOG.md index 10a0f39a62df..c5db81dafa2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - `hostmetricsreceiver`: Use cpu times for time delta in cpu.utilization calculation (#8857) - `dynatraceexporter`: Remove overly verbose stacktrace from certain logs (#8989) - `googlecloudexporter`: fix the `exporter.googlecloud.OTLPDirect` fature-gate, which was not applied when the flag was provided (#9116) +- `windowsperfcountersreceiver`: fix exported values being integers instead of doubles (#9138) ### 🚩 Deprecations 🚩 diff --git a/receiver/windowsperfcountersreceiver/testdata/scraper/sum_metric.json b/receiver/windowsperfcountersreceiver/testdata/scraper/sum_metric.json index 518db2dfa87b..28a5a81fd75f 100644 --- a/receiver/windowsperfcountersreceiver/testdata/scraper/sum_metric.json +++ b/receiver/windowsperfcountersreceiver/testdata/scraper/sum_metric.json @@ -12,7 +12,7 @@ "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "19446169600", + "asDouble": "19446169600", "timeUnixNano": "1646862225775600200" } ] diff --git a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go index 0390da65d91b..828986666d1a 100644 --- a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go +++ b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go @@ -165,15 +165,6 @@ func (s *scraper) scrape(context.Context) (pdata.Metrics, error) { return md, errs } -func initializeNumberDataPointAsDouble(dataPoint pdata.NumberDataPoint, now pdata.Timestamp, instanceLabel string, value float64) { - if instanceLabel != "" { - dataPoint.Attributes().InsertString(instanceLabelName, instanceLabel) - } - - dataPoint.SetTimestamp(now) - dataPoint.SetDoubleVal(value) -} - func initializeMetricDps(metric pdata.Metric, now pdata.Timestamp, counterValues []win_perf_counters.CounterValue, attributes map[string]string) { var dps pdata.NumberDataPointSlice @@ -197,6 +188,6 @@ func initializeMetricDps(metric pdata.Metric, now pdata.Timestamp, counterValues } dp.SetTimestamp(now) - dp.SetIntVal(int64(counterValue.Value)) + dp.SetDoubleVal(counterValue.Value) } }