Skip to content

Overhaul stats: Refactor metrics (part 1)#1467

Merged
josecelano merged 12 commits into
torrust:developfrom
josecelano:1445-overhaul-stats-refactor-metrics-part-1
Apr 21, 2025
Merged

Overhaul stats: Refactor metrics (part 1)#1467
josecelano merged 12 commits into
torrust:developfrom
josecelano:1445-overhaul-stats-refactor-metrics-part-1

Conversation

@josecelano
Copy link
Copy Markdown
Member

@josecelano josecelano commented Apr 15, 2025

Refactor metrics (part 1)

Subtasks

  • Extract macro for metric name constructor (to fail at compilation time with empty names)
  • Replace metric name constructor by new macro
  • Extract macro for label name constructor (to fail at compilation time with empty names)
  • Replace label name constructor by new macro
  • Return an optional in get_counter_value and get_gauge_value.
  • Return errors instead of panicking in the MetricCollection struct.
  • Add logs to the listener's initialization (when it starts and finishes).
  • Add req kind label to the number of errors metric.
  • Add tracing crate.

@josecelano josecelano self-assigned this Apr 15, 2025
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label Apr 15, 2025
@josecelano josecelano linked an issue Apr 15, 2025 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 90.04149% with 48 lines in your changes missing coverage. Please review.

Project coverage is 84.41%. Comparing base (b061357) to head (f9ad729).
Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
packages/metrics/src/metric_collection.rs 95.45% 4 Missing and 5 partials ⚠️
...udp-tracker-server/src/statistics/event/handler.rs 84.74% 9 Missing ⚠️
...ckages/http-tracker-core/src/statistics/metrics.rs 46.66% 8 Missing ⚠️
...ackages/udp-tracker-core/src/statistics/metrics.rs 46.66% 8 Missing ⚠️
packages/metrics/src/label/value.rs 0.00% 3 Missing ⚠️
...s/udp-tracker-core/src/statistics/event/handler.rs 85.71% 3 Missing ⚠️
.../http-tracker-core/src/statistics/event/handler.rs 85.71% 2 Missing ⚠️
...ackages/http-tracker-core/src/statistics/keeper.rs 60.00% 0 Missing and 2 partials ⚠️
packages/udp-tracker-core/src/statistics/keeper.rs 60.00% 0 Missing and 2 partials ⚠️
...ckages/udp-tracker-server/src/statistics/keeper.rs 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1467      +/-   ##
===========================================
- Coverage    84.66%   84.41%   -0.26%     
===========================================
  Files          254      254              
  Lines        19160    19337     +177     
  Branches     19160    19337     +177     
===========================================
+ Hits         16222    16323     +101     
- Misses        2675     2737      +62     
- Partials       263      277      +14     

☔ 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 requested a review from da2ce7 April 15, 2025 11:20
@josecelano josecelano marked this pull request as ready for review April 21, 2025 09:49
@josecelano
Copy link
Copy Markdown
Member Author

ACK f9ad729

@josecelano josecelano merged commit 7e94075 into torrust:develop Apr 21, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Cleanup / Refactoring Tidying and Making Neat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overhaul stats: Refactor metrics (part 1)

1 participant