{"id":50784177,"url":"https://github.com/pallaprolus/metrisight","last_synced_at":"2026-06-12T06:06:08.663Z","repository":{"id":338727923,"uuid":"1158843840","full_name":"pallaprolus/metrisight","owner":"pallaprolus","description":"Lightweight metric anomaly detection dashboard for developers (AIOps)","archived":false,"fork":false,"pushed_at":"2026-02-16T05:54:48.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-16T11:14:12.006Z","etag":null,"topics":["aiops","anomaly-detection","devops","metrics","monitoring","observability","open-source","prometheus","streamlit","time-series"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pallaprolus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-16T01:35:17.000Z","updated_at":"2026-02-16T05:53:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pallaprolus/metrisight","commit_stats":null,"previous_names":["pallaprolus/metrisight"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pallaprolus/metrisight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallaprolus%2Fmetrisight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallaprolus%2Fmetrisight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallaprolus%2Fmetrisight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallaprolus%2Fmetrisight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pallaprolus","download_url":"https://codeload.github.com/pallaprolus/metrisight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallaprolus%2Fmetrisight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34231243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiops","anomaly-detection","devops","metrics","monitoring","observability","open-source","prometheus","streamlit","time-series"],"created_at":"2026-06-12T06:06:07.069Z","updated_at":"2026-06-12T06:06:08.652Z","avatar_url":"https://github.com/pallaprolus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MetriSight\n\nA lightweight, self-hosted metric anomaly dashboard for developers. Detects anomalies in time-series metrics using statistical methods — no ML expertise or expensive APM tools required.\n\n## Features\n\n- **Prometheus live streaming** — connect to any Prometheus instance, auto-refresh on a configurable interval\n- **Real-time anomaly detection** using Z-score and Moving Average methods\n- **Interactive dashboard** with Plotly charts and Streamlit\n- **CSV upload** — bring your own metric data from any source\n- **Simulated metrics** (CPU, Memory, Latency) with injected anomalies for demo\n- **Configurable thresholds** via sidebar controls\n\n## Quick Start\n\n```bash\npip install -r requirements.txt\nstreamlit run app.py\n```\n\nThe dashboard opens at `http://localhost:8501`. By default it runs with simulated metrics — switch to **Prometheus (Live)** or **Upload CSV** in the sidebar.\n\n## Connecting to Prometheus (Live Streaming)\n\nMetriSight connects directly to your Prometheus instance and streams metrics with configurable auto-refresh.\n\n### Setup\n\n1. Select **Prometheus (Live)** in the sidebar\n2. Enter your Prometheus URL (e.g., `http://localhost:9090`)\n3. Enter a PromQL query (e.g., `rate(node_cpu_seconds_total{mode=\"idle\"}[5m])`)\n4. Choose a lookback window (1h, 6h, 24h, or 7 days)\n5. Set auto-refresh interval (15s, 30s, 1m, or 5m) for live monitoring\n6. Click **Test Connection** to verify connectivity\n\n### Example PromQL queries\n\n```promql\n# CPU usage rate\nrate(node_cpu_seconds_total{mode=\"idle\"}[5m])\n\n# Memory usage percentage\n(1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100\n\n# HTTP request latency (p95)\nhistogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))\n\n# HTTP error rate\nrate(http_requests_total{status=~\"5..\"}[5m])\n\n# Disk I/O utilization\nrate(node_disk_io_time_seconds_total[5m])\n```\n\n### Authentication\n\nMetriSight supports authenticated Prometheus instances. Select the auth method in the sidebar under the Prometheus section.\n\n| Method | When to use | Setup |\n|--------|-------------|-------|\n| **None** | Local/internal Prometheus without auth | Default, no config needed |\n| **Bearer Token** | Grafana Cloud, Thanos, Cortex, managed Prometheus | Paste your API token |\n| **Basic Auth** | Prometheus behind nginx/Apache reverse proxy | Enter username + password |\n\nCredentials are passed via HTTP headers only — they are **never logged, stored on disk, or displayed** in the UI (password fields are masked).\n\n**Grafana Cloud example:**\n\n1. Get your API token from Grafana Cloud \u003e your stack \u003e Prometheus \u003e Details\n2. Set Prometheus URL to your Grafana Cloud Prometheus endpoint (e.g., `https://prometheus-prod-01-eu-west-0.grafana.net/api/prom`)\n3. Select **Bearer Token** and paste your API key\n4. Click **Test Connection** to verify — you'll see the Prometheus version if auth succeeds, or a `401 Unauthorized` error if the token is wrong\n\n### How it works\n\n- MetriSight queries the Prometheus `/api/v1/query_range` endpoint\n- The lookback window determines how far back to fetch (rolling window)\n- Auto-refresh re-queries Prometheus on the set interval, so the chart updates with live data\n- Anomaly detection runs on each refresh against the full lookback window\n\n### Lookback window guide\n\n| Window | Best for | Typical resolution |\n|--------|----------|-------------------|\n| 1 hour | Real-time incident triage | 15s |\n| 6 hours | Shift monitoring | 30s - 1m |\n| 24 hours | Daily pattern analysis | 1m |\n| 7 days | Weekly trend detection | 5m |\n\n## Other Data Sources\n\n### CSV Upload\n\nUpload a CSV file with two columns:\n\n```csv\ntimestamp,value\n2024-01-15 10:00:00,45.2\n2024-01-15 10:01:00,47.8\n2024-01-15 10:02:00,44.1\n```\n\n### Exporting from other tools\n\n**CloudWatch:**\n\n```bash\naws cloudwatch get-metric-statistics \\\n  --namespace AWS/EC2 --metric-name CPUUtilization \\\n  --start-time 2024-01-15T00:00:00Z --end-time 2024-01-15T23:59:59Z \\\n  --period 60 --statistics Average --output json \\\n  | python3 -c \"\nimport json, sys, csv\ndata = json.load(sys.stdin)['Datapoints']\ndata.sort(key=lambda x: x['Timestamp'])\nw = csv.writer(sys.stdout)\nw.writerow(['timestamp', 'value'])\nfor d in data:\n    w.writerow([d['Timestamp'], d['Average']])\n\" \u003e cloudwatch_cpu.csv\n```\n\n**Datadog:**\n\n```bash\ncurl -s \"https://api.datadoghq.com/api/v1/query?from=$(date -d '24 hours ago' +%s)\u0026to=$(date +%s)\u0026query=avg:system.cpu.user{*}\" \\\n  -H \"DD-API-KEY: $DD_API_KEY\" -H \"DD-APPLICATION-KEY: $DD_APP_KEY\" \\\n  | python3 -c \"\nimport json, sys, csv\nfrom datetime import datetime\ndata = json.load(sys.stdin)['series'][0]['pointlist']\nw = csv.writer(sys.stdout)\nw.writerow(['timestamp', 'value'])\nfor ts_ms, val in data:\n    w.writerow([datetime.fromtimestamp(ts_ms / 1000).isoformat(), val])\n\" \u003e datadog_cpu.csv\n```\n\n### Programmatic Usage\n\n```python\nimport pandas as pd\nfrom metrisight.detector import detect_zscore, get_anomaly_summary\n\ndf = pd.read_csv(\"my_metrics.csv\")\ndf[\"timestamp\"] = pd.to_datetime(df[\"timestamp\"])\n\nresult = detect_zscore(df, threshold=3.0)\nsummary = get_anomaly_summary(result)\nprint(f\"Found {summary['anomaly_count']} anomalies ({summary['anomaly_pct']}%)\")\n```\n\n## How It Works\n\nMetriSight uses two statistical methods to detect anomalies:\n\n1. **Z-Score Detection** — flags data points that deviate more than N standard deviations from the mean\n2. **Moving Average Detection** — flags data points that deviate from a rolling mean by more than N rolling standard deviations\n\n## Project Structure\n\n```\nmetrisight/\n├── app.py                  # Streamlit dashboard\n├── metrisight/\n│   ├── simulator.py        # Generates realistic fake metrics\n│   ├── detector.py         # Anomaly detection algorithms\n│   ├── prometheus.py       # Prometheus HTTP API client\n│   └── charts.py           # Plotly chart builders\n└── tests/\n    ├── test_detector.py    # Detection algorithm tests\n    └── test_prometheus.py  # Prometheus client tests\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpallaprolus%2Fmetrisight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpallaprolus%2Fmetrisight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpallaprolus%2Fmetrisight/lists"}