doctor

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package doctor runs cheap live health checks against every ketch surface: search/code/docs backends, the configured browser, and the page cache. Probes are read-only — they never write cache entries or mutate config — and each is bounded by a per-probe timeout so a full run stays fast.

Index

Constants

View Source
const DefaultTimeout = 3 * time.Second

DefaultTimeout is the per-probe timeout. Probes run concurrently, so the whole run is bounded by roughly one timeout, not the sum.

View Source
const SelfHostedSearchTimeout = 10 * time.Second

SelfHostedSearchTimeout is the budget for probes that make the instance run a real federated search rather than answer a single API call. SearXNG spends about three seconds on its own upstream engines, landing right on DefaultTimeout, so the default budget reports healthy instances as timed out.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Surface   string `json:"surface"`
	Backend   string `json:"backend"`
	Status    Status `json:"status"`
	Detail    string `json:"detail,omitempty"`
	LatencyMS int64  `json:"latency_ms"`

	// Required marks checks that gate the process exit code: the default
	// backend of each surface, backends with an API key explicitly configured,
	// the configured browser, and the cache. Not part of the JSON schema.
	Required bool `json:"-"`
}

Check is one line of the doctor report. The JSON schema is stable: {surface, backend, status, detail, latency_ms}.

func Run

func Run(ctx context.Context, cfg *config.Config, timeout time.Duration) []Check

Run executes every check concurrently, each bounded by timeout (DefaultTimeout if <= 0), and returns results in stable surface order.

func (Check) Bad

func (c Check) Bad() bool

Bad reports whether the check found a problem (anything but ok/skipped).

type Status

type Status string

Status classifies the outcome of a single doctor check.

const (
	// StatusOK means the check passed: configured, reachable, credentials accepted.
	StatusOK Status = "ok"
	// StatusNoKey means the backend needs a key/token and none is configured.
	StatusNoKey Status = "no_key"
	// StatusUnreachable means the endpoint did not answer (network error,
	// timeout, or a server-side failure status).
	StatusUnreachable Status = "unreachable"
	// StatusMisconfigured means the endpoint answered but rejected the setup
	// (invalid key, SearXNG JSON format blocked, missing browser binary, ...).
	// Detail carries the fix hint.
	StatusMisconfigured Status = "misconfigured"
	// StatusSkipped means the check does not apply (e.g. no browser configured).
	StatusSkipped Status = "skipped"
)

Jump to

Keyboard shortcuts

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