From b49653fd6ae87183f2be595406166c962f6f747e Mon Sep 17 00:00:00 2001 From: Brandon Johnson Date: Thu, 22 Sep 2022 13:24:27 -0400 Subject: [PATCH 1/2] add extra context to ScrapeData errors --- pkg/winperfcounters/watcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/winperfcounters/watcher.go b/pkg/winperfcounters/watcher.go index 9eb4518ed240..47f5b7da7bc3 100644 --- a/pkg/winperfcounters/watcher.go +++ b/pkg/winperfcounters/watcher.go @@ -106,12 +106,12 @@ func (pc *perfCounter) Path() string { func (pc *perfCounter) ScrapeData() ([]CounterValue, error) { err := pc.query.CollectData() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to collect data for performance counter '%s': %w", pc.path, err) } vals, err := pc.query.GetFormattedCounterArrayDouble(pc.handle) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to format data for performance counter '%s': %w", pc.path, err) } vals = removeTotalIfMultipleValues(vals) From 80bb9a24c60c3bbf2df7636214b00355126b677c Mon Sep 17 00:00:00 2001 From: Brandon Johnson Date: Thu, 22 Sep 2022 13:56:20 -0400 Subject: [PATCH 2/2] changelog --- .../winperfcounters-add-countername-to-error.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 unreleased/winperfcounters-add-countername-to-error.yaml diff --git a/unreleased/winperfcounters-add-countername-to-error.yaml b/unreleased/winperfcounters-add-countername-to-error.yaml new file mode 100755 index 000000000000..69a6b642cbe8 --- /dev/null +++ b/unreleased/winperfcounters-add-countername-to-error.yaml @@ -0,0 +1,11 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/winperfcounters + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add counter path to error if scraping fails + +# One or more tracking issues related to the change +issues: [14443]