Skip to content

API: add support for Prometheus text format on stats API endpoint#1127

Merged
josecelano merged 1 commit intotorrust:developfrom
josecelano:1126-api-add-a-new-endpoint-to-export-metrics-in-prometheus-format
Dec 11, 2024
Merged

API: add support for Prometheus text format on stats API endpoint#1127
josecelano merged 1 commit intotorrust:developfrom
josecelano:1126-api-add-a-new-endpoint-to-export-metrics-in-prometheus-format

Conversation

@josecelano
Copy link
Copy Markdown
Member

@josecelano josecelano commented Dec 10, 2024

It adds support for Prometheus text format on the stats API endpoint:

http://127.0.0.1:1212/api/v1/stats?token=MyAccessToken&format=prometheus

torrents 0
seeders 0
completed 0
leechers 0
tcp4_connections_handled 0
tcp4_announces_handled 0
tcp4_scrapes_handled 0
tcp6_connections_handled 0
tcp6_announces_handled 0
tcp6_scrapes_handled 0
udp4_connections_handled 0
udp4_announces_handled 0
udp4_scrapes_handled 0
udp4_errors_handled 0
udp6_connections_handled 0
udp6_announces_handled 0
udp6_scrapes_handled 0
udp6_errors_handled 0

Needed to implement this: torrust/torrust-demo#20

…API endpoint

http://127.0.0.1:1212/api/v1/stats?token=MyAccessToken&format=prometheus

```text
torrents 0
seeders 0
completed 0
leechers 0
tcp4_connections_handled 0
tcp4_announces_handled 0
tcp4_scrapes_handled 0
tcp6_connections_handled 0
tcp6_announces_handled 0
tcp6_scrapes_handled 0
udp4_connections_handled 0
udp4_announces_handled 0
udp4_scrapes_handled 0
udp4_errors_handled 0
udp6_connections_handled 0
udp6_announces_handled 0
udp6_scrapes_handled 0
udp6_errors_handled 0
```
@josecelano josecelano force-pushed the 1126-api-add-a-new-endpoint-to-export-metrics-in-prometheus-format branch from ff0fafc to 52d3505 Compare December 10, 2024 18:34
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 8.53659% with 75 lines in your changes missing coverage. Please review.

Project coverage is 75.65%. Comparing base (b0af435) to head (52d3505).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/servers/apis/v1/context/stats/responses.rs 4.10% 70 Missing ⚠️
src/servers/apis/v1/context/stats/handlers.rs 44.44% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1127      +/-   ##
===========================================
- Coverage    76.21%   75.65%   -0.56%     
===========================================
  Files          173      173              
  Lines        11347    11425      +78     
  Branches     11347    11425      +78     
===========================================
- Hits          8648     8644       -4     
- Misses        2502     2581      +79     
- Partials       197      200       +3     

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

@josecelano josecelano marked this pull request as ready for review December 10, 2024 19:44
@josecelano
Copy link
Copy Markdown
Member Author

ACK 52d3505

@josecelano josecelano merged commit d8b6123 into torrust:develop Dec 11, 2024
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.

API: add a new endpoint to export metrics in Prometheus format

1 participant