Repository navigation
Description
Goal
Rename the Cargo crate torrust-tracker-metrics to torrust-metrics to reflect that it is a generic Prometheus metrics integration that can be used by any Rust project, not only the tracker.
Background
The metrics package (folder packages/metrics) provides Prometheus metrics support. It contains no tracker-specific domain logic and its usefulness extends beyond this repository — for example, torrust-index could benefit from the same metrics infrastructure rather than reinventing it.
The torrust-tracker- prefix implies a tracker-only scope that does not reflect the crate's actual purpose. The rename:
- Makes the crate identity match its scope.
- Signals to downstream users that it is reusable outside the tracker.
- Prepares it for potential extraction to a standalone repository in a future cycle (see the SI-14 subissue of EPIC Overhaul: Packages #1669).
The current crate name torrust-tracker-metrics is not published on crates.io (as of May 2026), so the rename does not require handling a previously published name.
This issue is a subissue of EPIC #1669 (Overhaul: Packages), SI-08.
Scope
In Scope
- Rename the crate
namefield inpackages/metrics/Cargo.toml. - Update all
Cargo.tomlfiles in the workspace that referencetorrust-tracker-metricsas a dependency (rootCargo.toml+ all dependent packages). - Update all Rust source files that use the crate by its underscore-converted identifier (
torrust_tracker_metrics::) to usetorrust_metrics::. - Update prose references in
packages/AGENTS.md,AGENTS.md,docs/packages.md, and themetricspackageREADME.md. - Verify the workspace builds and all tests pass.
Out of Scope
- Moving the crate to a separate repository (see SI-14).
- Changes to the crate's API or behaviour.
- Publishing the crate on crates.io.
- Updating downstream repositories.
Implementation Plan
| ID | Task | Notes / Expected Output |
|---|---|---|
| T1 | Rename name in packages/metrics/Cargo.toml |
name = "torrust-metrics" |
| T2 | Update root Cargo.toml workspace dependency key |
torrust-metrics = { version = ..., path = "packages/metrics" } |
| T3 | Update all dependent package Cargo.toml files (7 packages) |
Replace torrust-tracker-metrics key with torrust-metrics |
| T4 | Update Rust source use / path references (torrust_tracker_metrics:: → torrust_metrics::) |
Affects package sources and integration tests |
| T5 | Update prose in packages/AGENTS.md, AGENTS.md, docs/packages.md, packages/metrics/README.md |
Crate name and any inline code snippets |
| T6 | Run cargo build --workspace and cargo test --workspace |
Clean build and all tests pass |
| T7 | Run linter all |
Exit code 0 |
| T8 | Update EPIC #1669 Package Inventory and Desired Package State tables |
Move torrust-metrics to torrust- section; drop Renamed from note |
Dependent packages to update in T3 (7 files):
packages/axum-rest-tracker-api-server/Cargo.tomlpackages/http-tracker-core/Cargo.tomlpackages/rest-tracker-api-core/Cargo.tomlpackages/swarm-coordination-registry/Cargo.tomlpackages/tracker-core/Cargo.tomlpackages/udp-tracker-core/Cargo.tomlpackages/udp-tracker-server/Cargo.toml
Acceptance Criteria
-
packages/metrics/Cargo.tomldeclaresname = "torrust-metrics". - No
Cargo.tomlfile in the workspace referencestorrust-tracker-metrics. - No Rust source file in the workspace uses
torrust_tracker_metrics::. -
cargo build --workspacesucceeds with zero errors. -
cargo test --workspacepasses with zero failures. -
linter allexits with code0. -
packages/AGENTS.md,AGENTS.md,docs/packages.md, andpackages/metrics/README.mdreflect the new crate name. - EPIC Overhaul: Packages #1669
Desired Package Statetable liststorrust-metricsin thetorrust-section.
Related to #1669
Activity
docs(issues): add issue specification for #1819
Merge #1820: refactor(metrics): rename crate from `torrust-tracker-me…
chore(issues): update frontmatter status and spec-path in archived sp…
chore(issues): archive closed issue specs #1816, #1819, #1821, #1823 …
Merge #1825: chore(issues): archive closed issue specs #1816, #1819, #…
refactor(metrics): rename crate from `torrust-tracker-metrics` to `to…
docs(issues): [#2576] add issue specification for updating all packag…
Merge #2577: docs(issues): [#2576] add issue specification for updati…