Skip to content

Commit

Permalink
[pkg/winperfcounters] Add counter name to ScrapeData errors (#14450)
Browse files Browse the repository at this point in the history
* add extra context to ScrapeData errors
  • Loading branch information
BinaryFissionGames authored Sep 28, 2022
1 parent 575c72b commit a473a33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/winperfcounters/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions unreleased/winperfcounters-add-countername-to-error.yaml
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit a473a33

Please sign in to comment.