import { type CollectorMetricsSummary, type CollectorPaths } from './collector.js'; export type CollectorMode = 'docker' | 'binary'; /** Smallest --max-size-mib otelcol-contrib 0.160.0 accepts with the config's compaction settings. */ export declare const MIN_MAX_SIZE_MIB = 100; export declare const collectorSizingFlags: { 'export-url': import("@oclif/core/interfaces").OptionFlag; 'data-dir': import("@oclif/core/interfaces").OptionFlag; 'max-size-mib': import("@oclif/core/interfaces").OptionFlag; 'queue-size': import("@oclif/core/interfaces").OptionFlag; port: import("@oclif/core/interfaces").OptionFlag; }; export declare const collectorModeFlags: { docker: import("@oclif/core/interfaces").BooleanFlag; binary: import("@oclif/core/interfaces").BooleanFlag; }; /** * Ingest URL for the collector: --export-url / RESPAN_COLLECTOR_EXPORT_URL, * else derived from the resolved auth base URL. Falls back to the configured * base URL (flag / RESPAN_API_BASE_URL / SaaS default) when not logged in, so * `collector config --print` works without credentials. */ export declare function resolveExportUrl(flags: { 'export-url'?: string; 'api-key'?: string; 'base-url'?: string; profile?: string; }): string; export interface CommandResult { status: number | null; stdout: string; stderr: string; } /** Run `docker ` to completion. Never rejects; a missing binary is a failed result. */ export declare function runDocker(args: string[], env?: NodeJS.ProcessEnv): Promise; /** True when the Docker CLI is installed and can reach a daemon. */ export declare function dockerAvailable(): boolean; export interface ContainerState { exists: boolean; running: boolean; /** created | running | paused | restarting | removing | exited | dead */ status?: string; startedAt?: string; restartCount?: number; image?: string; } export declare function dockerContainerState(name?: string): ContainerState; export declare function dockerVolumeExists(name?: string): boolean; export declare function readPid(pidPath: string): number | undefined; export declare function isPidAlive(pid: number): boolean; export interface RunningCollector { mode: CollectorMode; pid?: number; container?: ContainerState; } /** * What this CLI started, if anything: the container (in any state — an exited * container still owns the name) or a live pid from the pid file. A stale pid * file is removed. `mode` restricts the check to one runtime. */ export declare function detectRunning(paths: CollectorPaths, mode?: CollectorMode): RunningCollector | undefined; export declare function spawnCollectorBinary(paths: CollectorPaths, env: NodeJS.ProcessEnv): number; export declare function sleep(ms: number): Promise; /** SIGTERM, wait for exit, SIGKILL as a last resort. */ export declare function stopPid(pid: number, timeoutMs?: number): Promise<'stopped' | 'killed' | 'not-running'>; export declare function tailFile(filePath: string, lines: number): string; export declare function directorySize(dir: string): number; export declare function healthUrl(port?: number): string; export declare function metricsUrl(port?: number): string; export interface HealthStatus { healthy: boolean; /** health_check body status, e.g. "Server available", or "HTTP 503". */ status?: string; uptime?: string; upSince?: string; error?: string; } /** GET the health_check extension (200 once the pipeline is ready). */ export declare function checkHealth(port?: number): Promise; /** Poll health until it passes, the timeout elapses, or `isAlive` reports the process gone. */ export declare function waitForHealth(port: number, timeoutMs: number, isAlive?: () => boolean): Promise; export declare function fetchMetrics(port?: number): Promise; export declare function downloadFile(url: string, dest: string): Promise; export declare function sha256File(filePath: string): Promise; export interface CollectorLogger { log(message: string): void; warn(message: string): void; } /** * Make sure ~/.respan/collector/bin/otelcol-contrib exists: download the * release tarball, verify its SHA-256 against the published `.sha256` asset * (warn when that cannot be fetched), extract the binary and drop the tarball. */ export declare function ensureCollectorBinary(paths: CollectorPaths, logger: CollectorLogger): Promise;