feat: Implement latency profiling and guardrails for performance monitoring
CI / lint-test-build (push) Failing after 19s
CI / lint-test-build (push) Failing after 19s
- Added synthetic latency profiler scenarios and CLI scripts for baseline generation and regression checks. - Introduced latency baseline and threshold artifacts for CI enforcement. - Enhanced CI workflow with latency guardrail checks. - Updated documentation to include latency profiling commands and performance metrics. - Added unit tests for latency guardrail evaluation.
This commit is contained in:
@@ -210,6 +210,18 @@ Run secret scan (worktree + git history):
|
||||
python scripts/security_scan.py
|
||||
```
|
||||
|
||||
Generate latency profile baseline:
|
||||
|
||||
```powershell
|
||||
python scripts/profile_latency.py --iterations 600 --output ops/performance/latency_baseline.json
|
||||
```
|
||||
|
||||
Run latency regression guardrails:
|
||||
|
||||
```powershell
|
||||
python scripts/check_latency_regression.py --baseline ops/performance/latency_baseline.json --thresholds ops/performance/latency_thresholds.json --iterations 600
|
||||
```
|
||||
|
||||
Install pre-commit hooks:
|
||||
|
||||
```powershell
|
||||
@@ -338,3 +350,28 @@ Hardening checklist:
|
||||
- Run `pip-audit --skip-editable` in CI; treat vulnerability findings as release blockers.
|
||||
- Run `python scripts/security_scan.py` before release and after major merges.
|
||||
- Store secrets in environment/secret manager; never commit `.env` or key material.
|
||||
|
||||
## Performance Hardening
|
||||
|
||||
Profile scenarios:
|
||||
|
||||
- `book_update_burst`
|
||||
- `execution_spike`
|
||||
- `reconnect_storm`
|
||||
|
||||
Latency baseline and threshold artifacts:
|
||||
|
||||
- `ops/performance/latency_baseline.json`
|
||||
- `ops/performance/latency_thresholds.json`
|
||||
|
||||
CI guardrail:
|
||||
|
||||
- `.gitea/workflows/ci.yml` runs `scripts/check_latency_regression.py` and fails on regression.
|
||||
|
||||
Measured optimization impact (2026-06-01):
|
||||
|
||||
- `MetricsCalculator.compute()` switched from Python row scans to DuckDB SQL aggregates/quantiles.
|
||||
- Benchmark (`scripts/benchmark_metrics_compute.py`):
|
||||
- Python scan avg: `12.623 ms`
|
||||
- SQL aggregate avg: `11.039 ms`
|
||||
- Speedup: `1.14x`
|
||||
|
||||
Reference in New Issue
Block a user