@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
108 lines • 2.88 kB
TypeScript
/**
* Performance Comparator for Sync Operations
* @description Compares performance metrics between different sync runs,
* enabling tracking of optimization improvements over time.
*
* Features:
* - Baseline vs current comparison
* - Trend analysis across multiple runs
* - Performance regression detection
* - Improvement percentage calculations
* - Visual comparison charts (ASCII)
*
* @author Optimizely MCP Server
* @version 1.0.0
*/
/**
* Performance snapshot for comparison
*/
export interface PerformanceSnapshot {
timestamp: string;
totalDuration: number;
totalRecords: number;
sqlOperationsBefore: number;
sqlOperationsAfter: number;
reductionPercent: number;
entityBreakdown: Record<string, {
records: number;
duration: number;
reduction: number;
}>;
metadata: {
projectCount: number;
syncType: 'full' | 'incremental';
version: string;
};
}
/**
* Comparison result structure
*/
export interface ComparisonResult {
baseline: PerformanceSnapshot;
current: PerformanceSnapshot;
improvements: {
durationChange: number;
durationChangePercent: number;
reductionChange: number;
throughputChange: number;
throughputChangePercent: number;
};
regressions: string[];
highlights: string[];
}
/**
* Performance history for trend analysis
*/
export interface PerformanceHistory {
snapshots: PerformanceSnapshot[];
bestPerformance: {
fastestSync: PerformanceSnapshot;
highestReduction: PerformanceSnapshot;
highestThroughput: PerformanceSnapshot;
};
}
/**
* Performance Comparator Class
*/
export declare class PerformanceComparator {
private historyFile;
private maxHistorySize;
constructor(dataDir?: string);
/**
* Ensure data directory exists
*/
private ensureDataDirectory;
/**
* Save performance snapshot
*/
saveSnapshot(snapshot: PerformanceSnapshot): void;
/**
* Load performance history
*/
loadHistory(): PerformanceHistory;
/**
* Update best performance records
*/
private updateBestPerformances;
/**
* Compare current performance with baseline
*/
compare(current: PerformanceSnapshot, baseline?: PerformanceSnapshot): ComparisonResult | null;
/**
* Generate comparison report
*/
generateComparisonReport(comparison: ComparisonResult): void;
/**
* Generate visual comparison chart
*/
private generateVisualComparison;
/**
* Generate trend analysis
*/
generateTrendAnalysis(limit?: number): void;
/**
* Create snapshot from performance report
*/
static createSnapshot(report: any, syncType?: 'full' | 'incremental'): PerformanceSnapshot;
}
//# sourceMappingURL=PerformanceComparator.d.ts.map