/** * Provider-layer telemetry. * * Records every fetcher call so the Panel Markets page can show live health * ("• CoinGecko OK", "• BlockRun OK"), today's call count, today's spend, * and a p50 latency estimate. Entirely in-memory — dies with the process * and re-hydrates from the on-disk wallet/stats files if we ever care to * persist (we don't yet). * * Tiny by design: zero deps, no background timers, no DB. Callers push a * single record per fetch; the Panel pulls a snapshot on demand. */ type ProviderName = 'coingecko' | 'blockrun'; interface FetchRecord { provider: ProviderName; endpoint: string; ok: boolean; latencyMs: number; costUsd?: number; ts: number; } interface PaidCallRow { endpoint: string; costUsd: number; ts: number; } export declare function recordFetch(evt: Omit): void; export interface ProviderSnapshot { name: ProviderName; calls: number; ok: number; failures: number; p50LatencyMs: number | null; lastOkAt: number | null; lastErrorAt: number | null; spendUsdToday: number; status: 'ok' | 'degraded' | 'cold'; } export interface TelemetrySnapshot { providers: ProviderSnapshot[]; totals: { callsToday: number; spendUsdToday: number; p50LatencyMs: number | null; }; recentPaidCalls: PaidCallRow[]; } export declare function snapshot(): TelemetrySnapshot; /** * Real BlockRun spend recorded so far today (USD). `recordFetch` only adds to * this on an actual paid fetch — a short-TTL cache hit records nothing — so a * caller can measure the true cost of a single paid call by diffing this around * the call (delta 0 on a cache hit, $0.001 on a fresh stock-price fetch). */ export declare function blockrunSpendUsdToday(): number; /** Test helper: reset all counters. Do not call in production code paths. */ export declare function resetTelemetry(): void; export {};