Restore Windows 2012 support.

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke 2024-04-20 21:46:02 +02:00
parent 8e2e867b11
commit d503ae05d4
No known key found for this signature in database

View File

@ -3,6 +3,7 @@
package os
import (
"errors"
"fmt"
"os"
"strings"
@ -224,7 +225,9 @@ func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
}
revision, _, err := ntKey.GetIntegerValue("UBR")
if err != nil {
if errors.Is(err, registry.ErrNotExist) {
revision = 0
} else if err != nil {
return nil, err
}