import { LogRecord } from '@voltro/logger'; import { MetricSample } from '@voltro/runtime'; import { VoltroPlugin } from '@voltro/protocol'; export declare interface DatadogLog { readonly message: string; readonly status: string; readonly ddsource: string; readonly [attribute: string]: unknown; } export declare interface DatadogPayload { readonly series: ReadonlyArray; } export declare const datadogPlugin: (options?: DatadogPluginOptions) => VoltroPlugin; export declare interface DatadogPluginOptions { /** Datadog API key. Default `DD_API_KEY` env. Needed for metrics + logs * (agentless). Traces use the Agent and don't need it. */ readonly apiKey?: string; /** Datadog site host. Default `DD_SITE` env, else `datadoghq.com` (US1). */ readonly site?: string; /** Metrics push interval in ms. Default 30000. */ readonly intervalMs?: number; /** Prepended to every metric name (e.g. `voltro.`). */ readonly prefix?: string; /** Tags added to every series + log (`["env:prod", "service:api"]`). */ readonly tags?: ReadonlyArray; /** Per-replica identity, emitted as the Datadog v2 * `resources: [{ type: 'host', name }]` field on every pushed series. * Default `os.hostname()`. Without a per-replica value, N replicas * submitting the same metric+tags merge into ONE Datadog series and the * cumulative per-process counters interleave — `.as_count()`/`diff()` * rates go silently wrong. */ readonly host?: string; /** Forward the framework log sink to Datadog logs intake. Default false. */ readonly logs?: boolean; /** Logs flush interval in ms. Default 5000. */ readonly logsIntervalMs?: number; /** Route the framework's OTel spans to the Datadog Agent's OTLP receiver. * Default false. */ readonly traces?: boolean; /** Datadog Agent OTLP base url (`/v1/traces` is appended). Default * `DD_TRACE_AGENT_URL` env, else `http://localhost:4318`. */ readonly agentUrl?: string; /** Continuous profiler via dd-trace (profiler-only mode). Default false. */ readonly profiling?: boolean; /** `service` resource/tag (DD unified service tagging). Default `DD_SERVICE` env. */ readonly service?: string; /** `env` resource/tag. Default `DD_ENV` env. */ readonly env?: string; /** `version` resource/tag. Default `DD_VERSION` env. */ readonly version?: string; /** Disambiguates multiple instances. */ readonly name?: string; } export declare interface DatadogPoint { readonly timestamp: number; readonly value: number; } /** Datadog v2 series resource — `{ type: 'host', name }` carries the * per-replica identity Datadog uses to keep same-name+tags series apart. */ export declare interface DatadogResource { readonly type: string; readonly name: string; } export declare interface DatadogSeries { readonly metric: string; readonly type: 0 | 1 | 2 | 3; readonly points: ReadonlyArray; readonly tags?: ReadonlyArray; readonly resources?: ReadonlyArray; } export declare const toDatadogLog: (r: LogRecord, opts?: ToLogsOptions) => DatadogLog; export declare const toDatadogLogs: (records: ReadonlyArray, opts?: ToLogsOptions) => ReadonlyArray; export declare const toDatadogSeries: (samples: ReadonlyArray, opts: ToSeriesOptions) => DatadogPayload; declare interface ToLogsOptions { readonly service?: string; /** Comma-joined into `ddtags`. */ readonly tags?: ReadonlyArray; readonly hostname?: string; } declare interface ToSeriesOptions { /** Unix SECONDS for every point in this batch. */ readonly timestamp: number; /** Prepended to every metric name (e.g. `voltro.`). Default none. */ readonly prefix?: string; /** Tags added to every series. */ readonly globalTags?: ReadonlyArray; /** Per-replica identity, emitted as the v2 `resources: [{ type: 'host', name }]` * field on EVERY series. Without it, N replicas submitting the same * metric+tags merge into ONE Datadog series and the cumulative per-process * counters interleave into a meaningless sawtooth. */ readonly host?: string; } export { }