-
Notifications
You must be signed in to change notification settings - Fork 49
Overhaul stats: add TYPE and HELP to Prometheus export
#1559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
josecelano
merged 12 commits into
torrust:develop
from
josecelano:1514-overhaul-stats-add-type-and-help-to-prometheus-export
Jun 6, 2025
Merged
Overhaul stats: add TYPE and HELP to Prometheus export
#1559
josecelano
merged 12 commits into
torrust:develop
from
josecelano:1514-overhaul-stats-add-type-and-help-to-prometheus-export
Jun 6, 2025
Conversation
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
"kind" has been renamed to "type" to follow Prometheus name.
```json
{
"type": "counter",
"name": "http_tracker_core_requests_received_total",
"samples": []
}
```
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1559 +/- ##
===========================================
+ Coverage 83.40% 83.95% +0.55%
===========================================
Files 282 282
Lines 19868 20250 +382
Branches 19868 20250 +382
===========================================
+ Hits 16570 17001 +431
+ Misses 3003 2954 -49
Partials 295 295 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…e metric This will allow to inject also the metric unit and description.
It's also shown in the JSON export format.
```json
{
"metrics": [
{
"type": "counter",
"name": "torrent_repository_torrents_downloads_total",
"unit": "count",
"description": "The total number of torrent downloads.",
"samples": []
}
}
```
todo: show them in the Prometheus export format.
Member
Author
…c name
Format for each metric sample:
<metric_name>{label_set} <value>
Exmaple:
```
udp_tracker_server_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6868",server_binding_protocol="udp"} 36661
```
See https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information
…e same metrin name It was not possible to merge counters or gauges if the metric names was duplicate but possible when the metric name was duplciate across types. For example, the target collection (the one is mutated) contains a counter with a name that is being used in the source collection (the wan we get metric from) for a gauge metric.
Member
Author
Member
Author
|
ACK bb2392d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.


Add metadata describing the metric to the Prometheus export format. For example:
Subtasks
kindJSON field totypeto use the same name in JSON and Prometheus export formats.ensure_metric_existsto pass the whole metric, not only the name.opt_unit: Option<Unit>andopt_description: Option<&MetricDescription>toMetric<T>description).TYPE) and description (HELP).