README / docs /configs /analytics_config.json
stackConsult's picture
Create docs/configs/analytics_config.json
276436b verified
Raw History Blame Contribute Delete
10.5 kB
{
"analytics_agent": {
"version": "1.0.0",
"enabled": true,
"description": "Advanced analytics agent with custom metrics, notifications, and multi-role support",
"custom_metrics": {
"enabled": true,
"collection_interval_seconds": 60,
"retention_days": 90,
"metrics": [
{
"id": "user_engagement_score",
"name": "User Engagement Score",
"type": "composite",
"formula": "(active_users * avg_session_duration) / total_users",
"threshold_warning": 0.3,
"threshold_critical": 0.15
},
{
"id": "api_response_time_p95",
"name": "API Response Time (95th Percentile)",
"type": "performance",
"unit": "milliseconds",
"threshold_warning": 500,
"threshold_critical": 1000
},
{
"id": "error_rate",
"name": "Error Rate",
"type": "reliability",
"unit": "percentage",
"threshold_warning": 2,
"threshold_critical": 5
},
{
"id": "resource_utilization",
"name": "Resource Utilization",
"type": "system",
"components": ["cpu", "memory", "disk", "network"],
"threshold_warning": 75,
"threshold_critical": 90
}
]
},
"notifications": {
"enabled": true,
"channels": [
{
"type": "email",
"enabled": true,
"recipients": ["admin@strategystack.io", "ops-team@strategystack.io"],
"severity_levels": ["warning", "critical"]
},
{
"type": "slack",
"enabled": true,
"webhook_url": "${SLACK_WEBHOOK_URL}",
"channel": "#analytics-alerts",
"severity_levels": ["critical"]
},
{
"type": "webhook",
"enabled": true,
"endpoint": "${WEBHOOK_ENDPOINT}",
"severity_levels": ["info", "warning", "critical"]
}
],
"rate_limiting": {
"enabled": true,
"max_notifications_per_hour": 10,
"cooldown_minutes": 15
}
},
"role_views": {
"enabled": true,
"roles": [
{
"id": "admin",
"name": "Administrator",
"permissions": ["view_all", "configure", "export", "delete"],
"default_dashboard": "system_overview",
"visible_metrics": ["*"]
},
{
"id": "analyst",
"name": "Data Analyst",
"permissions": ["view_all", "export"],
"default_dashboard": "analytics_deep_dive",
"visible_metrics": ["user_engagement_score", "custom_metrics", "historical_trends"]
},
{
"id": "developer",
"name": "Developer",
"permissions": ["view_technical", "export"],
"default_dashboard": "api_performance",
"visible_metrics": ["api_response_time_p95", "error_rate", "system_health"]
},
{
"id": "viewer",
"name": "Read-Only Viewer",
"permissions": ["view_summary"],
"default_dashboard": "executive_summary",
"visible_metrics": ["user_engagement_score"]
}
]
},
"batch_processing": {
"enabled": true,
"schedule": "0 2 * * *",
"operations": [
{
"name": "daily_aggregation",
"type": "aggregate",
"source_metrics": ["*"],
"output_format": "parquet",
"retention_days": 365
},
{
"name": "weekly_report",
"type": "report",
"schedule": "0 3 * * 1",
"recipients": ["leadership@strategystack.io"],
"format": "pdf"
},
{
"name": "data_cleanup",
"type": "maintenance",
"schedule": "0 1 * * 0",
"purge_older_than_days": 90
}
]
},
"historical_analysis": {
"enabled": true,
"storage_backend": "timeseries_db",
"compression": "zstd",
"features": [
{
"name": "trend_detection",
"enabled": true,
"algorithms": ["moving_average", "exponential_smoothing", "seasonal_decomposition"]
},
{
"name": "anomaly_detection",
"enabled": true,
"algorithms": ["isolation_forest", "statistical_outliers", "prophet"]
},
{
"name": "forecasting",
"enabled": true,
"horizon_days": 30,
"confidence_interval": 0.95
},
{
"name": "comparative_analysis",
"enabled": true,
"comparison_periods": ["day_over_day", "week_over_week", "month_over_month", "year_over_year"]
}
]
},
"system_health": {
"enabled": true,
"monitoring_interval_seconds": 30,
"components": [
{
"name": "database",
"checks": ["connection_pool", "query_performance", "replication_lag"],
"critical_threshold": 5
},
{
"name": "cache",
"checks": ["hit_rate", "memory_usage", "eviction_rate"],
"critical_threshold": 3
},
{
"name": "queue",
"checks": ["depth", "processing_rate", "dead_letter_queue"],
"critical_threshold": 1000
},
{
"name": "external_services",
"checks": ["api_availability", "response_time", "rate_limits"],
"critical_threshold": 2
}
],
"auto_recovery": {
"enabled": true,
"actions": ["restart_service", "clear_cache", "scale_resources"]
}
},
"api_endpoints": {
"enabled": true,
"base_path": "/api/v1/analytics",
"authentication": "bearer_token",
"rate_limiting": {
"enabled": true,
"requests_per_minute": 100
},
"endpoints": [
{
"path": "/metrics",
"methods": ["GET"],
"description": "Retrieve current metrics",
"parameters": ["metric_id", "start_time", "end_time", "granularity"]
},
{
"path": "/metrics/custom",
"methods": ["POST", "PUT", "DELETE"],
"description": "Manage custom metrics",
"permissions": ["admin"]
},
{
"path": "/dashboards",
"methods": ["GET"],
"description": "Get dashboard configurations for user role"
},
{
"path": "/alerts",
"methods": ["GET", "POST"],
"description": "Manage alert configurations"
},
{
"path": "/export",
"methods": ["POST"],
"description": "Export analytics data",
"parameters": ["format", "metrics", "date_range"],
"formats": ["json", "csv", "parquet", "excel"]
},
{
"path": "/health",
"methods": ["GET"],
"description": "Get system health status",
"public": true
},
{
"path": "/historical",
"methods": ["GET"],
"description": "Access historical analysis and trends",
"parameters": ["analysis_type", "metric_id", "time_range"]
}
]
},
"failover_logging": {
"enabled": true,
"primary_logger": {
"type": "elasticsearch",
"endpoint": "${ELASTICSEARCH_URL}",
"index_pattern": "analytics-logs-%{+YYYY.MM.dd}"
},
"failover_loggers": [
{
"priority": 1,
"type": "cloudwatch",
"log_group": "strategystack-analytics",
"retention_days": 30
},
{
"priority": 2,
"type": "file",
"path": "/var/log/analytics",
"rotation": "daily",
"max_size_mb": 100,
"retention_days": 7
},
{
"priority": 3,
"type": "syslog",
"endpoint": "${SYSLOG_ENDPOINT}",
"protocol": "tcp"
}
],
"health_check_interval_seconds": 60,
"auto_failover": true,
"log_levels": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
"structured_logging": true,
"include_metadata": {
"timestamp": true,
"correlation_id": true,
"user_id": true,
"session_id": true,
"environment": true
}
},
"integration_points": {
"ui_interface": {
"enabled": true,
"framework": "react",
"components": [
{
"name": "MetricsDashboard",
"path": "src/components/analytics/MetricsDashboard.tsx",
"props": ["roleId", "dateRange", "refreshInterval"]
},
{
"name": "CustomMetricBuilder",
"path": "src/components/analytics/CustomMetricBuilder.tsx",
"permissions": ["admin", "analyst"]
},
{
"name": "AlertsPanel",
"path": "src/components/analytics/AlertsPanel.tsx",
"realtime": true
},
{
"name": "HistoricalAnalyzer",
"path": "src/components/analytics/HistoricalAnalyzer.tsx",
"features": ["trends", "forecasting", "anomalies"]
},
{
"name": "SystemHealthMonitor",
"path": "src/components/analytics/SystemHealthMonitor.tsx",
"update_interval_seconds": 10
}
],
"websocket_endpoint": "${WEBSOCKET_URL}/analytics",
"state_management": "redux"
},
"backend_services": {
"strategy_engine": {
"metrics_export": true,
"event_hooks": ["strategy_execution", "performance_update"]
},
"user_service": {
"metrics_export": true,
"event_hooks": ["user_action", "session_start", "session_end"]
},
"notification_service": {
"alert_integration": true,
"priority_routing": true
}
}
},
"performance_optimization": {
"caching": {
"enabled": true,
"strategy": "redis",
"ttl_seconds": 300,
"cache_warmer": true
},
"query_optimization": {
"enabled": true,
"use_materialized_views": true,
"parallel_queries": true,
"query_timeout_seconds": 30
},
"data_sampling": {
"enabled": true,
"high_cardinality_threshold": 10000,
"sampling_rate": 0.1
}
}
}
}