doctor

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SectionSystem     = "system"
	SectionConfig     = "config"
	SectionEnv        = "env"
	SectionVDB        = "vdb"
	SectionLLM        = "llm"
	SectionEmbeddings = "embeddings"
	SectionStack      = "stack"
	SectionOpik       = "opik"
)

SectionName constants used as keys across the codebase.

Variables

This section is empty.

Functions

func HasFailures

func HasFailures(results []CheckResult) bool

HasFailures returns true if any result is StatusFail.

func PrintJSON

func PrintJSON(results []CheckResult) error

PrintJSON outputs results as a JSON object to stdout.

func PrintResults

func PrintResults(results []CheckResult, verbose bool)

PrintResults renders all check results to the terminal, grouped by section. When verbose is false only non-OK results and section headers with issues are shown.

Types

type CheckResult

type CheckResult struct {
	Section string `json:"section"`           // e.g. "config", "vdb", "llm"
	Name    string `json:"name"`              // e.g. "Config file", "milvus-local connectivity"
	Status  Status `json:"status"`            // OK, WARN, FAIL, SKIP
	Message string `json:"message"`           // Human-readable detail
	Fix     string `json:"fix,omitempty"`     // Suggested remediation command or action
	Latency string `json:"latency,omitempty"` // Optional latency measurement
}

CheckResult holds the outcome of a single diagnostic check.

func CheckConfig

func CheckConfig(cfg *config.Config, loadErr error) []CheckResult

CheckConfig verifies that the config file exists, is parseable, and validates cleanly. cfg may be nil if loading failed; the caller should pass the error in loadErr.

func CheckEmbeddings

func CheckEmbeddings(cfg *config.Config) []CheckResult

CheckEmbeddings validates that configured embedding models are in the registry and that their dimensions match the VDB configuration.

func CheckEnv

func CheckEnv(cfg *config.Config) []CheckResult

CheckEnv audits environment variables required by the current configuration.

func CheckLLM

func CheckLLM(ctx context.Context) []CheckResult

CheckLLM validates the OpenAI API key and tests a small embedding call.

func CheckOpik

func CheckOpik(ctx context.Context) []CheckResult

CheckOpik tests connectivity to the Opik workspace if OPIK_API_KEY is set.

func CheckStack

func CheckStack() []CheckResult

CheckStack verifies the weave stack status: cluster info, pod status, and VDB reachability.

func CheckSystem

func CheckSystem() []CheckResult

CheckSystem verifies CLI version, Go version, OS/arch, and external dependencies.

func CheckVDB

func CheckVDB(ctx context.Context, cfg *config.Config) []CheckResult

CheckVDB runs Health() on each configured VDB and reports connectivity, latency, and collection count.

type Doctor

type Doctor struct {
	// contains filtered or unexported fields
}

Doctor orchestrates all diagnostic checks.

func New

func New(cfg *config.Config, loadErr error, dcfg DoctorConfig) *Doctor

New creates a Doctor instance. cfg may be nil when config loading itself failed; pass loadErr for that case.

func (*Doctor) RunAll

func (d *Doctor) RunAll(ctx context.Context) []CheckResult

RunAll executes all enabled sections in order and returns the aggregated results.

type DoctorConfig

type DoctorConfig struct {
	Fix     bool   // Attempt to auto-fix fixable issues
	Section string // Run only this section ("" = all)
	JSON    bool   // Machine-readable JSON output
	Verbose bool   // Show passing checks too
}

DoctorConfig controls which sections to run and output behaviour.

type Status

type Status int

Status represents the outcome of a single diagnostic check.

const (
	StatusOK   Status = iota // Check passed
	StatusWarn               // Non-critical issue detected
	StatusFail               // Critical issue detected
	StatusSkip               // Check was skipped (precondition not met)
)

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON encodes the status as a JSON string (e.g. "OK", "FAIL").

func (Status) String

func (s Status) String() string

String returns a human-readable label for the status.

Jump to

Keyboard shortcuts

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