refactor: move check-metric helpers from metrics/ to metrics-prometheus/#398
Merged
silent-cipher merged 1 commit intoFilOzone:mainfrom Apr 2, 2026
Merged
Conversation
…metheus move check-metrics.service.ts and check-metric-labels.ts to metrics-prometheus/ and update all imports across deal/, retrieval/, data-retention/, deal-addons/, and metrics-prometheus.module.ts.
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the backend metrics code by relocating shared “check-metric” helpers into metrics-prometheus/ so non-legacy consumers (deal/retrieval/addons/data-retention) can keep using them as the legacy metrics/ module is phased out.
Changes:
- Moved
check-metrics.service.tsandcheck-metric-labels.tsintosrc/metrics-prometheus/. - Updated all import paths in runtime code and tests to reference the new locations.
- Removed the old helper copies from
metrics/utils/.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apps/backend/src/retrieval/retrieval.service.ts | Updates check-metric helper imports to the new metrics-prometheus/ location. |
| apps/backend/src/retrieval/retrieval.service.spec.ts | Updates test imports for moved check-metric helpers. |
| apps/backend/src/metrics-prometheus/metrics-prometheus.module.ts | Switches module import to the colocated check-metrics.service. |
| apps/backend/src/metrics-prometheus/check-metrics.service.ts | Adjusts internal relative imports after the file move. |
| apps/backend/src/metrics-prometheus/check-metric-labels.ts | Adds the relocated check-metric label helpers in the new directory. |
| apps/backend/src/deal/deal.service.ts | Updates check-metric helper imports to metrics-prometheus/. |
| apps/backend/src/deal/deal.service.spec.ts | Updates test imports for moved check-metric helpers. |
| apps/backend/src/deal-addons/strategies/ipni.strategy.ts | Updates check-metric helper imports to metrics-prometheus/. |
| apps/backend/src/deal-addons/strategies/ipni.strategy.spec.ts | Updates test imports for moved check-metric helpers. |
| apps/backend/src/data-retention/data-retention.service.ts | Updates check-metric label helper imports to metrics-prometheus/. |
| apps/backend/src/data-retention/data-retention.service.spec.ts | Updates test imports for moved check-metric label helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
silent-cipher
approved these changes
Mar 27, 2026
Collaborator
silent-cipher
left a comment
There was a problem hiding this comment.
LGTM! Migration looks complete.
Contributor
|
@silent-cipher : will you handle merging? |
Collaborator
|
Yes, I'll handle the merging |
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
Moves
check-metrics.service.tsandcheck-metric-labels.tsout ofmetrics/utils/intometrics-prometheus/, creating a neutral home for these shared helpers so they survive the upcoming metrics module removal.No behavior change — this is a pure import path update.
What changed
check-metrics.service.tsandcheck-metric-labels.ts→src/metrics-prometheus/deal/deal.service.ts+ specretrieval/retrieval.service.ts+ specdata-retention/data-retention.service.ts+ specdeal-addons/strategies/ipni.strategy.ts+ specmetrics-prometheus/metrics-prometheus.module.tsmetrics/utils/Why
These helpers (
buildCheckMetricLabels,DataStorageCheckMetrics,RetrievalCheckMetrics, etc.) are used bydeal/,retrieval/, anddeal-addons/— none of which depend on the legacy metrics module. Moving them now means we can safely deletemetrics/in later PRs without breaking these consumers.Testing
pnpm typecheck✅pnpm test— 21 test files, 271 tests passed ✅Part of #275
This is step 1 of the metrics cleanup plan.