doctor

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterestingLogLines

func InterestingLogLines(lines []string, max int) []string

InterestingLogLines scans newest-to-oldest for error-like lines and returns up to max matches in original chronological order.

Types

type Context

type Context struct {
	Project *discover.Project
	Config  *compose.Config // MAY BE NIL
	Inspect func(containerID string) (*docker.InspectInfo, error)
	Logs    func(containerID string, tail int) ([]string, error)
	Now     time.Time
}

Context provides the static and runtime inputs used by doctor rules.

type Finding

type Finding struct {
	RuleID, Service, Title, Detail string
	Severity                       Severity
	Evidence, Suggestion           []string
}

Finding is one actionable diagnosis from a doctor rule.

func Run

func Run(ctx Context, rules []Rule) []Finding

Run executes rules and returns findings in deterministic priority order.

type RootCause

type RootCause struct {
	Culprits     []string
	Chains       map[string][]string // blocked -> path to culprit
	CriticalPath []string
	FirstLog     map[string]string
}

RootCause summarizes the likely service(s) causing startup blockage.

func FindRootCause

func FindRootCause(ctx Context) *RootCause

FindRootCause traces blocked services back to failed, unhealthy, or restart-looping dependency endpoints. It returns nil when the graph has no blocked or broken services to explain.

type Rule

type Rule interface {
	ID() string
	Check(ctx Context) []Finding
}

Rule checks the doctor context and returns zero or more findings.

func DefaultRules

func DefaultRules() []Rule

DefaultRules returns the built-in Phase 2 doctor rule set.

type Severity

type Severity int

Severity is the urgency level of a doctor finding.

const (
	SeverityInfo Severity = iota
	SeverityWarn
	SeverityCritical
)

Finding severity levels, ordered from least to most urgent.

Jump to

Keyboard shortcuts

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