feat(payments-api): add basic obs and monitoring#20815
Open
StaberindeZA wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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.tsimported first inmain.ts, and wire up Sentry’s Nest global filter/module. - Add Sentry config scaffolding and local env vars; exclude
AppControllerroutes 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.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
This pull request
Issue that this pull request solves
Closes: #PAY-3791
Checklist
Put an
xin the boxes that applyHow to review (Optional)
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.