How bhaskar-2001/aiops-anomaly-detector-for-kubernetes works
This repository is a Kubernetes AIOps monitoring system: a sample Flask workload exposes Prometheus metrics, the detector polls those metrics and identifies deviations from clean rolling baselines, then diagnoses anomalies and sends cooldown-controlled Slack alerts. Its documented workflow also includes Prometheus/Grafana monitoring and synthetic load/leak routes for exercising detection. The detector source shows the polling, scoring, diagnosis, and alerting calls; scrape and deployment relationships come from the README, since their configuration files were not sampled.
Main entry points: anomaly_detector.py Polling loop · app.py Flask workload · monitoring-values.yaml Prometheus
Components 14
Sample workload
- Flask workload
sample-app/app.py - Load and leak routes
sample-app/app.py - Metrics endpoint
sample-app/app.py
Monitoring stack
- Prometheus
monitoring-values.yaml - Grafana
monitoring-values.yaml
Detection engine
- Polling loop
detector/anomaly_detector.py - PromQL queries
detector/anomaly_detector.py - Rolling baseline
detector/anomaly_detector.py - Anomaly scoring
detector/anomaly_detector.py - Root-cause rules
detector/anomaly_detector.py
Alerting
- Alert cooldown
detector/anomaly_detector.py - Alert formatting
detector/anomaly_detector.py - Slack webhook
Other components
- Operator / traffic
Connections 14
- Operator / traffic → Flask workload: sends traffic
README.md - Operator / traffic → Load and leak routes: triggers tests
README.md - Load and leak routes → Flask workload: exercises workload
sample-app/app.py - Flask workload → Metrics endpoint: exposes metrics
sample-app/app.py - Prometheus → Metrics endpoint: scrapes
README.md - Polling loop → PromQL queries: queries metrics
detector/anomaly_detector.py - PromQL queries → Prometheus: reads via PromQL
detector/anomaly_detector.py - Polling loop → Rolling baseline: scores samples
detector/anomaly_detector.py - Rolling baseline → Anomaly scoring: flags deviations
detector/anomaly_detector.py - Polling loop → Root-cause rules: diagnoses anomalies
detector/anomaly_detector.py - Polling loop → Alert cooldown: submits alerts
detector/anomaly_detector.py - Alert cooldown → Alert formatting: formats eligible alerts
detector/anomaly_detector.py - Alert formatting → Slack webhook: posts webhook
detector/anomaly_detector.py - Alert formatting → Grafana: includes investigation link
detector/anomaly_detector.py