Skip to content

Commit

Permalink
fix: remve AddCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Nov 18, 2024
1 parent b78274d commit 938ce4c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions helpers/windows/pdh/pdh_query_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,7 @@ func (q *Query) GetCountersAndInstances(objectName string) ([]string, []string,

func (q *Query) GetRawCounterValue(counterName string) (*PdhRawCounter, error) {
if _, ok := q.Counters[counterName]; !ok {
if err := q.AddCounter(counterName, "", "", false); err != nil {
return nil, err
}
}
if err := q.CollectData(); err != nil {
return nil, err
return nil, fmt.Errorf("%s doesn't exist in the map; call AddCounter()", counterName)
}
c, err := PdhGetRawCounterValue(q.Counters[counterName].handle)
if err != nil {
Expand Down

0 comments on commit 938ce4c

Please sign in to comment.