feat: implement application metrics and KPIs exposed via Prometheus e…#905
feat: implement application metrics and KPIs exposed via Prometheus e…#905whitezaddy wants to merge 2 commits into
Conversation
|
@whitezaddy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Great job so far There’s just one blocker — the workflow is failing. Could you take a look and fix it so all checks pass? Happy to review again once that’s done. |
Will do |
@RUKAYAT-CODER kindly review |
…ndpoint (#518)
feat(metrics): add comprehensive application metrics and KPIs (#518)
Closes #518
📝 Description
This pull request introduces a comprehensive metrics and KPI tracking system to monitor application health, business performance, and user behavior. It integrates with Prometheus by exposing a
/metricsendpoint and includes scheduled jobs for calculating key business indicators.This implementation directly addresses the need for business metrics and analytics dashboards by exposing critical data for monitoring and feature adoption measurement.
Key Features Implemented:
MetricsModuleexposes a/metricsendpoint for scraping. Includes default Node.js metrics.MetricsInterceptortracks API request latency (p50, p95, p99) using a Prometheus histogram.KpiServiceruns on a 5-minute cron schedule to calculate and update the following metrics:KpiServiceto ensure calculation logic is correct.✅ Checklist
Linked issue
#518usingCloses #518Branch & commits
develop)feature/issue-518-app-metricsCode quality & tests
npm run lint:cipasses with zero warningsnpm run format:checkpassesnpm run typecheckpasses with zero errorsnpm run test:cipasses and coverage threshold is maintainedkpi.service.spec.ts)Error handling & NestJS best practices
class-validator/class-transformerand are wired through NestJS validation pipes (N/A for this feature)Error(N/A for this feature)KpiService)/metricsis public)Documentation / Swagger
/metrics)/api/docs) reflects the changesREADME.mdorCONTRIBUTING.mdis updated if contributor workflow or API behaviour changes (No changes needed)Breaking changes
🧪 Test Evidence
The new functionality was validated locally through the following steps:
1. Run the application