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

refactor: return initial exception and check if it's user error #21836

Merged
merged 11 commits into from
Oct 31, 2022
Merged

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Oct 17, 2022

SUMMARY

Refactor sqllab to return initial exception and use the status code to indicate whether this error should be logged as an exception. We are going to log from the handle_api_exception decorator instead of the lower level.

def handle_api_exception(

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

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Merging #21836 (e7caecc) into master (d3f930a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #21836      +/-   ##
==========================================
+ Coverage   66.96%   66.97%   +0.01%     
==========================================
  Files        1807     1807              
  Lines       69222    69213       -9     
  Branches     7403     7403              
==========================================
+ Hits        46352    46357       +5     
+ Misses      20965    20951      -14     
  Partials     1905     1905              
Flag Coverage Δ
hive 52.95% <100.00%> (+0.02%) ⬆️
javascript 53.39% <ø> (ø)
mysql 78.40% <100.00%> (+0.03%) ⬆️
postgres 78.46% <100.00%> (+0.03%) ⬆️
presto 52.85% <100.00%> (+0.02%) ⬆️
python 81.52% <100.00%> (+0.03%) ⬆️
sqlite 76.94% <100.00%> (+0.03%) ⬆️
unit 51.10% <66.66%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/sqllab/command.py 87.93% <100.00%> (+3.93%) ⬆️
superset/exceptions.py 91.30% <0.00%> (+0.86%) ⬆️
superset/sqllab/exceptions.py 82.60% <0.00%> (+15.21%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 17, 2022
@hughhhh hughhhh marked this pull request as ready for review October 21, 2022 19:03
@hughhhh hughhhh closed this Oct 28, 2022
@hughhhh hughhhh reopened this Oct 28, 2022
@hughhhh hughhhh requested review from AAfghahi and pkdotson and removed request for betodealmeida October 28, 2022 18:39
except Exception as ex:
query_id = query.id if query else None
logger.exception("Query %d: %s", query_id, type(ex))
Copy link
Member

Choose a reason for hiding this comment

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

would it be useful to still log query id here or no?

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 don't think having the id helps us debug the issue at all tbh, with that information we can't do anything else.

the important thing is that we log the exception here (

def handle_api_exception(
) once it gets bubbled up

Copy link
Member

Choose a reason for hiding this comment

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

got it!

Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

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

lgtm!

@eschutho
Copy link
Member

@betodealmeida @john-bodley Here are more examples of us refactoring to bubble up errors to the flask or celery level.

@hughhhh hughhhh merged commit 7f78778 into master Oct 31, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the ret-ex branch March 26, 2024 16:20
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/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants