doctor

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const HostLoadProbeID = "runtime.load"
View Source
const RuntimeMemoryProbeID = "runtime.memory"
View Source
const SessionMetadataProbeID = "runtime.session_metadata"
View Source
const (
	SubprocessHealthProbeID = "runtime.subprocess_health"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeadEntityProbe

type DeadEntityProbe struct {
	Source     DeadEntitySource
	Workspaces DeadEntityWorkspaceSource
	Kind       store.DeadEntityKind
}

DeadEntityProbe projects one runtime family without mutating its recovery state.

func (*DeadEntityProbe) Category

func (p *DeadEntityProbe) Category() string

func (*DeadEntityProbe) ID

func (p *DeadEntityProbe) ID() string

func (*DeadEntityProbe) Run

type DeadEntitySource

type DeadEntitySource interface {
	List(ctx context.Context, workspaceID string) ([]store.DeadEntity, error)
}

DeadEntitySource is the read-only durable reliability surface required by doctor.

type DeadEntityWorkspaceSource

type DeadEntityWorkspaceSource interface {
	List(context.Context) ([]workspacepkg.Workspace, error)
}

DeadEntityWorkspaceSource lists the workspace authorities doctor must inspect.

type HostLoadProbe

type HostLoadProbe struct {
	Source HostLoadSnapshotSource
}

HostLoadProbe projects load-aware admission state into doctor diagnostics.

func (*HostLoadProbe) Category

func (*HostLoadProbe) Category() string

func (*HostLoadProbe) ID

func (*HostLoadProbe) ID() string

func (*HostLoadProbe) Run

type HostLoadSnapshotSource

type HostLoadSnapshotSource interface {
	Snapshot() admission.LoadSnapshot
}

HostLoadSnapshotSource returns the daemon's latest host CPU pressure observation.

type Probe

type Probe interface {
	ID() string
	Category() string
	Run(context.Context, *ProbeEnv) ([]contract.DiagnosticItem, error)
}

Probe executes one doctor diagnostic check. Implementations should return when the context is canceled so the runner can reclaim their goroutine; the per-probe deadline is enforced either way.

type ProbeEnv

type ProbeEnv struct {
	Timeout time.Duration
	Now     func() time.Time
}

ProbeEnv carries shared probe dependencies.

type ProbeFunc

type ProbeFunc struct {
	ProbeID       string
	ProbeCategory string
	RunFunc       func(context.Context, *ProbeEnv) ([]contract.DiagnosticItem, error)
}

ProbeFunc adapts a function into a Probe for extensions and tests.

func (*ProbeFunc) Category

func (p *ProbeFunc) Category() string

func (*ProbeFunc) ID

func (p *ProbeFunc) ID() string

func (*ProbeFunc) Run

type Registry

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

Registry stores doctor probes and returns them sorted by ID.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty probe registry.

func (*Registry) Probes

func (r *Registry) Probes() []Probe

Probes returns registered probes sorted by ID.

func (*Registry) Register

func (r *Registry) Register(probe Probe) error

Register adds one probe after validating its deterministic identity.

type RunOptions

type RunOptions struct {
	Only         []string
	Exclude      []string
	Quiet        bool
	Timeout      time.Duration
	ProbeTimeout time.Duration
	Env          ProbeEnv
}

RunOptions controls doctor execution.

type Runner

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

Runner executes registered probes in deterministic order.

func NewRunner

func NewRunner(registry *Registry) *Runner

NewRunner creates a deterministic doctor runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, opts RunOptions) ([]contract.DiagnosticItem, error)

Run executes every selected probe and sanitizes every returned DiagnosticItem.

type RuntimeMemoryProbe

type RuntimeMemoryProbe struct {
	Source RuntimeMemorySnapshotSource
}

RuntimeMemoryProbe projects daemon-owned process memory into doctor diagnostics.

func (*RuntimeMemoryProbe) Category

func (*RuntimeMemoryProbe) Category() string

func (*RuntimeMemoryProbe) ID

func (*RuntimeMemoryProbe) ID() string

func (*RuntimeMemoryProbe) Run

type RuntimeMemorySnapshot

type RuntimeMemorySnapshot struct {
	Enabled                 bool
	Active                  bool
	CapturedAt              time.Time
	Phase                   string
	ResidentMemoryBytes     uint64
	ResidentMemoryKind      string
	ResidentMemoryAvailable bool
	HeapAllocBytes          uint64
	HeapInUseBytes          uint64
	Goroutines              int
	UptimeSeconds           int64
}

RuntimeMemorySnapshot is one immutable daemon process-memory observation.

type RuntimeMemorySnapshotSource

type RuntimeMemorySnapshotSource interface {
	RuntimeMemorySnapshot() RuntimeMemorySnapshot
}

RuntimeMemorySnapshotSource returns the daemon's latest process-memory observation.

type SessionMetadataHealthSource

type SessionMetadataHealthSource interface {
	SessionMetadataHealth(context.Context) (int, loggerpkg.FailureSummary, error)
}

type SessionMetadataProbe

type SessionMetadataProbe struct {
	Source SessionMetadataHealthSource
}

func (*SessionMetadataProbe) Category

func (*SessionMetadataProbe) Category() string

func (*SessionMetadataProbe) ID

func (*SessionMetadataProbe) Run

type SubprocessHealthProbe

type SubprocessHealthProbe struct {
	Source SubprocessHealthSnapshotSource
}

SubprocessHealthProbe projects failed active-process health verdicts into doctor diagnostics.

func (*SubprocessHealthProbe) Category

func (*SubprocessHealthProbe) Category() string

func (*SubprocessHealthProbe) ID

func (*SubprocessHealthProbe) Run

type SubprocessHealthSnapshotSource

type SubprocessHealthSnapshotSource interface {
	SubprocessHealthSnapshots() []session.SubprocessHealthSnapshot
}

SubprocessHealthSnapshotSource returns immutable active-process health observations.

Jump to

Keyboard shortcuts

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