UNPKG

@gork-labs/secondbrain-mcp

Version:

Second Brain MCP Server - Agent team orchestration with dynamic tool discovery

61 lines (60 loc) 2.07 kB
import { PerformanceMetric, UsageMetric, PerformanceInsight, UsagePattern, SystemHealth } from '../utils/types.js'; import { AnalyticsStorage } from './storage.js'; /** * Metrics Collector * Collects and analyzes system performance and usage metrics */ export declare class MetricsCollector { private storage; private operationStartTimes; private systemStartTime; constructor(storage: AnalyticsStorage); /** * Start timing an operation */ startOperation(operationId: string, operation: string): void; /** * End timing an operation and record performance metric */ endOperation(operationId: string, operation: string, success: boolean, errorType?: string, metadata?: Record<string, any>): number; /** * Record a usage event */ recordUsage(subagent: string, sessionId: string, operation: string, success: boolean, userContext?: { taskType?: string; urgency?: string; complexity?: 'low' | 'medium' | 'high'; }): void; /** * Analyze performance trends for specific operations */ analyzeOperationPerformance(operation: string, days?: number): PerformanceInsight; private createEmptyPerformanceInsight; private analyzeErrorPatterns; private generateOptimizationSuggestions; private calculatePerformanceTrend; /** * Analyze usage patterns for chatmodes */ analyzeUsagePatterns(subagent?: string, days?: number): UsagePattern[]; private analyzeSpecificSubagentUsage; private createEmptyUsagePattern; private findMode; /** * Get current system health metrics */ getSystemHealth(): SystemHealth; private determineHealthStatus; /** * Get performance summary for all operations */ getPerformanceSummary(days?: number): Record<string, PerformanceInsight>; /** * Export metrics for external analysis */ exportMetrics(operation?: string, days?: number): { performance: PerformanceMetric[]; usage: UsageMetric[]; summary: any; }; }