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: prevent prophet from logging non-errors as errors #27053

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Feb 8, 2024

SUMMARY

Prophet will log errors when optional dependencies are not installed:

# from prophet/plot.py
try:
    import plotly.graph_objs as go
    from plotly.subplots import make_subplots
except ImportError:
    logger.error('Importing plotly failed. Interactive plots will not work.')

(It does something similar for matplotlib.)

These calls to logger.error will pollute and trigger unnecessary alerts.

This PR introduces a decorator suppress_logging that can be used in cases like this to suppress the logging:

with suppress_logging("prophet.plot"):
    from prophet import Prophet

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

>>> import prophet
Importing plotly failed. Interactive plots will not work.
>>>
>>> from superset.utils.decorators import suppress_logging
>>> with suppress_logging("prophet.plot"):
...     import prophet
...
>>>

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

@betodealmeida betodealmeida changed the title chore: remove prophet error chore: prevent prophet from logging non-errors as errors Feb 8, 2024
Copy link

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c222464) 67.19% compared to head (daba47c) 69.52%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27053      +/-   ##
==========================================
+ Coverage   67.19%   69.52%   +2.33%     
==========================================
  Files        1899     1899              
  Lines       74369    74379      +10     
  Branches     8274     8274              
==========================================
+ Hits        49970    51710    +1740     
+ Misses      22344    20614    -1730     
  Partials     2055     2055              
Flag Coverage Δ
hive 53.81% <100.00%> (?)
mysql 78.01% <100.00%> (+<0.01%) ⬆️
postgres 78.11% <100.00%> (+<0.01%) ⬆️
presto 53.76% <100.00%> (?)
python 83.07% <100.00%> (+4.83%) ⬆️
sqlite 77.62% <100.00%> (+<0.01%) ⬆️
unit 56.49% <100.00%> (?)

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.



@contextmanager
def suppress_logging(

Choose a reason for hiding this comment

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

@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 8, 2024
@betodealmeida betodealmeida merged commit cf84f36 into master Feb 8, 2024
41 checks passed
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Feb 12, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
@rusackas rusackas deleted the supress_prophet_logging branch April 16, 2024 16:53
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.0.0 labels Apr 17, 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/M 🚢 4.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants