Skip to content

Rename torrust-tracker-metrics to torrust-metrics #1819

Description

@josecelano

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 name field in packages/metrics/Cargo.toml.
  • Update all Cargo.toml files in the workspace that reference torrust-tracker-metrics as a dependency (root Cargo.toml + all dependent packages).
  • Update all Rust source files that use the crate by its underscore-converted identifier (torrust_tracker_metrics::) to use torrust_metrics::.
  • Update prose references in packages/AGENTS.md, AGENTS.md, docs/packages.md, and the metrics package README.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.toml
  • packages/http-tracker-core/Cargo.toml
  • packages/rest-tracker-api-core/Cargo.toml
  • packages/swarm-coordination-registry/Cargo.toml
  • packages/tracker-core/Cargo.toml
  • packages/udp-tracker-core/Cargo.toml
  • packages/udp-tracker-server/Cargo.toml

Acceptance Criteria

  • packages/metrics/Cargo.toml declares name = "torrust-metrics".
  • No Cargo.toml file in the workspace references torrust-tracker-metrics.
  • No Rust source file in the workspace uses torrust_tracker_metrics::.
  • cargo build --workspace succeeds with zero errors.
  • cargo test --workspace passes with zero failures.
  • linter all exits with code 0.
  • packages/AGENTS.md, AGENTS.md, docs/packages.md, and packages/metrics/README.md reflect the new crate name.
  • EPIC Overhaul: Packages #1669 Desired Package State table lists torrust-metrics in the torrust- section.

Related to #1669

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions