Repository navigation
Closed
Labels
BugIncorrect Behavior
Description
I've deployed the new metrics to the Torrust Demo tracker.
We are emitting metrics from the:
- UDP Tracker Cerver
- UDP Tracker Core
Some metrics should have the same value. For example, the number of announce requests received. However, they don't match:
UDP tracker Core
udp_tracker_core_connect_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6868",server_binding_protocol="udp"} 1414
udp_tracker_core_announce_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 9855098
udp_tracker_core_connect_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 3085603
udp_tracker_core_scrape_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 377400
UDP Tracker Server
udp_tracker_server_requests_received_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 66
udp_tracker_server_requests_banned_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 1
udp_tracker_server_requests_accepted_total{kind="announce",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 32
udp_tracker_server_requests_accepted_total{kind="connect",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 19
udp_tracker_server_responses_sent_total{kind="",result="ok",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 32
udp_tracker_server_responses_sent_total{kind="connect",result="ok",server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 19
udp_tracker_server_errors_total{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 32
udp_tracker_server_performance_avg_connect_processing_time_ns{server_binding_ip="0.0.0.0",server_binding_port="6969",server_binding_protocol="udp"} 45029
Problems:
udp_tracker_server_requests_received_totalis fixed and low compared with any of the "received" counters in the UDP tracker core.- The UDP tracker server is not generating metrics for the second tracker in port 6868.
Notes:
- It's weird that the server does not track the request, but the requests reach the track core.
It could be related to a bug described here. However, that bug should only affect the counters for sent responses.
I haven't been able to reproduce it locally yet.
How to run a manual test in development
- Run the tracker
- Use the tracker client to make requests
For example:
cargo run -p torrust-tracker-client --bin http_tracker_client announce http://127.0.0.1:7070 443c7602b4fde83d1154d6d9da48808418b181b6 | jq
cargo run -p torrust-tracker-client --bin http_tracker_client scrape http://127.0.0.1:7070 443c7602b4fde83d1154d6d9da48808418b181b6 | jq
cargo run -p torrust-tracker-client --bin udp_tracker_client announce udp://127.0.0.1:6969 443c7602b4fde83d1154d6d9da48808418b181b6 | jq
cargo run -p torrust-tracker-client --bin udp_tracker_client scrape udp://127.0.0.1:6969 443c7602b4fde83d1154d6d9da48808418b181b6 | jq
- Load the metrics
JSON format:
curl "http://127.0.0.1:1212/api/v1/metrics?token=MyAccessToken&format=json" | jq
Prometheus format:
curl "http://127.0.0.1:1212/api/v1/metrics?token=MyAccessToken&format=prometheus" | sort
Metadata
Metadata
Assignees
Labels
BugIncorrect Behavior
Activity
josecelano commentedon Apr 15, 2025
I have fixed a bug with listeners that was causing the main problem. These are the metrics after running the tracker for some hours:
There are some strange things. For example, I would expect the total number of responses sent to be:
Total number of responses sent = requests accepted - requests aborted
But it's not. The reason could be one error I have described here. Some clients are using port 0 and the tracker can't send the response back.
josecelano commentedon Apr 15, 2025
I analyzed with AI.
AI model: R1 | Lambda
Here's an analysis of the provided Prometheus metrics, highlighting potential issues and anomalies:
1. Discrepancy Between Received and Accounted Requests (Port 6969)
147,938,53232,588,006114,409,1899,51032,588,006 + 114,409,189 + 9,510 = 147,006,705147,938,532 - 147,006,705 = ~931,8272. Response Count Exceeds Accepted Requests (Port 6969)
114,409,189115,346,786+937,597(responses > requests).3. "Accepted" vs. Core "Received" Mismatch (Port 6969)
89,616,45586,325,399-3,291,0562,277,3292,257,166-20,1634. Error Metric Inconsistencies (Port 6969)
udp_tracker_server_errors_total:4,222,856result="error"):4,248,840+25,984server_errors_total.5. HTTP Tracker Anomaly
announcerequests.http_tracker_server_requests_received_total). Either HTTP metrics are incomplete, or the server component isn't instrumented.6. Port 6868 Inconsistencies
connectrequests (10,213) are accepted, sent as responses, and received by the core. This matches expectations, but the lack of other request types (announce/scrape) may indicate limited usage or misconfiguration.Other Observations
connect: ~0.3 msannounce: ~3.1 ms (more complex, as expected).scrape: ~0.3 ms.server_binding_ip="0.0.0.0"(wildcard IP), which is normal for listeners but could mask issues in multi-homed environments.Recommendations
server_errors_totalwith error responses for consistency.The anomalies suggest either bugs in metric instrumentation (e.g., double-counting, mislabeling) or deeper issues in request processing (e.g., silent request drops after acceptance).
josecelano commentedon Apr 15, 2025
The difference between accepted and sent is because the "accepted" ones are the ones the tracker can parse. There are some "bad requests" that can't be parsed but the tracker sends an error response. Maybe we should include that a new kind:
cc @da2ce7
josecelano commentedon Apr 21, 2025
Instead of adding a new error, I have added a new label
request_kindto theudp_tracker_server_parse_requests_errors_totalmetric. When the label is missing, that means it was not possible to parse the request.