/** * Time-bucketed aggregation for log10x_backfill_metric. * * Takes a list of events (from the Retriever) and produces a time-series * of `(timestamp, labels, value)` points suitable for emission to a TSDB. * * Aggregation types: * count — number of events in the bucket * sum_bytes — total byte size of events in the bucket * unique_values — cardinality of a named dimension in the bucket * rate_per_second — events per second (count / bucket_seconds) * * Grouping dimensions come from the Retriever event's `enrichedFields` * (severity, service, tenant_id, http_code, ...). If the caller passes a * group_by that is not present on any event, the aggregator treats the * dimension as an empty string so the caller still gets a single series * rather than a silent drop. */ import type { RetrieverEvent } from './retriever-api.js'; export type AggregationType = 'count' | 'sum_bytes' | 'unique_values' | 'rate_per_second'; export interface AggregatorOptions { bucketSize: string; aggregation: AggregationType; /** Fields to group on — each combination becomes its own time series. */ groupBy?: string[]; /** For unique_values aggregation: the field whose cardinality is counted per bucket. */ uniqueField?: string; } export interface MetricPoint { /** UNIX seconds since epoch. */ timestamp: number; /** Labels identifying the time series. */ labels: Record; value: number; } export interface AggregatedSeries { points: MetricPoint[]; seriesCount: number; bucketSeconds: number; eventCount: number; } export declare function aggregate(events: RetrieverEvent[], options: AggregatorOptions): AggregatedSeries; /** Parse `5m` / `1h` / `1d` into seconds. */ export declare function parseBucketSize(s: string): number;