-
Notifications
You must be signed in to change notification settings - Fork 10
CCMRG-1903: Centralize lock logging in BaseCodecovTask #588
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
Conversation
drazisil-codecov
commented
Nov 26, 2025
- Add with_logged_lock() context manager to BaseCodecovTask for consistent lock logging
- Refactor all tasks to use centralized lock logging method
- Remove duplicate lock logging code from:
- upload.py
- preprocess_upload.py
- sync_repos.py
- sync_pull.py
- manual_trigger.py
- crontasks.py
- upload_finisher.py
- All locks now log: Acquiring lock, Acquired lock, Releasing lock (with duration)
- No changes to actual lock logic, only added observability
- Add with_logged_lock() context manager to BaseCodecovTask for consistent lock logging - Refactor all tasks to use centralized lock logging method - Remove duplicate lock logging code from: - upload.py - preprocess_upload.py - sync_repos.py - sync_pull.py - manual_trigger.py - crontasks.py - upload_finisher.py - All locks now log: Acquiring lock, Acquired lock, Releasing lock (with duration) - No changes to actual lock logic, only added observability
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #588 +/- ##
=======================================
Coverage 93.86% 93.86%
=======================================
Files 1284 1284
Lines 46478 46492 +14
Branches 1522 1522
=======================================
+ Hits 43628 43642 +14
Misses 2540 2540
Partials 310 310 ☔ View full report in Codecov by Sentry. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Add comprehensive test suite for with_logged_lock() context manager - Test that 'Acquiring lock' is logged before lock acquisition - Test that 'Acquired lock' is logged after successful acquisition - Test that 'Releasing lock' is logged with duration after release - Test that extra context is included in all log messages - Test that code executes correctly within lock context - Test that LockError propagates correctly (not caught) - Test that 'Releasing lock' is logged even on exceptions
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Use approximate comparison instead of exact equality for lock_duration_seconds to handle floating point precision issues
Updated assertions in test_base.py to use multi-line format for better clarity in floating point precision checks for lock_duration_seconds.
|
@sentry review |
Modify get_report_lock to return both lock and lock_name as a tuple, eliminating duplication and ensuring the lock_name passed to with_logged_lock always matches the actual lock being used. This prevents potential bugs if get_report_lock's internal lock naming logic changes in the future.
Removed comments verifying log messages in unit tests.