Skip to content

Commit

Permalink
[chore][pkg/winperfcounters] Fix lint on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti committed Jan 5, 2024
1 parent f39ccc1 commit 92f78f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/winperfcounters/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package winperfcounters // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/winperfcounters"

import (
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -104,8 +105,8 @@ func (pc *perfCounter) Path() string {

func (pc *perfCounter) ScrapeData() ([]CounterValue, error) {
if err := pc.query.CollectData(); err != nil {
pdhErr, ok := err.(*win_perf_counters.PdhError)
if !ok || pdhErr.ErrorCode != win_perf_counters.PDH_CALC_NEGATIVE_DENOMINATOR {
var pdhErr *win_perf_counters.PdhError
if !errors.As(err, &pdhErr) || pdhErr.ErrorCode != win_perf_counters.PDH_CALC_NEGATIVE_DENOMINATOR {
return nil, fmt.Errorf("failed to collect data for performance counter '%s': %w", pc.path, err)
}

Expand Down

0 comments on commit 92f78f3

Please sign in to comment.