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

Improve Tracker API errors log #425

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jan 3, 2024

We need the specific error requesting the tracker API to include the error in the logs.

  • Refactor to decouple API errors from app errors.
  • Change the statistic importer log to include the exact error from the tracker API.
  • When we import statistics from the tracker, don't log an error when the torrent is not found. It could have been removed because there are no peers.

We need the specifix error requesting the tracker API to include the
error in the logs.
@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

Attention: 152 lines in your changes are missing coverage. Please review.

Comparison is base (a471a5b) 42.89% compared to head (f975bf5) 41.36%.

❗ Current head f975bf5 differs from pull request most recent head ff90e9e. Consider uploading reports for the commit ff90e9e to get more accurate results

Files Patch % Lines
src/tracker/service.rs 0.00% 117 Missing ⚠️
src/errors.rs 5.00% 19 Missing ⚠️
src/tracker/statistics_importer.rs 0.00% 14 Missing ⚠️
src/services/torrent.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #425      +/-   ##
===========================================
- Coverage    42.89%   41.36%   -1.53%     
===========================================
  Files           80       80              
  Lines         4933     4994      +61     
===========================================
- Hits          2116     2066      -50     
- Misses        2817     2928     +111     

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

Some cases were missing when the tracker service processes the responses
from the tracker API.

Added debugging and error log.

todo: add tests
Now you can see the exact error when the tracker API fails. For example,
the following error when the torrent is not found:

```
2024-01-03T17:25:49.817570509+00:00 [statistics_importer][ERROR] Error updating torrent tracker stats for torrent with id 3; info-hash c0bae61394917c2cc3aa3af9c2291bfe80b5bbf4. Error: TorrentNotFound
```
@josecelano josecelano marked this pull request as ready for review January 3, 2024 17:31
@josecelano
Copy link
Member Author

ACK ff90e9e

@josecelano josecelano merged commit 9c4b5f0 into torrust:develop Jan 4, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fix wrong error TorrentNotFound added to logs when Tracker API token is invalid
2 participants