📱 Live Monitoring Dashboard
The floating monitoring dashboard provides real-time visibility into system health without interrupting your workflow, featuring interactive metrics and instant drill-down capabilities.
🖥️ Dashboard Layout Preview
🌱 ESG Intelligence Platform Monitor
LIVE
AUTO-REFRESH
📊 API Health Status
â—
Alpha Vantage
â—
EPA
â—
Yahoo ESG
â—
World Bank
â—
OpenFIGI
â—
FMP
🚨 Recent Alerts (Last 24h)
Yahoo ESG rate limit approaching (85%)
2h ago
Cache optimization improved hit rate to 82%
4h ago
All systems operational - 98.7% uptime today
6h ago
// Live Dashboard Implementation
class SystemMonitoringDashboard {
constructor() {
this.isVisible = false;
this.refreshInterval = 30000; // 30 seconds
this.metricsCollector = new MetricsCollector();
this.alertManager = new AlertManager();
this.initializeDashboard();
}
initializeDashboard() {
// Create floating dashboard container
this.container = document.createElement('div');
this.container.id = 'monitoring-dashboard';
this.container.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
width: 400px;
max-height: 600px;
background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
color: white;
border-radius: 10px;
box-shadow: 0 8px 25px rgba(0,0,0,0.3);
z-index: 10000;
font-family: 'Segoe UI', system-ui, sans-serif;
overflow: hidden;
transition: transform 0.3s ease;
transform: translateX(420px);
`;
document.body.appendChild(this.container);
this.renderDashboard();
// Start real-time updates
setInterval(() => this.updateMetrics(), this.refreshInterval);
}
async renderDashboard() {
const metrics = await this.metricsCollector.getAllMetrics();
const alerts = await this.alertManager.getRecentAlerts(24); // Last 24 hours
this.container.innerHTML = `
${this.renderMetricsOverview(metrics)}
${this.renderAPIHealth(metrics.apiHealth)}
${this.renderRecentAlerts(alerts)}
`;
}
renderMetricsOverview(metrics) {
return `
${(metrics.systemUptime * 100).toFixed(1)}%
System Uptime
${metrics.avgResponseTime.toFixed(1)}s
Avg Response
${(metrics.cacheHitRate * 100).toFixed(0)}%
Cache Hit Rate
${metrics.healthyAPIs}/${metrics.totalAPIs}
APIs Healthy
`;
}
toggleDashboard() {
this.isVisible = !this.isVisible;
this.container.style.transform = this.isVisible ? 'translateX(0)' : 'translateX(420px)';
}
}
// Initialize monitoring dashboard
const systemMonitor = new SystemMonitoringDashboard();
// Keyboard shortcut to toggle dashboard (Ctrl+Shift+M)
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.shiftKey && e.key === 'M') {
systemMonitor.toggleDashboard();
}
});
🚨 Intelligent Alert System
Multi-level intelligent alerting system provides contextual notifications with actionable recommendations, preventing alert fatigue through smart aggregation and prioritization.
// Intelligent Alert Manager Implementation
class AlertManager {
constructor() {
this.alerts = [];
this.alertRules = new Map();
this.aggregationRules = new Map();
this.suppressionList = new Set();
this.initializeAlertRules();
}
initializeAlertRules() {
// API Rate Limit Alerts
this.alertRules.set('api_rate_limit', {
thresholds: {
warning: 0.80, // 80% quota usage
error: 0.95, // 95% quota usage
critical: 1.0 // Quota exceeded
},
cooldown: 300000, // 5 minutes between similar alerts
aggregation: 'api_source'
});
// Response Time Alerts
this.alertRules.set('response_time', {
thresholds: {
warning: 3000, // 3 seconds
error: 5000, // 5 seconds
critical: 10000 // 10 seconds
},
cooldown: 60000, // 1 minute between alerts
aggregation: 'time_based'
});
// Cache Performance Alerts
this.alertRules.set('cache_performance', {
thresholds: {
warning: 0.65, // Below 65% hit rate
error: 0.50, // Below 50% hit rate
critical: 0.30 // Below 30% hit rate
},
cooldown: 600000, // 10 minutes between alerts
aggregation: 'cache_tier'
});
}
async processAlert(alertType, data) {
const rule = this.alertRules.get(alertType);
if (!rule) return;
// Calculate alert severity
const severity = this.calculateSeverity(alertType, data.value, rule.thresholds);
if (severity === 'none') return;
// Check if alert should be suppressed
const alertKey = `${alertType}_${data.source}_${severity}`;
if (this.shouldSuppress(alertKey, rule.cooldown)) return;
// Create alert object
const alert = {
id: this.generateAlertId(),
type: alertType,
severity,
timestamp: Date.now(),
source: data.source,
value: data.value,
threshold: rule.thresholds[severity],
message: this.generateAlertMessage(alertType, severity, data),
recommendations: this.generateRecommendations(alertType, severity, data)
};
// Add to alerts and process
this.alerts.push(alert);
await this.processNewAlert(alert);
// Add to suppression list
this.suppressionList.add(alertKey);
setTimeout(() => this.suppressionList.delete(alertKey), rule.cooldown);
return alert;
}
generateAlertMessage(alertType, severity, data) {
const messages = {
api_rate_limit: {
warning: `${data.source} API approaching rate limit (${(data.value * 100).toFixed(1)}%)`,
error: `${data.source} API rate limit critical (${(data.value * 100).toFixed(1)}%)`,
critical: `${data.source} API rate limit exceeded - requests will fail`
},
response_time: {
warning: `${data.source} response time elevated (${data.value}ms)`,
error: `${data.source} response time high (${data.value}ms) - performance degraded`,
critical: `${data.source} response time critical (${data.value}ms) - service severely impacted`
},
cache_performance: {
warning: `Cache hit rate below target (${(data.value * 100).toFixed(1)}%) - performance impact`,
error: `Cache hit rate low (${(data.value * 100).toFixed(1)}%) - significant performance degradation`,
critical: `Cache hit rate critical (${(data.value * 100).toFixed(1)}%) - system performance severely impacted`
}
};
return messages[alertType]?.[severity] || `${alertType} alert: ${severity} level`;
}
generateRecommendations(alertType, severity, data) {
const recommendations = {
api_rate_limit: [
'Extend cache TTL to reduce API calls',
'Implement request prioritization',
'Consider upgrading to premium API tier',
'Enable request deduplication'
],
response_time: [
'Check API service status',
'Reduce concurrent request batch size',
'Enable circuit breaker if not active',
'Switch to cached data temporarily'
],
cache_performance: [
'Analyze cache invalidation patterns',
'Optimize cache TTL settings',
'Increase cache storage allocation',
'Review data access patterns'
]
};
return recommendations[alertType] || ['Check system logs for more details'];
}
async processNewAlert(alert) {
// Log to console with appropriate level
const logMethod = alert.severity === 'critical' ? 'error' :
alert.severity === 'error' ? 'error' :
alert.severity === 'warning' ? 'warn' : 'info';
console[logMethod](`🚨 [${alert.severity.toUpperCase()}] ${alert.message}`, {
alert,
recommendations: alert.recommendations
});
// Show browser notification if permissions granted
if ('Notification' in window && Notification.permission === 'granted') {
new Notification(`ESG Platform Alert: ${alert.severity}`, {
body: alert.message,
icon: '/favicon.ico',
tag: alert.id
});
}
// Update dashboard if visible
if (window.systemMonitor && window.systemMonitor.isVisible) {
window.systemMonitor.updateAlerts();
}
// Trigger alert handlers
this.triggerAlertHandlers(alert);
}
}
🔮 Predictive Analytics & Optimization
Advanced machine learning algorithms analyze historical patterns to predict potential issues, optimize system performance, and provide proactive recommendations before problems occur.
🧠 Predictive Capabilities
📈 Trend Analysis
- Performance Trends: Identify degradation patterns
- Usage Patterns: Predict peak load times
- Capacity Planning: Forecast resource needs
- Seasonal Variations: Market hours vs off-hours patterns
⚠️ Anomaly Detection
- Statistical Outliers: Detect unusual metric values
- Pattern Deviations: Identify abnormal system behavior
- Correlation Analysis: Find related performance issues
- Early Warning: Alert before thresholds are reached
// Predictive Analytics Engine
class PredictiveAnalytics {
constructor(metricsHistory) {
this.history = metricsHistory;
this.models = new Map();
this.predictions = new Map();
this.initializeModels();
}
initializeModels() {
// Response Time Prediction Model
this.models.set('response_time', new TimeSeriesPredictor({
windowSize: 288, // 24 hours of 5-minute intervals
predictionHorizon: 12, // Predict next hour
features: ['time_of_day', 'day_of_week', 'api_load', 'cache_hit_rate']
}));
// Cache Performance Prediction Model
this.models.set('cache_performance', new RegressionPredictor({
features: ['access_pattern', 'data_freshness', 'system_load'],
target: 'hit_rate'
}));
// API Quota Prediction Model
this.models.set('quota_usage', new ExponentialSmoothingPredictor({
seasonality: 'daily', // Daily usage patterns
trend: 'additive'
}));
}
async generatePredictions() {
const predictions = {};
// Predict response time trends
const responseTimePrediction = await this.predictResponseTime();
predictions.responseTimes = responseTimePrediction;
// Predict cache performance
const cachePrediction = await this.predictCachePerformance();
predictions.cachePerformance = cachePrediction;
// Predict API quota usage
const quotaPrediction = await this.predictQuotaUsage();
predictions.quotaUsage = quotaPrediction;
// Generate optimization recommendations
predictions.recommendations = this.generateOptimizationRecommendations(predictions);
return predictions;
}
async predictResponseTime() {
const model = this.models.get('response_time');
const recentData = this.history.getResponseTimeHistory(24); // Last 24 hours
const prediction = await model.predict(recentData);
return {
nextHour: prediction.values,
confidence: prediction.confidence,
trend: this.calculateTrend(prediction.values),
alerts: this.checkResponseTimeAlerts(prediction.values)
};
}
async detectAnomalies() {
const anomalies = [];
// Statistical anomaly detection using z-score
for (const [metric, values] of this.history.getAllMetrics()) {
const recentValues = values.slice(-100); // Last 100 data points
const mean = this.calculateMean(recentValues);
const stdDev = this.calculateStandardDeviation(recentValues);
const latestValue = recentValues[recentValues.length - 1];
const zScore = Math.abs((latestValue - mean) / stdDev);
if (zScore > 3) { // 3-sigma rule
anomalies.push({
metric,
value: latestValue,
expectedRange: [mean - 2*stdDev, mean + 2*stdDev],
severity: zScore > 4 ? 'critical' : 'warning',
timestamp: Date.now()
});
}
}
return anomalies;
}
generateOptimizationRecommendations(predictions) {
const recommendations = [];
// Response time optimization
if (predictions.responseTimes.trend === 'increasing') {
recommendations.push({
type: 'performance',
priority: 'high',
title: 'Response Time Degradation Detected',
description: 'Response times are trending upward. Consider optimization.',
actions: [
'Increase cache TTL for frequently accessed data',
'Reduce batch size for slow APIs',
'Enable additional circuit breakers'
]
});
}
// Cache optimization
if (predictions.cachePerformance.predictedHitRate < 0.75) {
recommendations.push({
type: 'cache',
priority: 'medium',
title: 'Cache Performance Optimization Needed',
description: `Predicted cache hit rate: ${(predictions.cachePerformance.predictedHitRate * 100).toFixed(1)}%`,
actions: [
'Analyze cache access patterns',
'Optimize cache eviction policies',
'Increase cache storage allocation'
]
});
}
// Quota management
for (const [api, quota] of Object.entries(predictions.quotaUsage)) {
if (quota.predictedUsage > 0.90) {
recommendations.push({
type: 'quota',
priority: 'critical',
title: `${api} API Quota Approaching Limit`,
description: `Predicted usage: ${(quota.predictedUsage * 100).toFixed(1)}%`,
actions: [
'Extend cache TTL for this API',
'Implement request prioritization',
'Consider upgrading API plan'
]
});
}
}
return recommendations;
}
}