/** * WorkflowMetricsCollector - Metrics collection for workflow execution * * Features: * - Counters for executions, successes, failures * - Histograms for latency distribution * - Gauges for active workflows, queue depth * - Per-node and per-workflow metrics * - Token and cost tracking * - Prometheus-compatible output */ import type { MetricsConfig, WorkflowMetrics } from '@cogitator-ai/types'; /** * WorkflowMetricsCollector - Main metrics collection class */ export declare class WorkflowMetricsCollector { private config; private counters; private gauges; private histograms; private latencySamples; private nodeMetrics; private tokenUsage; private costTracking; private lastUpdated; constructor(config?: Partial); /** * Get prefixed metric name */ private metricName; recordWorkflowStart(workflowName: string, labels?: Record): void; recordWorkflowComplete(workflowName: string, durationMs: number, status: 'success' | 'failure' | 'cancelled', labels?: Record): void; recordNodeExecution(workflowName: string, nodeName: string, nodeType: string, durationMs: number, success: boolean, retries?: number): void; recordTokenUsage(workflowName: string, inputTokens: number, outputTokens: number): void; recordCost(workflowName: string, cost: number): void; /** * Get workflow metrics summary */ getWorkflowMetrics(workflowName: string): WorkflowMetrics | null; /** * Increment counter */ private incrementCounter; /** * Set gauge value */ private setGauge; /** * Increment gauge */ private incrementGauge; /** * Decrement gauge */ private decrementGauge; /** * Record histogram value */ private recordHistogram; /** * Record latency sample for percentile calculations */ private recordLatencySample; /** * Get appropriate buckets for a metric */ private getBucketsForMetric; /** * Build labeled key for maps */ private labeledKey; /** * Export metrics in Prometheus text format */ toPrometheusFormat(): string; private formatPrometheusLabels; private parseLabels; /** * Reset all metrics */ reset(): void; /** * Get all workflow names with metrics */ getWorkflowNames(): string[]; } /** * Create a metrics collector instance */ export declare function createMetricsCollector(config?: Partial): WorkflowMetricsCollector; export declare function getGlobalMetrics(): WorkflowMetricsCollector; export declare function setGlobalMetrics(metrics: WorkflowMetricsCollector): void; //# sourceMappingURL=metrics.d.ts.map