Skip to content

feat(payments-api): add basic obs and monitoring#20815

Open
StaberindeZA wants to merge 1 commit into
mainfrom
pay-3791
Open

feat(payments-api): add basic obs and monitoring#20815
StaberindeZA wants to merge 1 commit into
mainfrom
pay-3791

Conversation

@StaberindeZA

Copy link
Copy Markdown
Contributor

Because

  • Add basic observability and monitoring to payments-api

This pull request

  • Add Sentry to payments-api
  • Add StatsD metrics to all routes, excluding heartbeat and version

Issue that this pull request solves

Closes: #PAY-3791

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

Copilot AI review requested due to automatic review settings July 2, 2026 17:15
@StaberindeZA StaberindeZA requested a review from a team as a code owner July 2, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds baseline observability for the payments API by introducing Sentry initialization at bootstrap time and adding a global StatsD route interceptor to emit per-request metrics (with an opt-out decorator for noisy endpoints).

Changes:

  • Add StatsDRouteInterceptor (+ tests) and export it from the shared statsd package.
  • Initialize Sentry early via a new monitoring.ts imported first in main.ts, and wire up Sentry’s Nest global filter/module.
  • Add Sentry config scaffolding and local env vars; exclude AppController routes from route metrics via @SkipRouteMetrics().

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
libs/shared/metrics/statsd/src/lib/statsd-route.interceptor.ts New global interceptor emitting per-route StatsD count + duration metrics, with skip metadata support.
libs/shared/metrics/statsd/src/lib/statsd-route.interceptor.spec.ts Unit tests covering success/error paths, defaults, skip decorator behavior, and non-HTTP contexts.
libs/shared/metrics/statsd/src/index.ts Exports the new interceptor and skip decorator API.
apps/payments/api/src/monitoring.ts Early Sentry initialization before Nest boots (dotenv load + initSentry).
apps/payments/api/src/main.ts Ensures monitoring bootstrap runs before Nest imports.
apps/payments/api/src/config/sentry.config.ts Adds typed config schema for Sentry-related env vars.
apps/payments/api/src/config/index.ts Adds sentryConfig to the root typed config schema.
apps/payments/api/src/app/app.module.ts Registers Sentry module + global filter, and registers the global StatsD route interceptor.
apps/payments/api/src/app/app.controller.ts Applies @SkipRouteMetrics() to exclude controller routes from StatsD route metrics.
apps/payments/api/.env Adds local Sentry env var defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/shared/metrics/statsd/src/lib/statsd-route.interceptor.ts Outdated
Comment thread libs/shared/metrics/statsd/src/lib/statsd-route.interceptor.ts Outdated
Comment thread apps/payments/api/src/monitoring.ts
Comment thread apps/payments/api/src/config/sentry.config.ts
Comment thread apps/payments/api/src/config/index.ts
Comment thread apps/payments/api/.env Outdated

@xlisachan xlisachan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+, thanks Reino!

Because:

* Add basic observability and monitoring to payments-api

This commit:

* Add Sentry to payments-api
* Add StatsD metrics to all routes, excluding heartbeat and version

Closes #PAY-3791
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.

3 participants