import { QueryHookPlugin, QueryExecutionContext } from '../index'; /** * Options for PerformanceMonitorPlugin */ export interface PerformanceMonitorOptions { /** * Threshold in milliseconds for slow query detection (default: 500) */ slowQueryThreshold?: number; /** * Callback when a slow query is detected */ onSlowQuery?: (context: QueryExecutionContext) => void; /** * Callback for all query completions (for custom metrics) */ onMetric?: (context: QueryExecutionContext) => void; /** * Enable console logging for this plugin (default: false) * When true, the plugin will log query completions, slow queries, and errors to console */ enableLogging?: boolean; } /** * Plugin for monitoring query performance * Tracks execution time and detects slow queries * * @example * ```typescript * import { enableQueryHooks, registerPlugin } from 'typeorm-query-hooks'; * import { PerformanceMonitorPlugin } from 'typeorm-query-hooks/plugins/performance-monitor'; * * enableQueryHooks(); * * registerPlugin(PerformanceMonitorPlugin({ * slowQueryThreshold: 300, // custom threshold (default: 500ms) * enableLogging: true, // log to console (default: false) * onSlowQuery: (context) => { * console.warn(`Slow query detected: ${context.executionTime}ms`, { * sql: context.sql.substring(0, 200) * }); * } * })); * ``` */ export declare function PerformanceMonitorPlugin(options?: PerformanceMonitorOptions): QueryHookPlugin; //# sourceMappingURL=performance-monitor.d.ts.map