/** * log10x_savings — pipeline savings summary. * * Ported from the Grafana ROI analytics dashboard's canonical formula: * edgeSavings = (inputBytes - emittedBytes) × analyzerCost * retrieverSavings = indexedBytes × (analyzerCost - storageCost) * - streamedBytes × analyzerCost * totalSavings = max(0, edgeSavings) + max(0, retrieverSavings) * * The earlier version of this file used all_events_summaryBytes_total as the * output metric for every stage, which over-counted by a wide margin because * emitted/indexed/streamed are tracked on separate metrics. * * Retriever indexed metric has high per-series cardinality (~12k active series * per env because of the index_file label). A single `sum(increase(...[7d]))` * query blows the Prometheus server's query resource budget and returns 503. * The workaround is to chunk the window into N × 1d queries in parallel and * sum the results client-side — each 1d increase is cheap enough for the * server to complete, and the total is mathematically equivalent so long as * each chunk is computed per-series before summing (which preserves counter * reset handling). */ import { z } from 'zod'; import type { EnvConfig } from '../lib/environments.js'; import { type StructuredOutput } from '../lib/output-types.js'; /** Origin of the analyzer $/GB used in this run. Drives dollar-gating in headlines + markdown. */ export type RateSource = 'list_price' | 'customer_supplied' | 'unset'; export declare const savingsSchema: { timeRange: z.ZodDefault>; analyzerCost: z.ZodOptional; effective_ingest_per_gb: z.ZodOptional; storageCost: z.ZodOptional; siem_lens: z.ZodOptional>; environment: z.ZodOptional; view: z.ZodOptional>>; }; export declare function executeSavings(args: { timeRange?: string; analyzerCost?: number; effective_ingest_per_gb?: number; storageCost?: number; siem_lens?: string; view?: 'summary'; }, env: EnvConfig): Promise;