Skip to content

feat: per-endpoint SLO monitor - #759

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
AdEmOnD07:task/slo-monitor
Jul 29, 2026
Merged

feat: per-endpoint SLO monitor#759
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
AdEmOnD07:task/slo-monitor

Conversation

@AdEmOnD07

Copy link
Copy Markdown
Contributor

Description
This PR implements per-endpoint SLO monitoring for latency and error rate metrics with alert thresholds, adhering to project styles and guidelines.

Closes #286

Changes
Metrics Registration: Restored missing endpointRequestsTotal (Counter) and endpointRequestDuration (Histogram) metrics to resolve downstream merge conflict errors, and added sloViolationsTotal (Counter).
SLO Monitor Service: Created src/services/sloMonitor.ts to manage in-memory sliding window request logs per endpoint. Evaluates requests against configured limits (using src/config/slo.ts) and increments sloViolationsTotal for breaches.
Middleware Integration: Updated src/middleware/metricsHistogram.ts to sanitize and pass completed request metadata to the SLO Monitor.
Unit Tests: Added focused tests in tests/sloMonitor.test.ts to cover latency thresholds, sliding window sample eviction (simulated using mocked timers), and configuration fallback routing.
Verification & Edge Cases
Test Output
bash
PASS tests/metricsHistogram.test.ts
PASS tests/sloMonitor.test.ts
Test Suites: 2 passed, 2 total
Tests: 16 passed, 16 total
Snapshots: 0 total
Time: 30.926 s
ESLint Output
bash
$ npx eslint src/config/slo.ts src/services/sloMonitor.ts src/metrics/registry.ts src/middleware/metricsHistogram.ts
(0 errors, 0 warnings)

@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Merged into main via admin resolver (-X theirs).

@greatest0fallt1me
greatest0fallt1me merged commit fe1128a into Predictify-org:main Jul 29, 2026
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Merged ⭐ nicely done

@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 29, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-endpoint SLO monitoring

2 participants