import type { PlatformObservability } from '@cat-factory/contracts'; import type { Logger, OperationalCounterSample, OperationalGaugeSample } from '@cat-factory/kernel'; export interface PlatformMetricsOtelExporterConfig { /** OTLP/HTTP base URL, e.g. `http://collector:4318` (`/v1/metrics` is appended). */ endpoint: string; /** Extra headers merged onto every request (auth tokens, tenant ids, …). */ headers?: Record; /** OTLP resource `service.name`; defaults to `cat-factory`. */ serviceName?: string; /** Optional logger for swallowed errors. */ logger?: Logger; /** Injectable fetch (tests); defaults to the global `fetch`. */ fetchImpl?: typeof fetch; } export declare class PlatformMetricsOtelExporter { private readonly metricsEndpoint; private readonly headers; private readonly serviceName; private readonly logger?; private readonly fetchImpl; constructor(config: PlatformMetricsOtelExporterConfig); private resourceAttributes; /** * Export one account's platform-observability snapshot as OTLP gauge metrics. Gauges are * stamped with the snapshot's `generatedAt` (the clock the projection was computed at), so * no wall-clock read is needed here. In practice a snapshot always yields the run-count and * live-depth gauges (even all-zero — a zero-valued gauge is meaningful, not misleading), so * a POST is always sent; the empty-batch guard below is defensive only, in case the mapping * ever becomes fully conditional. Best-effort — see the file header. */ export(snapshot: PlatformObservability, dims: { accountId: string; }): Promise; /** * Export the deployment's OPERATIONAL signals: drained counter deltas plus point-in-time * gauge readings. Deployment-scoped, NOT per account — an eviction or a dropped telemetry * batch belongs to the deployment, and stamping a tenant on it would invent an attribution * the event does not have. * * `at` is the flush clock (the caller's, so this stays free of a wall-clock read like * `export` above). Sends nothing when both lists are empty: an unflushed zero and a genuine * zero are different facts, and only the ABSENCE of a point states the first one honestly. * Best-effort — see the file header. */ exportOperational(counters: OperationalCounterSample[], gauges: OperationalGaugeSample[], at: number): Promise; private post; } /** Build a fetch-based {@link PlatformMetricsOtelExporter}. The workerd-safe opt-in exporter. */ export declare function createPlatformMetricsOtelExporter(config: PlatformMetricsOtelExporterConfig): PlatformMetricsOtelExporter; //# sourceMappingURL=platform.d.ts.map