Skip to content
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

Overhaul stats: Refactor HTTP metrics #1342

Closed
josecelano opened this issue Mar 3, 2025 · 0 comments · Fixed by #1363
Closed

Overhaul stats: Refactor HTTP metrics #1342

josecelano opened this issue Mar 3, 2025 · 0 comments · Fixed by #1363
Assignees
Labels
- Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat

Comments

@josecelano
Copy link
Member

There are a couple of comments like this:

/// > **NOTICE**: as the HTTP tracker does not requires a connection request
/// > like the UDP tracker, the number of TCP connections is incremented for
/// > each `announce` request.

The HTTP tracker core keeps a counter for the number of connections handled. However that metrics does not make sense. Internally the counter is the number of announce requests plus the number of scrape requests.

pub struct Metrics {
    /// Total number of TCP (HTTP tracker) connections from IPv4 peers.
    /// Since the HTTP tracker spec does not require a handshake, this metric
    /// increases for every HTTP request.
    pub tcp4_connections_handled: u64,

    /// Total number of TCP (HTTP tracker) `announce` requests from IPv4 peers.
    pub tcp4_announces_handled: u64,

    /// Total number of TCP (HTTP tracker) `scrape` requests from IPv4 peers.
    pub tcp4_scrapes_handled: u64,

    /// Total number of TCP (HTTP tracker) connections from IPv6 peers.
    pub tcp6_connections_handled: u64,

    /// Total number of TCP (HTTP tracker) `announce` requests from IPv6 peers.
    pub tcp6_announces_handled: u64,

    /// Total number of TCP (HTTP tracker) `scrape` requests from IPv6 peers.
    pub tcp6_scrapes_handled: u64,
}

I think it would make sense to delete those counters and add new counter to the axum-http-tracker-server package:

  • tcp4_requests
  • tcp6_requests

The udp-tracker-server has those metrics and also:

  • tcp4_responses
  • tcp6_responses
@josecelano josecelano added - Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat labels Mar 3, 2025
@josecelano josecelano self-assigned this Mar 7, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 7, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
The number of HTTP tracker connections don't make sense. There are
connection requests only in the UDP tracker.

That code is removed but, in order to keep backward compatibility, the
API still exposes that value which is the:

number of announce requests + number of scrape requests
@josecelano josecelano linked a pull request Mar 7, 2025 that will close this issue
josecelano added a commit that referenced this issue Mar 7, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
89607cc refactor: [#1342] remove counter for HTTP connetions internally (Jose Celano)

Pull request description:

  The number of HTTP tracker connections don't make sense. There are connection requests only in the UDP tracker.

  That code is removed but, in order to keep backward compatibility, the API still exposes that value which is the:

  number of announce requests + number of scrape requests

ACKs for top commit:
  josecelano:
    ACK 89607cc

Tree-SHA512: 066132e56f5e7e14050d78a15981c07f79acfe0b11903da35f15ca4214d16873799479f0aa98bb767eb23b496988e808d3f1ab1544b78ab072393711f28598b7
@josecelano josecelano changed the title Overhaul stats events: Refactor HTTP metrics Overhaul stats: Refactor HTTP metrics Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant