Speed & Slowdown Analyser
In plain English
Reads raw website response logs, flags unusual speed spikes or missing records, and draws clear visual summary charts automatically.
A Python 3.12 pipeline validating CSV service logs into SQLite before computing pandas percentile rollups, anomaly detection, and Matplotlib SVG exports.
1. Why I built it
Built to pair strict CSV ingestion checks with vectorised statistical aggregation and zero-variance safeguards.
2. How it works
Implemented `TelemetryRecord`, `ServiceStatistics`, `AnalyticsWorkbench`, and `pearson_correlation` in `src/data_workbench/pipeline.py`.
Service telemetry CSVs frequently arrive with missing identifiers, non-finite floats, negative durations, or impossible error percentages (`> 100%`). Feeding dirty exports directly into analytics skews tail percentiles silently.
`AnalyticsWorkbench` verifies `csv_path.is_file()` and required header columns first, validates `math.isfinite()` and domain ranges per row, tracks accepted vs rejected counts, and batch-inserts clean records into SQLite with `executemany()`.
From SQLite, pandas computes per-service medians (`p50`), 95th percentiles (`p95`), and population standard deviation (`σ`) via NumPy, alongside positive-threshold Z-score anomaly flags, finiteness-checked Pearson `r` correlation, and headless Matplotlib SVG bar charts.
3. Output & Source Specimen
Pipeline Stages & Data Contracts
Run checks: pytest -v tests/test_pipeline.py4. Design Decisions & Challenges
Key Design Decisions
- 01.Validated file existence and required CSV headers upfront in `ingest_csv()` before iterating rows.
- 02.Used SQLite `executemany()` with finiteness assertions and positive `z_threshold` validation.
- 03.Configured Matplotlib's headless `Agg` backend for consistent SVG chart generation in CI environments.
Edge Cases Handled
- Guarding `detect_latency_anomalies()` and `pearson_correlation()` against zero-variance inputs (`pstdev == 0.0`) and non-finite numbers.
5. Testing & Limits
Automated Checks
Verified by 5 pytest suites in `tests/test_pipeline.py` checking malformed row rejections, header validation, p50/p95/p99 percentiles, Z-score anomalies, Pearson `r`, grouped SVG export, and exit code 2 input validation.
Current Limits & Next Steps
- Z-score filtering assumes symmetric spread around the mean; adding IQR or MAD thresholds would suit heavily skewed latency curves.
6. Key Takeaways
What building Speed & Slowdown Analyser reinforced
Explicit validation counters make data quality measurable, while comparing `p50` against `p95` shows why averages understate tail spikes.
- — 5 pytest checks and Ruff lint pass cleanly in CI.
- — Source hosted at github.com/16lv/telemetry-latency-analyser.
Recent Activity
Latest repository updates
fix: validate --z-threshold upfront and emit exit code 2 on CLI input errors
Checked finite positive --z-threshold values before CSV ingestion and handled invalid input paths cleanly in telemetry-analyser.
fix: group p50/p95/p99 latency bars clearly in exported chart
Updated export_latency_chart() in telemetry-latency-analyser to plot three aligned p50/p95/p99 bars per service.
Add python -m data_workbench runner and verify editable install in CI
Committed directly to telemetry-latency-analyser (main) · Reads raw website response logs, flags unusual speed spikes or missing records, and draws clear visual summary charts automatically.