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

chore: Lower giveup log level for retried functions to warning #26188

Merged

Conversation

jfrag1
Copy link
Member

@jfrag1 jfrag1 commented Dec 5, 2023

SUMMARY

The goal of this PR is to eliminate unnecessary error logs. The retry_call function uses the backoff lib to decorate functions we want to retry. After the retry limit is reached, the backoff decorator generates a log saying that it's giving up. This log defaults to the error level, which isn't necessary here since the exception raised by the wrapped function gets bubbled up and logged at the appropriate level already.

This PR solves the issue by lowering the log from the backoff decorator to a warning

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d2cce51) 69.15% compared to head (3bed647) 69.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26188      +/-   ##
==========================================
+ Coverage   69.15%   69.18%   +0.03%     
==========================================
  Files        1944     1944              
  Lines       75925    75927       +2     
  Branches     8451     8451              
==========================================
+ Hits        52505    52533      +28     
+ Misses      21235    21209      -26     
  Partials     2185     2185              
Flag Coverage Δ
hive 53.68% <50.00%> (-0.01%) ⬇️
mysql 78.10% <100.00%> (+0.02%) ⬆️
postgres 78.19% <100.00%> (?)
presto 53.64% <50.00%> (-0.01%) ⬇️
python 82.88% <100.00%> (+0.07%) ⬆️
sqlite 76.85% <100.00%> (+<0.01%) ⬆️
unit 55.81% <50.00%> (-0.01%) ⬇️

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

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

@@ -26,13 +27,15 @@ def retry_call(
*args: Any,
strategy: Callable[..., Generator[int, None, None]] = backoff.constant,
exception: type[Exception] = Exception,
giveup_log_level: int = logging.WARNING,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe type this as optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just int is more precise here, since the default logging.WARNING is an int, and it wouldn't make sense to pass giveup_log_level=None

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with a suggested small nit on typing.

@jfrag1 jfrag1 merged commit bf5b18c into apache:master Dec 7, 2023
33 checks passed
@jfrag1 jfrag1 deleted the jack/set-give-up-log-level-to-warning branch December 7, 2023 00:33
@michael-s-molina michael-s-molina added the v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch label Dec 8, 2023
michael-s-molina pushed a commit that referenced this pull request Dec 8, 2023
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Dec 8, 2023
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Dec 11, 2023
josedev-union pushed a commit to Ortege-xyz/studio that referenced this pull request Jan 22, 2024
@mistercrunch mistercrunch added 🍒 3.1.0 🍒 3.1.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Mar 8, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch 🍒 3.1.0 🍒 3.1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants