mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-18 02:29:04 +02:00
fix: strict flag values, MI NULL properties and container without HCS (#2553)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b6d75ffb71
commit
f8ada403f2
@@ -274,7 +274,10 @@ func (c *Collection) Build(ctx context.Context, logger *slog.Logger) error {
|
||||
|
||||
err := fmt.Errorf("error build collector %s: %w", result.name, result.err)
|
||||
|
||||
if errors.Is(err, pdh.ErrNoData) ||
|
||||
// errors.ErrUnsupported marks a collector whose subsystem is not
|
||||
// available on this host, e.g. a Windows feature that is not installed.
|
||||
if errors.Is(err, errors.ErrUnsupported) ||
|
||||
errors.Is(err, pdh.ErrNoData) ||
|
||||
errors.Is(err, winregistry.ErrNotExist) ||
|
||||
errors.Is(err, pdh.NewPdhError(pdh.CstatusNoObject)) ||
|
||||
errors.Is(err, pdh.NewPdhError(pdh.CstatusNoCounter)) ||
|
||||
|
||||
@@ -19,6 +19,7 @@ package collector_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -69,6 +70,7 @@ func TestCollectionBuildAndClose(t *testing.T) {
|
||||
{name: "success"},
|
||||
{name: "build failure", buildErr: buildFailure, wantBuildErr: buildFailure},
|
||||
{name: "optional counter missing", buildErr: pdh.ErrNoData},
|
||||
{name: "unsupported on this host", buildErr: fmt.Errorf("feature missing: %w", errors.ErrUnsupported)},
|
||||
{name: "close failure", closeErr: closeFailure},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user