refactor: remove legacy metrics API endpoints and module wiring#441
Closed
Chaitu-Tatipamula wants to merge 1 commit intoFilOzone:refactor/cleanup-metrics-jobsfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the backend’s legacy “metrics” REST API layer and related NestJS module wiring, completing additional steps of the broader metrics-table/job removal effort (Issue #275) now that Prometheus metrics are the primary observability surface.
Changes:
- Deleted
apps/backend/src/metrics/(controllers, services, DTOs, utils, and modules). - Removed metrics job scheduling/queue wiring and
METRICS_PER_HOURconfiguration. - Updated docs/manifests (
.env.example, README, kustomize local overlay) to drop the removed config and worker references.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| kustomize/overlays/local/backend-configmap-local.yaml | Removes METRICS_PER_HOUR from local ConfigMap. |
| docs/jobs.md | Drops METRICS_PER_HOUR mention from “Critical Environment Variables”. |
| docs/infra.md | Removes the metrics worker + metrics rate var mention from infra guidance. |
| docs/environment-variables.md | Removes METRICS_PER_HOUR from quick reference and deletes its detailed section. |
| apps/backend/src/metrics/utils/time-window-parser.ts | Deleted legacy metrics time-window parsing utility. |
| apps/backend/src/metrics/utils/time-window-parser.test.ts | Deleted tests for the removed time-window parser. |
| apps/backend/src/metrics/services/network-stats.service.ts | Deleted legacy metrics network stats service. |
| apps/backend/src/metrics/services/metrics-scheduler.service.ts | Deleted legacy metrics scheduler/aggregation service. |
| apps/backend/src/metrics/services/failed-retrievals.service.ts | Deleted legacy failed retrievals metrics service. |
| apps/backend/src/metrics/services/failed-deals.service.ts | Deleted legacy failed deals metrics service. |
| apps/backend/src/metrics/services/daily-metrics.service.ts | Deleted legacy daily metrics query/aggregation service. |
| apps/backend/src/metrics/metrics.module.ts | Deleted legacy metrics API module wiring. |
| apps/backend/src/metrics/metrics-worker.module.ts | Deleted legacy metrics worker-only module wiring. |
| apps/backend/src/metrics/dto/provider-performance.dto.ts | Deleted legacy metrics DTOs (provider performance). |
| apps/backend/src/metrics/dto/network-stats.dto.ts | Deleted legacy metrics DTOs (network stats). |
| apps/backend/src/metrics/dto/failed-retrievals.dto.ts | Deleted legacy metrics DTOs (failed retrievals). |
| apps/backend/src/metrics/dto/failed-deals.dto.ts | Deleted legacy metrics DTOs (failed deals). |
| apps/backend/src/metrics/dto/daily-metrics.dto.ts | Deleted legacy metrics DTOs (daily metrics/service comparison). |
| apps/backend/src/metrics/controllers/network-stats.controller.ts | Deleted legacy metrics REST endpoint. |
| apps/backend/src/metrics/controllers/failed-retrievals.controller.ts | Deleted legacy metrics REST endpoint. |
| apps/backend/src/metrics/controllers/failed-deals.controller.ts | Deleted legacy metrics REST endpoint. |
| apps/backend/src/metrics/controllers/daily-metrics.controller.ts | Deleted legacy metrics REST endpoint. |
| apps/backend/src/jobs/repositories/job-schedule.repository.ts | Removes metrics queue mapping from pg-boss state/age queries. |
| apps/backend/src/jobs/jobs.service.ts | Removes metrics queues/workers/schedules; adds legacy job-type skip logic; removes metrics rate config usage. |
| apps/backend/src/jobs/jobs.service.spec.ts | Updates tests for removed metrics queues/handlers and adjusted constructor arg positions. |
| apps/backend/src/jobs/jobs.module.ts | Removes metrics module imports/wiring from JobsModule. |
| apps/backend/src/jobs/job-queues.ts | Removes METRICS_QUEUE / METRICS_CLEANUP_QUEUE constants. |
| apps/backend/src/database/entities/job-schedule-state.entity.ts | Keeps legacy metrics / metrics_cleanup in JobType union for existing DB rows. |
| apps/backend/src/config/app.config.ts | Removes METRICS_PER_HOUR from validation schema and config loading/types. |
| apps/backend/src/app.module.ts | Removes MetricsModule import/registration. |
| apps/backend/README.md | Removes METRICS_PER_HOUR from documented env var table. |
| apps/backend/.env.example | Removes METRICS_PER_HOUR from example env file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
677ad99 to
9718e27
Compare
9718e27 to
4b09b3d
Compare
Collaborator
|
Changes from this pr merged into |
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.
Summary
Removes the legacy metrics REST API layer and NestJS module wiring, completing steps 6 and 8 of #275. This PR builds on top of #436 which removed the pg-boss job scheduling (steps 4 & 5).
Changes
Deleted —
src/metrics/(entire directory)daily-metrics,failed-deals,failed-retrievals,network-statsdaily-metrics,failed-deals,failed-retrievals,network-stats,metrics-schedulerdaily-metrics,failed-deals,failed-retrievals,network-stats,provider-performancetime-window-parser+ its test suitemetrics.module.ts,metrics-worker.module.tsModified
app.module.ts— RemovedMetricsModuleimport and registrationNot touched (deferred to step 9)
metrics-daily.entity.ts,sp-performance-*.entity.ts) anddatabase.module.tsregistrations are intentionally kept until the DB migration that drops the underlying tables.Step 7 (frontend) — No-op
The web client has zero API calls to
/api/v1/metrics/*. The word "metrics" only appears in UI copy. Nothing to delete.Verification
pnpm typecheck✅pnpm test✅ (21 files, 249 tests)pnpm check:ci✅