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: stop logging "SyntaxError" as exceptions #21787

Merged
merged 4 commits into from
Oct 13, 2022
Merged

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Oct 12, 2022

SUMMARY

Moving exception logs to upper level command.py file since we are doing filtering of Syntax errors there. The goals is not to log users errors on our end. This PR will be an example for other errors that we might not want to log as exceptions.

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

@@ -313,8 +313,6 @@ def execute_sql_statement( # pylint: disable=too-many-arguments,too-many-statem
if query.status == QueryStatus.STOPPED:
raise SqlLabQueryStoppedException() from ex

logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
logger.debug("Query %d: %s", query.id, ex)
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep the debug? Or does it also show up as exceptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

naw we end up eating it and converting to a payload i'll add it back

@@ -132,6 +132,7 @@ def run( # pylint: disable=too-many-statements,useless-suppression
) from ex
raise ex
except Exception as ex:
logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
Copy link
Member

Choose a reason for hiding this comment

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

If we need the exception info in general it's better to use logger.exception, as it does that automatically:

Suggested change
logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
logger.exception("Query %d: %s", query.id, type(ex))

@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #21787 (131308c) into master (8f74e46) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #21787      +/-   ##
==========================================
- Coverage   66.86%   66.85%   -0.01%     
==========================================
  Files        1803     1803              
  Lines       68996    68997       +1     
  Branches     7349     7349              
==========================================
- Hits        46132    46131       -1     
- Misses      20971    20973       +2     
  Partials     1893     1893              
Flag Coverage Δ
hive 52.92% <0.00%> (-0.01%) ⬇️
mysql 78.24% <0.00%> (-0.01%) ⬇️
postgres 78.31% <0.00%> (-0.01%) ⬇️
presto 52.82% <0.00%> (-0.01%) ⬇️
python 81.45% <0.00%> (-0.01%) ⬇️
sqlite 76.79% <0.00%> (-0.01%) ⬇️
unit 51.05% <0.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/sql_lab.py 82.12% <ø> (-0.07%) ⬇️
superset/sqllab/command.py 83.87% <0.00%> (-1.38%) ⬇️

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

@hughhhh hughhhh merged commit e6c44e0 into master Oct 13, 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 mv-sql-error-logs branch March 26, 2024 16:15
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 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants