Skip to content

Commit

Permalink
[chore][pkg/windowsperfcounters] Fix lint on Windows (open-telemetry#…
Browse files Browse the repository at this point in the history
…30671)

**Description:**
Fixing lint issues when GOOS=windows. This is in preparation to
eventually include lint with GOOS=windows as part of CI.

**Link to tracking Issue:**
N/A

**Testing:**
`make` on component folder on a Windows box

**Documentation:**
N/A

Co-authored-by: Daniel Jaglowski <[email protected]>
  • Loading branch information
pjanotti and djaglowski committed Jan 22, 2024
1 parent 148d97c commit 187c88a
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 @@ -6,6 +6,7 @@
package winperfcounters // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/winperfcounters"

import (
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -103,8 +104,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 187c88a

Please sign in to comment.