taskiq-python / taskiq

Distributed task queue with full async support
MIT License
689 stars 44 forks source link

add log collection #306

Closed zmarffy closed 3 months ago

zmarffy commented 3 months ago

Implements a log collection system based on async task name.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 90.14085% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 73.61%. Comparing base (ed37be4) to head (dd0d011).

Files Patch % Lines
taskiq/cli/worker/log_collector.py 90.47% 4 Missing :warning:
taskiq/result/v1.py 0.00% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #306 +/- ## =========================================== - Coverage 78.00% 73.61% -4.39% =========================================== Files 61 61 Lines 1791 1823 +32 =========================================== - Hits 1397 1342 -55 - Misses 394 481 +87 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

zmarffy commented 3 months ago

I have realized that this is not useful. It will only collect logs from the taskiq.tasklogger logger, not any modules that it calls. Celery essentially does the same thing with its get_task_logger function. However, Celery also implements something you can use to set up loggers to get imported modules to log with a Celery task ID: after_setup_logger.connect in conjunction with get_current_task. Maybe we should look into implementing something like this for Taskiq. I have no clue how that would be possible in an async environment, but it would unlock some good potential.