health

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package health implements the read-only environment "doctor" probe layer.

It runs a set of independent, non-destructive probes (peermem loaded? IOMMU=pt? ACS off? RDMA port active? etc.) and aggregates their results. This is the data layer only: probes report status, they never decide exit codes and never mutate any system state. The gpu-tools doctor command lives in a separate package and consumes DefaultProbes, Run, and Report.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Probe

type Probe interface {
	Name() string
	Run(ctx context.Context) Result
}

Probe is a single independent, non-destructive environment check.

func DefaultProbes

func DefaultProbes(runner execRunner) []Probe

DefaultProbes returns the standard six probes wired to runner. A nil runner falls back to the production os/exec runner.

type Report

type Report struct {
	Results []Result
	Overall Status
}

Report aggregates the results of a probe run.

func Run

func Run(ctx context.Context, probes []Probe) Report

Run executes every probe and collects all results. Each probe is independent: a failure or skip in one never prevents the others from running. Probes must never panic.

type Result

type Result struct {
	Name   string
	Status Status
	Detail string
	Hint   string
}

Result is the outcome of one probe.

type Status

type Status string

Status is the outcome of a single probe (or the aggregated report).

const (
	// StatusOK means the probe found the expected healthy configuration.
	StatusOK Status = "ok"
	// StatusWarn means the probe found a non-fatal problem worth attention.
	StatusWarn Status = "warn"
	// StatusFail means the probe found a fatal problem.
	StatusFail Status = "fail"
	// StatusSkip means the probe could not run (missing dependency / permission).
	StatusSkip Status = "skip"
)

func Aggregate

func Aggregate(results []Result) Status

Aggregate reduces a set of results to a single overall status.

Precedence: any fail -> fail; else any warn -> warn; else ok. skip is ignored, so an all-skip set (or an empty set) aggregates to ok.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL