import { IWorkflowPlugin, WorkflowContext } from '../types'; export interface StateMetrics { totalExecutions: number; successfulExecutions: number; failedExecutions: number; totalDuration: number; averageDuration: number; } export declare class MetricsPlugin implements IWorkflowPlugin { private readonly staleAfterMs; name: string; private metrics; private stateStartTimes; constructor(staleAfterMs?: number); onInit(): void; beforeExecute(context: WorkflowContext): void; afterExecute(context: WorkflowContext): void; onError(context: WorkflowContext, _error: Error): void; getMetrics(state?: string): StateMetrics | Map; clearMetrics(): void; /** * A state that never reaches afterExecute or onError (for example when an error handler * exits the workflow) would otherwise keep its start timestamp forever. */ private evictStaleStartTimes; private recordMetric; private createEmptyMetrics; } //# sourceMappingURL=metrics.plugin.d.ts.map