import { TokenTracker } from "./tokenTracker.js";
import type { LatencyStats, MetricsAggregatorConfig, MetricsSummary, ModelCostStats, ProviderCostStats, SpanData, TimeWindowStats, TokenUsageStats, TraceView } from "../types/index.js";
/**
 * Metrics Aggregator for comprehensive telemetry analysis
 * Provides latency percentiles, token aggregation, and cost tracking
 */
export declare class MetricsAggregator {
    private spans;
    private latencyValues;
    private tokenTracker;
    private timeWindows;
    private config;
    private spansByType;
    private costByProvider;
    private costByModel;
    private successCount;
    private failureCount;
    private firstSpanTime?;
    private lastSpanTime?;
    constructor(config?: MetricsAggregatorConfig);
    /**
     * Record a span for metrics aggregation
     */
    recordSpan(span: SpanData): void;
    /**
     * Track cost aggregations from a span
     */
    private trackCosts;
    /**
     * Update time window statistics
     */
    private updateTimeWindow;
    /**
     * Create an empty time window
     */
    private createEmptyTimeWindow;
    /**
     * Create empty latency stats
     */
    private createEmptyLatencyStats;
    /**
     * Calculate latency percentile from sorted array
     */
    private calculatePercentile;
    /**
     * Calculate standard deviation
     */
    private calculateStdDev;
    /**
     * Get comprehensive latency statistics
     */
    getLatencyStats(): LatencyStats;
    /**
     * Get token usage statistics
     */
    getTokenStats(): TokenUsageStats;
    /**
     * Get cost breakdown by provider
     */
    getCostByProvider(): ProviderCostStats[];
    /**
     * Get cost breakdown by model
     */
    getCostByModel(): ModelCostStats[];
    /**
     * Get total cost across all providers
     */
    getTotalCost(): number;
    /**
     * Get time window statistics
     */
    getTimeWindows(): TimeWindowStats[];
    /**
     * Get statistics for a specific time range
     */
    getStatsForTimeRange(startTime: Date, endTime: Date): TimeWindowStats;
    /**
     * Record a latency measurement for an operation
     * Use this for standalone latency tracking without a full span
     */
    recordLatency(operation: string, latencyMs: number): void;
    /**
     * Get comprehensive metrics summary (alias for getSummary)
     */
    getMetrics(): MetricsSummary;
    /**
     * Get comprehensive metrics summary
     */
    getSummary(): MetricsSummary;
    /**
     * Get all recorded spans (returns a copy)
     */
    getSpans(): SpanData[];
    /**
     * Get spans grouped by traceId as hierarchical trace views
     */
    getTraces(): TraceView[];
    /**
     * Get the underlying token tracker for custom pricing configuration
     */
    getTokenTracker(): TokenTracker;
    /**
     * Reset all metrics
     */
    reset(): void;
    /**
     * Export metrics as JSON
     */
    toJSON(): Record<string, unknown>;
    /**
     * Format cost as currency string
     */
    formatCost(cost: number, currency?: string): string;
    /**
     * Get a formatted summary string
     */
    getFormattedSummary(): string;
}
/**
 * Get the global metrics aggregator instance
 */
export declare function getMetricsAggregator(): MetricsAggregator;
/**
 * Reset the global metrics aggregator (for testing)
 */
export declare function resetMetricsAggregator(): void;
