diff --git a/receiver/apachereceiver/scraper.go b/receiver/apachereceiver/scraper.go index 6f3793207f42..09b451e67aeb 100644 --- a/receiver/apachereceiver/scraper.go +++ b/receiver/apachereceiver/scraper.go @@ -70,26 +70,26 @@ func (r *apacheScraper) scrape(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, err } - var errors scrapererror.ScrapeErrors + errs := &scrapererror.ScrapeErrors{} now := pcommon.NewTimestampFromTime(time.Now()) for metricKey, metricValue := range parseStats(stats) { switch metricKey { case "ServerUptimeSeconds": - addPartialIfError(errors, r.mb.RecordApacheUptimeDataPoint(now, metricValue, r.cfg.serverName)) + addPartialIfError(errs, r.mb.RecordApacheUptimeDataPoint(now, metricValue, r.cfg.serverName)) case "ConnsTotal": - addPartialIfError(errors, r.mb.RecordApacheCurrentConnectionsDataPoint(now, metricValue, r.cfg.serverName)) + addPartialIfError(errs, r.mb.RecordApacheCurrentConnectionsDataPoint(now, metricValue, r.cfg.serverName)) case "BusyWorkers": - addPartialIfError(errors, r.mb.RecordApacheWorkersDataPoint(now, metricValue, r.cfg.serverName, + addPartialIfError(errs, r.mb.RecordApacheWorkersDataPoint(now, metricValue, r.cfg.serverName, metadata.AttributeWorkersStateBusy)) case "IdleWorkers": - addPartialIfError(errors, r.mb.RecordApacheWorkersDataPoint(now, metricValue, r.cfg.serverName, + addPartialIfError(errs, r.mb.RecordApacheWorkersDataPoint(now, metricValue, r.cfg.serverName, metadata.AttributeWorkersStateIdle)) case "Total Accesses": - addPartialIfError(errors, r.mb.RecordApacheRequestsDataPoint(now, metricValue, r.cfg.serverName)) + addPartialIfError(errs, r.mb.RecordApacheRequestsDataPoint(now, metricValue, r.cfg.serverName)) case "Total kBytes": i, err := strconv.ParseInt(metricValue, 10, 64) if err != nil { - errors.AddPartial(1, err) + errs.AddPartial(1, err) } else { r.mb.RecordApacheTrafficDataPoint(now, kbytesToBytes(i), r.cfg.serverName) } @@ -101,12 +101,12 @@ func (r *apacheScraper) scrape(context.Context) (pmetric.Metrics, error) { } } - return r.mb.Emit(), errors.Combine() + return r.mb.Emit(), errs.Combine() } -func addPartialIfError(errors scrapererror.ScrapeErrors, err error) { +func addPartialIfError(errs *scrapererror.ScrapeErrors, err error) { if err != nil { - errors.AddPartial(1, err) + errs.AddPartial(1, err) } } diff --git a/unreleased/apachereceiver-fix-partial-error.yaml b/unreleased/apachereceiver-fix-partial-error.yaml new file mode 100755 index 000000000000..7910532bc421 --- /dev/null +++ b/unreleased/apachereceiver-fix-partial-error.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: apachereceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix some partial errors not being correctly reported + +# One or more tracking issues related to the change +issues: [13133] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: