codecov / worker

Code for Background Workers of Codecov
Other
50 stars 10 forks source link

base task: attempt to log CheckpointLogger errors for on_timeout and on_failure #794

Open matt-codecov opened 1 week ago

matt-codecov commented 1 week ago

the UploadFlow reliability metrics rely on there being a checkpoint logged for every way the flow can end, whether it's a success or a failure. looking at the data, it appears 40-60% of flow endings aren't captured. this means we can't totally trust our calculated reliability rate

i am not totally clear on how celery calls on_failure() and on_timeout(), but this PR attempts to load any checkpoints data it can find in them and log an error event. ideally this will increase our share of captured endings and make the metrics more accurate

on_timeout() is a member on a celery Request which we've subclassed as BaseCodecovRequest. it doesn't receive kwargs as an argument, but according to docs it has a kwargs property which presumably holds the kwargs that the task was scheduled with. on_failure() is a member on the task and one of its arguments is kwargs. a non-retried UploadTask will not have any checkpoints data in its kwargs, but i think a retried UploadTask and future tasks should at least have a beginning checkpoint.

doing this creates a possibility that some endings will be double-counted:

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (48ce427) to head (1cd2e55).

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/base.py 77.77% 4 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/codecov/worker/pull/794/graphs/tree.svg?width=650&height=150&src=pr&token=BWTOrjBaE5&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov)](https://app.codecov.io/gh/codecov/worker/pull/794?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) ```diff @@ Coverage Diff @@ ## main #794 +/- ## ========================================== - Coverage 98.01% 98.00% -0.01% ========================================== Files 443 443 Lines 36615 36637 +22 ========================================== + Hits 35887 35905 +18 - Misses 728 732 +4 ``` | [Flag](https://app.codecov.io/gh/codecov/worker/pull/794/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/codecov/worker/pull/794/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | `98.00% <82.60%> (-0.01%)` | :arrow_down: | | [unit](https://app.codecov.io/gh/codecov/worker/pull/794/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | `98.00% <82.60%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/codecov/worker/pull/794/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | Coverage Δ | | |---|---|---| | [NonTestCode](https://app.codecov.io/gh/codecov/worker/pull/794/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | `95.85% <82.60%> (-0.03%)` | :arrow_down: | | [OutsideTasks](https://app.codecov.io/gh/codecov/worker/pull/794/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | `97.99% <100.00%> (+<0.01%)` | :arrow_up: | | [Files with missing lines](https://app.codecov.io/gh/codecov/worker/pull/794?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | Coverage Δ | | |---|---|---| | [helpers/checkpoint\_logger/flows.py](https://app.codecov.io/gh/codecov/worker/pull/794?src=pr&el=tree&filepath=helpers%2Fcheckpoint_logger%2Fflows.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov#diff-aGVscGVycy9jaGVja3BvaW50X2xvZ2dlci9mbG93cy5weQ==) | `100.00% <100.00%> (ø)` | | | [tasks/base.py](https://app.codecov.io/gh/codecov/worker/pull/794?src=pr&el=tree&filepath=tasks%2Fbase.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov#diff-dGFza3MvYmFzZS5weQ==) | `95.04% <77.77%> (-1.69%)` | :arrow_down: |
codecov-notifications[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/base.py 77.77% 4 Missing :warning:

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
- Coverage   98.01%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36615    36637      +22     
==========================================
+ Hits        35887    35905      +18     
- Misses        728      732       +4     
Flag Coverage Δ
integration 98.00% <82.60%> (-0.01%) :arrow_down:
unit 98.00% <82.60%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <82.60%> (-0.03%) :arrow_down:
OutsideTasks 97.99% <100.00%> (+<0.01%) :arrow_up:
Files with missing lines Coverage Δ
helpers/checkpoint_logger/flows.py 100.00% <100.00%> (ø)
tasks/base.py 95.04% <77.77%> (-1.69%) :arrow_down:
codecov-qa[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (48ce427) to head (1cd2e55).

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/base.py 77.77% 4 Missing :warning:

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
- Coverage   98.01%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36615    36637      +22     
==========================================
+ Hits        35887    35905      +18     
- Misses        728      732       +4     
Flag Coverage Δ
integration 98.00% <82.60%> (-0.01%) :arrow_down:
unit 98.00% <82.60%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <82.60%> (-0.03%) :arrow_down:
OutsideTasks 97.99% <100.00%> (+<0.01%) :arrow_up:
Files with missing lines Coverage Δ
helpers/checkpoint_logger/flows.py 100.00% <100.00%> (ø)
tasks/base.py 95.04% <77.77%> (-1.69%) :arrow_down:
codecov-public-qa[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (48ce427) to head (1cd2e55).

:white_check_mark: All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
- Coverage   98.01%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36615    36637      +22     
==========================================
+ Hits        35887    35905      +18     
- Misses        728      732       +4     
Flag Coverage Δ
integration 98.00% <82.60%> (-0.01%) :arrow_down:
unit 98.00% <82.60%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <82.60%> (-0.03%) :arrow_down:
OutsideTasks 97.99% <100.00%> (+<0.01%) :arrow_up:
Files Coverage Δ
helpers/checkpoint_logger/flows.py 100.00% <100.00%> (ø)
tasks/base.py 95.04% <77.77%> (-1.69%) :arrow_down: