Skip to content

feat: implement metrics collection system for performance, errors, an…#644

Open
fridaypetra55-afk wants to merge 1 commit into
StellarDevHub:mainfrom
fridaypetra55-afk:feat/metrics-collection-819
Open

feat: implement metrics collection system for performance, errors, an…#644
fridaypetra55-afk wants to merge 1 commit into
StellarDevHub:mainfrom
fridaypetra55-afk:feat/metrics-collection-819

Conversation

@fridaypetra55-afk
Copy link
Copy Markdown

@fridaypetra55-afk fridaypetra55-afk commented Jun 1, 2026

…d business metrics

  • Add MetricsCollector singleton (src/metrics/MetricsCollector.ts)
    • recordRequest: HTTP performance metrics with slow-request warnings
    • recordError: error tracking by type and status code
    • recordEvent: business event tracking (registrations, enrollments, certificates)
    • getSummary: aggregated snapshot with system metrics (uptime, memory, CPU)
    • Ring-buffer trimming to bound memory usage (default 10k entries/category)
  • Add metrics routes (src/routes/metrics.routes.ts)
    • GET /api/v1/metrics - aggregated summary
    • GET /api/v1/metrics/performance - raw performance entries
    • GET /api/v1/metrics/errors - raw error entries
    • GET /api/v1/metrics/business - raw business event entries
    • POST /api/v1/metrics/reset - clear all metrics
  • Register /metrics route in src/routes/index.ts
  • Add 36 unit tests with 100%% coverage (tests/metrics.test.ts)
  • Fix malformed package.json (duplicate keys, missing commas)
  • Add jest.setup.js for test environment setup

Closes #619
Closes #617
Closes #616
Closes #618

…d business metrics

- Add MetricsCollector singleton (src/metrics/MetricsCollector.ts)
  - recordRequest: HTTP performance metrics with slow-request warnings
  - recordError: error tracking by type and status code
  - recordEvent: business event tracking (registrations, enrollments, certificates)
  - getSummary: aggregated snapshot with system metrics (uptime, memory, CPU)
  - Ring-buffer trimming to bound memory usage (default 10k entries/category)
- Add metrics routes (src/routes/metrics.routes.ts)
  - GET  /api/v1/metrics           - aggregated summary
  - GET  /api/v1/metrics/performance - raw performance entries
  - GET  /api/v1/metrics/errors      - raw error entries
  - GET  /api/v1/metrics/business    - raw business event entries
  - POST /api/v1/metrics/reset       - clear all metrics
- Register /metrics route in src/routes/index.ts
- Add 36 unit tests with 100%% coverage (tests/metrics.test.ts)
- Fix malformed package.json (duplicate keys, missing commas)
- Add jest.setup.js for test environment setup

Closes #819
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@fridaypetra55-afk is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@fridaypetra55-afk 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant