UNPKG

il2cpp-dump-analyzer-mcp

Version:

Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games

98 lines (97 loc) 2.46 kB
/** * Metrics collection and export service for IL2CPP dump analyzer MCP system * Provides Prometheus-compatible metrics export and monitoring dashboards */ import { EventEmitter } from 'events'; import { HealthService } from './health-service.js'; export interface MetricValue { name: string; value: number; labels?: Record<string, string>; timestamp: Date; type: 'counter' | 'gauge' | 'histogram' | 'summary'; help?: string; } export interface PrometheusMetric { name: string; type: string; help: string; values: Array<{ value: number; labels?: Record<string, string>; }>; } export interface MetricsConfig { enabled: boolean; exportInterval: number; retentionPeriod: number; prometheusEnabled: boolean; prometheusPort?: number; customMetrics: boolean; } /** * Metrics collection and export service */ export declare class MetricsService extends EventEmitter { private config; private metrics; private exportInterval?; private healthService?; private isRunning; private readonly builtInMetrics; constructor(config?: Partial<MetricsConfig>); /** * Initialize metrics service with health service integration */ initialize(healthService: HealthService): void; /** * Start metrics collection */ start(): void; /** * Stop metrics collection */ stop(): void; /** * Record a metric value */ recordMetric(metric: Omit<MetricValue, 'timestamp'>): void; /** * Record health check metrics from health status */ private recordHealthMetrics; /** * Get current metrics in Prometheus format */ getPrometheusMetrics(): string; /** * Get latest metric values (deduplicated by labels) */ private getLatestMetricValues; /** * Format metrics in Prometheus exposition format */ private formatPrometheusOutput; /** * Export metrics (can be extended for different export targets) */ private exportMetrics; /** * Clean up old metrics based on retention period */ private cleanupOldMetrics; /** * Get metrics summary */ getMetricsSummary(): { totalMetrics: number; metricTypes: number; oldestMetric?: Date; newestMetric?: Date; isRunning: boolean; }; /** * Clear all metrics */ clearMetrics(): void; }