Skip to content

refactor(metrics): rename crate from torrust-tracker-metrics to torrust-metrics#1820

Merged
josecelano merged 4 commits into
torrust:developfrom
josecelano:1819-rename-torrust-tracker-metrics-to-torrust-metrics
May 21, 2026
Merged

refactor(metrics): rename crate from torrust-tracker-metrics to torrust-metrics#1820
josecelano merged 4 commits into
torrust:developfrom
josecelano:1819-rename-torrust-tracker-metrics-to-torrust-metrics

Conversation

@josecelano
Copy link
Copy Markdown
Member

Closes #1819. Subissue SI-08 of EPIC #1669.

Summary

Rename the Cargo crate torrust-tracker-metrics to torrust-metrics to reflect that it is
a generic Prometheus metrics integration reusable outside the tracker.

The crate is not published on crates.io, so no migration window is needed.

Changes

  • packages/metrics/Cargo.toml: name changed to torrust-metrics.
  • 7 dependent Cargo.toml files: dependency key updated to torrust-metrics.
  • 34+ Rust source files: all torrust_tracker_metrics:: references updated to torrust_metrics::.
  • packages/metrics/README.md: title, description, use statements, docs.rs links, and coverage commands updated.
  • AGENTS.md: Package Catalog row updated.
  • docs/issues/open/1669-overhaul-packages/EPIC.md: Package Inventory and Desired Package State tables updated; SI-08 marked DONE.

Verification

  • cargo build --workspace — ✅
  • cargo test --tests --workspace --all-targets --all-features — ✅
  • linter all — ✅
  • cargo test --doc --workspace — ✅

Move spec from drafts to open with issue number torrust#1819 prefix.
Update EPIC torrust#1669 SI-08 to reference the new GitHub issue.
…rrust-metrics`

Closes torrust#1819. Subissue SI-08 of EPIC torrust#1669.

- Rename `name` in `packages/metrics/Cargo.toml` to `torrust-metrics`.
- Update dependency key in 7 dependent `Cargo.toml` files.
- Update all Rust source `torrust_tracker_metrics::` references to `torrust_metrics::`.
- Update prose in `AGENTS.md` and `packages/metrics/README.md` to remove tracker-specific framing.
- Update EPIC torrust#1669 Package Inventory and Desired Package State tables; mark SI-08 DONE.
Copilot AI review requested due to automatic review settings May 21, 2026 12:19
@josecelano josecelano self-assigned this May 21, 2026
Copy link
Copy Markdown

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

This PR renames the internal metrics crate from torrust-tracker-metrics to torrust-metrics to reflect that it is intended to be reusable beyond the tracker, and updates workspace dependencies, Rust imports, and related documentation accordingly.

Changes:

  • Renamed the crate in packages/metrics/Cargo.toml and updated dependent Cargo.toml dependency keys.
  • Updated Rust source imports/usages from torrust_tracker_metrics::… to torrust_metrics::… across core, servers, and tests.
  • Updated project documentation (README/specs/EPIC/package catalog) to reference the new crate name.

Reviewed changes

Copilot reviewed 47 out of 48 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/udp-tracker-server/src/statistics/repository.rs Updates metrics crate imports in UDP server statistics repository + tests.
packages/udp-tracker-server/src/statistics/mod.rs Switches metric description/unit imports to torrust_metrics.
packages/udp-tracker-server/src/statistics/metrics.rs Switches metrics collection/aggregation imports to torrust_metrics.
packages/udp-tracker-server/src/statistics/event/handler/response_sent.rs Updates metrics label/metric macro imports for response-sent handler.
packages/udp-tracker-server/src/statistics/event/handler/request_received.rs Updates metrics imports for request-received handler.
packages/udp-tracker-server/src/statistics/event/handler/request_banned.rs Updates metrics imports for request-banned handler.
packages/udp-tracker-server/src/statistics/event/handler/request_accepted.rs Updates metrics imports for request-accepted handler.
packages/udp-tracker-server/src/statistics/event/handler/request_aborted.rs Updates metrics imports for request-aborted handler.
packages/udp-tracker-server/src/statistics/event/handler/error.rs Updates metrics imports for error handler.
packages/udp-tracker-server/src/event.rs Updates label types import used by UDP server events.
packages/udp-tracker-server/src/banning/event/handler.rs Updates metrics imports used by banning handler.
packages/udp-tracker-server/Cargo.toml Renames dependency key to torrust-metrics.
packages/udp-tracker-core/src/statistics/repository.rs Updates metrics crate imports in UDP core statistics repository.
packages/udp-tracker-core/src/statistics/mod.rs Switches metric description/unit imports to torrust_metrics.
packages/udp-tracker-core/src/statistics/metrics.rs Switches metrics collection/aggregation imports to torrust_metrics.
packages/udp-tracker-core/src/statistics/event/handler.rs Updates metrics label/macro imports in UDP core stats event handler.
packages/udp-tracker-core/src/event.rs Updates label types import used by UDP core events.
packages/udp-tracker-core/Cargo.toml Renames dependency key to torrust-metrics.
packages/tracker-core/tests/common/test_env.rs Updates metrics imports used by tracker-core tests.
packages/tracker-core/src/statistics/repository.rs Updates repository metrics imports to torrust_metrics.
packages/tracker-core/src/statistics/persisted/mod.rs Updates persisted metrics module imports to torrust_metrics.
packages/tracker-core/src/statistics/mod.rs Switches metric description/unit imports to torrust_metrics.
packages/tracker-core/src/statistics/metrics.rs Switches MetricCollection imports to torrust_metrics.
packages/tracker-core/src/statistics/event/handler.rs Updates metrics imports in stats event handler.
packages/tracker-core/Cargo.toml Renames dependency key to torrust-metrics.
packages/swarm-coordination-registry/src/statistics/repository.rs Updates metrics crate imports in swarm coordination registry stats repo.
packages/swarm-coordination-registry/src/statistics/mod.rs Switches metric description/unit imports to torrust_metrics.
packages/swarm-coordination-registry/src/statistics/metrics.rs Switches MetricCollection imports to torrust_metrics.
packages/swarm-coordination-registry/src/statistics/event/handler.rs Updates metrics imports and one fully-qualified error type reference.
packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs Updates metrics imports used by activity updater task.
packages/swarm-coordination-registry/Cargo.toml Renames dependency key to torrust-metrics.
packages/rest-tracker-api-core/src/statistics/services.rs Updates MetricCollection import to torrust_metrics.
packages/rest-tracker-api-core/Cargo.toml Renames dependency key to torrust-metrics.
packages/http-tracker-core/src/statistics/repository.rs Updates metrics crate imports in HTTP core statistics repository.
packages/http-tracker-core/src/statistics/mod.rs Switches metric description/unit imports to torrust_metrics.
packages/http-tracker-core/src/statistics/metrics.rs Switches metrics collection/aggregation imports to torrust_metrics.
packages/http-tracker-core/src/statistics/event/handler.rs Updates metrics label/macro imports in HTTP core stats handler.
packages/http-tracker-core/src/event.rs Updates label types import used by HTTP core events.
packages/http-tracker-core/Cargo.toml Renames dependency key to torrust-metrics.
packages/axum-rest-tracker-api-server/src/v1/context/stats/responses.rs Updates Prometheus serialization import to torrust_metrics.
packages/axum-rest-tracker-api-server/src/v1/context/stats/resources.rs Updates MetricCollection import to torrust_metrics.
packages/axum-rest-tracker-api-server/Cargo.toml Renames dependency key to torrust-metrics.
packages/metrics/Cargo.toml Renames the metrics crate package name to torrust-metrics.
packages/metrics/README.md Updates crate name, import paths, docs links, and coverage commands.
docs/issues/open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md Updates spec metadata and marks implementation tasks/AC as done.
docs/issues/open/1669-overhaul-packages/EPIC.md Updates package inventory/state tables and marks SI-08 done with #1819.
AGENTS.md Updates package catalog entry to new crate name.
Cargo.lock Replaces lockfile package entry from torrust-tracker-metrics to torrust-metrics.
Comments suppressed due to low confidence (2)

packages/metrics/README.md:35

  • The usage example pulls DurationSinceUnixEpoch from torrust_tracker_primitives, which is a deprecated re-export (and also undermines the claim that this crate is tracker-agnostic). Prefer importing DurationSinceUnixEpoch from torrust_tracker_clock (or using std::time::Duration if appropriate) in the README example.
use torrust_metrics::{
    metric_collection::MetricCollection,
    label::{LabelSet, LabelValue},
    metric_name, label_name,
};

docs/issues/open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md:12

  • last-updated-utc hasn’t been updated even though this spec now includes new 2026-05-21 progress log entries and metadata changes. Please bump last-updated-utc to reflect the latest modification timestamp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/metrics/Cargo.toml Outdated
Comment thread packages/metrics/README.md
- Update description field to accurately reflect Prometheus metrics purpose.
- Add note that crate is not yet published on crates.io and show path dependency.
@josecelano
Copy link
Copy Markdown
Member Author

ACK 75e57b3

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.70%. Comparing base (f8d3b65) to head (75e57b3).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1820      +/-   ##
===========================================
+ Coverage    77.68%   77.70%   +0.01%     
===========================================
  Files          379      379              
  Lines        28605    28605              
  Branches     28605    28605              
===========================================
+ Hits         22223    22228       +5     
+ Misses        6073     6066       -7     
- Partials       309      311       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano josecelano merged commit 4918ca6 into torrust:develop May 21, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename torrust-tracker-metrics to torrust-metrics

2 participants