Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/winperfcounters] Add counter name to ScrapeData errors #14450

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]