/** * Backend validator — shared by `log10x_configure_env` (validate * before persisting) and `log10x_doctor` (validate periodically). * * Probes the metrics backend in four steps, surfacing the first * failure with a clear, actionable diagnostic. The four checks are: * * 1. **Reachable** — TCP connect + HTTP request returns any * response. Fails on DNS, connection refused, TLS handshake * failure, timeout. * 2. **Authenticated** — `up` query returns 200 + `status:success`. * Fails on 401/403 (bad auth), 429 (rate limit), 5xx (backend * down). Distinguishes "wrong creds" from "wrong URL". * 3. **Engine metrics present** — `count(all_events_summaryBytes_total)` * returns a non-empty / non-zero result. Catches the * read/write URL mismatch: backend is reachable but the 10x * engine isn't writing to it. * 4. **Expected labels present** — the metric carries the labels * the env's `labels` map expects (default: `message_pattern`, * `tenx_user_service`, `severity_level`, `tenx_env`). Catches * the rename mismatch — engine renamed labels but the env's * `labels` override wasn't updated to match. * * Returns a structured result; never throws. Callers render it as * markdown. */ import type { MetricsBackend } from './metrics-backend.js'; import type { LabelNameMap } from './promql.js'; export type CheckStatus = 'pass' | 'fail'; export interface CheckResult { name: string; status: CheckStatus; detail: string; /** Optional remediation hint shown when status is `fail`. */ hint?: string; } export interface ValidationResult { /** True iff every check passed. */ ok: boolean; /** Ordered list of check results — first failure aborts the chain. */ checks: CheckResult[]; } /** * Run the four-step probe against a backend. Stops on the first * failure so the user sees the FIRST problem to fix (not a noisy * cascade). */ export declare function validateBackend(backend: MetricsBackend, labels: LabelNameMap): Promise; /** * Render a ValidationResult as markdown for tool output. Used by both * configure_env (when validation fails) and doctor (in the per-env * status section). */ export declare function renderValidationResult(result: ValidationResult, env: { nickname: string; metricsBackend: MetricsBackend; }): string;