Overhaul stats: Refactor metrics in Prometheus format#1443
Merged
josecelano merged 3 commits intoApr 11, 2025
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1443 +/- ##
===========================================
- Coverage 84.54% 84.51% -0.03%
===========================================
Files 254 254
Lines 19189 19157 -32
Branches 19189 19157 -32
===========================================
- Hits 16223 16191 -32
Misses 2694 2694
Partials 272 272 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Extract `request_kind` label. Putting the request type in the metric name does not make sense. The purpose of the refactor to build the new extendable-labeled metrics was to start using labels to group metrics instead of changes in metric's names.
From this:
```
udp_tracker_core_announce_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 619656
udp_tracker_core_connect_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 308493
udp_tracker_core_scrape_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 32487
```
To this:
```
udp_tracker_core_requests_received_total{request_kind="announce",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 619656
udp_tracker_core_requests_received_total{request_kind="connect",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 308493
udp_tracker_core_requests_received_total{request_kind="scrape",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 32487
```
Extract `request_kind` label. Putting the request type in the metric name does not make sense. The purpose of the refactor to build the new extendable-labeled metrics was to start using labels to group metrics instead of changes in metric's names.
From this:
```
http_tracker_core_announce_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="7070",server_binding_protocol="http"} 1
http_tracker_core_scrape_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="7070",server_binding_protocol="http"} 1
```
To this:
```
http_tracker_core_requests_received_total{request_kind="announce",server_binding_ip="0.0.0.0",server_binding_port="7070",server_binding_protocol="http"} 1
http_tracker_core_requests_received_total{request_kind="scrape", server_binding_ip="0.0.0.0",server_binding_port="7070",server_binding_protocol="http"} 1
```
- Rename label `kind` to `request_kind`. It's more explicit. There could be other "kind" of things in the future.
- Remove the empty label `kind=""` when the response is an error.
- Fix result label for error response.
- Merge performace metrics in one and convert request kind into a label:
```
udp_tracker_server_performance_avg_connect_processing_time_ns{request_kind="connect"}
udp_tracker_server_performance_avg_connect_processing_time_ns{request_kind="announce"}
udp_tracker_server_performance_avg_connect_processing_time_ns{request_kind="scrape"}
```
19d7d06 to
5f57f78
Compare
Member
Author
|
ACK 5f57f78 |
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.
Some fixes for the UDP metrics.
The new version is:
You get those metrics running the tracker and the following command:
Metrics explained: