Skip to content

Commit 31f4391

Browse files
committed
collector: call PdhGetRawCounterArrayW twice to get the correct amount of bytes needed.
Signed-off-by: Jan-Otto Kröpke <[email protected]>
1 parent 44e2257 commit 31f4391

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/pdh/collector.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ func (c *Collector) collectWorkerRaw() {
350350
if err := NewPdhError(ret); isKnownCounterDataError(err) {
351351
break
352352
}
353+
353354
return fmt.Errorf("GetRawCounterArray size query: %w", NewPdhError(ret))
354355
}
355356

@@ -372,6 +373,7 @@ func (c *Collector) collectWorkerRaw() {
372373
if err := NewPdhError(ret); isKnownCounterDataError(err) {
373374
break
374375
}
376+
375377
return fmt.Errorf("GetRawCounterArray data retrieval: %w", NewPdhError(ret))
376378
}
377379

@@ -525,6 +527,7 @@ func (c *Collector) collectWorkerFormatted() {
525527
if err := NewPdhError(ret); isKnownCounterDataError(err) {
526528
break
527529
}
530+
528531
return fmt.Errorf("GetFormattedCounterArrayDouble size query: %w", NewPdhError(ret))
529532
}
530533

@@ -547,6 +550,7 @@ func (c *Collector) collectWorkerFormatted() {
547550
if err := NewPdhError(ret); isKnownCounterDataError(err) {
548551
break
549552
}
553+
550554
return fmt.Errorf("GetFormattedCounterArrayDouble data retrieval: %w", NewPdhError(ret))
551555
}
552556

0 commit comments

Comments
 (0)