Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(import): Ensure import exceptions are logged #32410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

withnale
Copy link
Contributor

@withnale withnale commented Feb 27, 2025

SUMMARY

Closes #32411

This is a partial fix to issue #32411 which provides explicit logging for each import error that occurs.

At present, if there is an import error occurs there is very little information to work with. If the import is being performed in the UI then the following error will appear...

Screenshot 2025-02-27 at 13 24 37

In the logs, only the following error will be generated:

superset.commands.exceptions.CommandInvalidError: Error importing dashboard

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

korbit-ai bot commented Feb 27, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@withnale withnale marked this pull request as ready for review February 27, 2025 13:36
@dosubot dosubot bot added the logging Creates a UI or API endpoint that could benefit from logging. label Feb 27, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Error Handling Incorrect log level for critical errors ▹ view
Files scanned
File Path Reviewed
superset/commands/importers/v1/init.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Documentation
Logging
Error Handling
Readability
Design
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

@@ -104,6 +107,8 @@ def validate(self) -> None: # noqa: F811
self._prevent_overwrite_existing_model(exceptions)

if exceptions:
for ex in exceptions:
logger.warning("Import Error: %s",ex)
Copy link

Choose a reason for hiding this comment

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

Incorrect log level for critical errors category Error Handling

Tell me more
What is the issue?

Using warning level for import validation errors that lead to command failure

Why this matters

Warning level suggests the error is not severe, but these validation errors cause command failure and should be treated as errors

Suggested change ∙ Feature Preview

Use error level logging instead:

logger.error("Import validation error: %s", ex)

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are not critical errors in terms of the superset app itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still under error label so Korbit is correct, imo.

@sadpandajoe sadpandajoe requested a review from eschutho February 27, 2025 18:23
Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.46%. Comparing base (76d897e) to head (4beaf46).
Report is 1505 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #32410       +/-   ##
===========================================
+ Coverage   60.48%   83.46%   +22.97%     
===========================================
  Files        1931      546     -1385     
  Lines       76236    39106    -37130     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32638    -13476     
+ Misses      28017     6468    -21549     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.52% <50.00%> (-0.65%) ⬇️
javascript ?
mysql 75.88% <100.00%> (?)
postgres 75.93% <100.00%> (?)
presto 53.05% <50.00%> (-0.76%) ⬇️
python 83.46% <100.00%> (+19.97%) ⬆️
sqlite 75.44% <100.00%> (?)
unit 61.12% <50.00%> (+3.49%) ⬆️

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.

@withnale withnale force-pushed the import-exception-logging branch from 61f3477 to 4beaf46 Compare February 28, 2025 09:27
@hainenber
Copy link
Contributor

Thanks @withnale for raising PR following your issue! I left 2 reviews

@@ -104,6 +107,8 @@ def validate(self) -> None: # noqa: F811
self._prevent_overwrite_existing_model(exceptions)

if exceptions:
for ex in exceptions:
logger.warning("Import Error: %s", ex)
raise CommandInvalidError(
Copy link
Contributor

@hainenber hainenber Feb 28, 2025

Choose a reason for hiding this comment

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

L112 already raised the exceptions and surely logged by the logger. You're not seeing the exceptions?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
logging Creates a UI or API endpoint that could benefit from logging. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to diagnose import issues
2 participants