Skip to content

refactor: remove legacy metrics API endpoints and module wiring#441

Closed
Chaitu-Tatipamula wants to merge 1 commit intoFilOzone:refactor/cleanup-metrics-jobsfrom
Chaitu-Tatipamula:refactor/remove-metrics-endpoints
Closed

refactor: remove legacy metrics API endpoints and module wiring#441
Chaitu-Tatipamula wants to merge 1 commit intoFilOzone:refactor/cleanup-metrics-jobsfrom
Chaitu-Tatipamula:refactor/remove-metrics-endpoints

Conversation

@Chaitu-Tatipamula
Copy link
Copy Markdown
Collaborator

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)

  • Controllers: daily-metrics, failed-deals, failed-retrievals, network-stats
  • Services: daily-metrics, failed-deals, failed-retrievals, network-stats, metrics-scheduler
  • DTOs: daily-metrics, failed-deals, failed-retrievals, network-stats, provider-performance
  • Utils: time-window-parser + its test suite
  • Modules: metrics.module.ts, metrics-worker.module.ts

Modified

  • app.module.ts — Removed MetricsModule import and registration

Not touched (deferred to step 9)

  • Entity files (metrics-daily.entity.ts, sp-performance-*.entity.ts) and database.module.ts registrations 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_HOUR configuration.
  • 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.

Comment thread apps/backend/src/jobs/jobs.service.ts
Comment thread docs/jobs.md
Comment thread docs/infra.md
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting review in FOC Apr 12, 2026
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the refactor/remove-metrics-endpoints branch from 677ad99 to 9718e27 Compare April 14, 2026 06:22
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the refactor/remove-metrics-endpoints branch from 9718e27 to 4b09b3d Compare April 14, 2026 07:20
Copy link
Copy Markdown
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Apr 14, 2026
@silent-cipher silent-cipher changed the base branch from main to refactor/cleanup-metrics-jobs April 17, 2026 18:58
@silent-cipher
Copy link
Copy Markdown
Collaborator

Changes from this pr merged into refactor/cleanup-metrics-jobs branch. See 492a785

@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

5 participants