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

docs: deprecate old alerts and dash/charts reports #13440

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ assists people when migrating to a new version.
### Breaking Changes
### Potential Downtime
### Deprecations
- [11509](https://github.com/apache/superset/pull/12491): Dashboard/Charts reports and old Alerts is deprecated. The following config keys are deprecated:
- ENABLE_ALERTS
- SCHEDULED_EMAIL_DEBUG_MODE
- EMAIL_REPORTS_CRON_RESOLUTION
- EMAIL_ASYNC_TIME_LIMIT_SEC
- EMAIL_REPORT_BCC_ADDRESS
- EMAIL_REPORTS_USER
### Other

[shillelagh](https://github.com/betodealmeida/shillelagh/) is now the recommended module to connect Superset to Google Spreadsheets, since it's more robust and has extensive test coverage. You should uninstall the `gsheetsdb` module and install the `shillelagh` module in its place. Shillelagh is a drop-in replacement, so no modifications are needed to be done on existing queries, datasets or charts.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/installation/alerts_reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ are not accessible to unauthorized requests, that is why the worker needs to tak
of an existing user to take a snapshot.

```python
EMAIL_REPORTS_USER = 'username_with_permission_to_access_dashboards'
THUMBNAIL_SELENIUM_USER = 'username_with_permission_to_access_dashboards'
```

**Important notes**
Expand Down
7 changes: 7 additions & 0 deletions superset/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ def init_views(self) -> None:
# Conditionally setup email views
#
if self.config["ENABLE_SCHEDULED_EMAIL_REPORTS"]:
logging.warning(
"ENABLE_SCHEDULED_EMAIL_REPORTS "
"is deprecated and will be removed in version 2.0.0"
)
appbuilder.add_separator("Manage")
appbuilder.add_view(
DashboardEmailScheduleView,
Expand All @@ -431,6 +435,9 @@ def init_views(self) -> None:
)

if self.config["ENABLE_ALERTS"]:
logging.warning(
"ENABLE_ALERTS is deprecated and will be removed in version 2.0.0"
)
appbuilder.add_view(
AlertModelView,
"Alerts",
Expand Down
37 changes: 21 additions & 16 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def _try_json_readsha( # pylint: disable=unused-argument

# ---------------------------------------------------
# Thumbnail config (behind feature flag)
# Also used by Alerts & Reports
# ---------------------------------------------------
THUMBNAIL_SELENIUM_USER = "admin"
THUMBNAIL_CACHE_CONFIG: CacheConfig = {
Expand Down Expand Up @@ -614,18 +615,8 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
CELERY_ACKS_LATE = False
CELERY_ANNOTATIONS = {
"sql_lab.get_sql_results": {"rate_limit": "100/s"},
Copy link
Member

Choose a reason for hiding this comment

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

I think these removals break SEMVER - we shouldn't change the defaults for the configuration between majors. Let's keep the schedules, but perhaps add a deprecation?

"email_reports.send": {
"rate_limit": "1/s",
"time_limit": 120,
"soft_time_limit": 150,
"ignore_result": True,
},
}
CELERYBEAT_SCHEDULE = {
"email_reports.schedule_hourly": {
"task": "email_reports.schedule_hourly",
"schedule": crontab(minute=1, hour="*"),
},
"reports.scheduler": {
"task": "reports.scheduler",
"schedule": crontab(minute="*", hour="*"),
Expand Down Expand Up @@ -891,24 +882,35 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
SQL_QUERY_MUTATOR = None

# Enable / disable scheduled email reports
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
ENABLE_SCHEDULED_EMAIL_REPORTS = False

# Enable / disable Alerts, where users can define custom SQL that
# will send emails with screenshots of charts or dashboards periodically
# if it meets the criteria
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
ENABLE_ALERTS = False

# ---------------------------------------------------
# Alerts & Reports
# ---------------------------------------------------
# Used for Alerts/Reports (Feature flask ALERT_REPORTS) to set the size for the
# sliding cron window size, should be synced with the celery beat config minus 1 second
ALERT_REPORTS_CRON_WINDOW_SIZE = 59
# A custom prefix to use on all Alerts & Reports emails
EMAIL_REPORTS_SUBJECT_PREFIX = "[Report] "

# Slack API token for the superset reports
SLACK_API_TOKEN = None
SLACK_PROXY = None

# If enabled, certail features are run in debug mode
# If enabled, certain features are run in debug mode
# Current list:
# * Emails are sent using dry-run mode (logging only)
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
SCHEDULED_EMAIL_DEBUG_MODE = False

# This auth provider is used by background (offline) tasks that need to access
Expand All @@ -917,26 +919,29 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
MACHINE_AUTH_PROVIDER_CLASS = "superset.utils.machine_auth.MachineAuthProvider"

# Email reports - minimum time resolution (in minutes) for the crontab
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
EMAIL_REPORTS_CRON_RESOLUTION = 15

# The MAX duration (in seconds) a email schedule can run for before being killed
# by celery.
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
EMAIL_ASYNC_TIME_LIMIT_SEC = 300

# Email report configuration
# From address in emails
EMAIL_REPORT_FROM_ADDRESS = "reports@superset.org"
Copy link
Member

Choose a reason for hiding this comment

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

Same comment with these config removals.

Copy link
Member Author

Choose a reason for hiding this comment

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

This one is used anywhere, safe to just remove


# Send bcc of all reports to this address. Set to None to disable.
# This is useful for maintaining an audit trail of all email deliveries.
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
EMAIL_REPORT_BCC_ADDRESS = None

# User credentials to use for generating reports
# This user should have permissions to browse all the dashboards and
# slices.
# TODO: In the future, login as the owner of the item to generate reports
#
# Warning: This config key is deprecated and will be removed in version 2.0.0"
EMAIL_REPORTS_USER = "admin"
EMAIL_REPORTS_SUBJECT_PREFIX = "[Report] "

# The webdriver to use for generating reports. Use one of the following
# firefox
Expand Down
3 changes: 3 additions & 0 deletions superset/tasks/slack_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""
DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
"""
import logging
from io import IOBase
from typing import cast, Optional, Union
Expand Down
23 changes: 21 additions & 2 deletions superset/views/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""
DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
"""

from croniter import croniter
from flask import abort
from flask import abort, flash, Markup
from flask_appbuilder import CompactCRUDMixin, permission_name
from flask_appbuilder.api import expose
from flask_appbuilder.models.sqla.interface import SQLAInterface
Expand Down Expand Up @@ -81,7 +85,6 @@ def list(self) -> FlaskResponse:
and is_feature_enabled("ALERT_REPORTS")
):
return abort(404)

return super().render_app_template()

@expose("/<pk>/log/", methods=["GET"])
Expand Down Expand Up @@ -209,6 +212,22 @@ class AlertModelView(SupersetModelView): # pylint: disable=too-many-ancestors
AlertLogModelView,
]

@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
flash(
Markup(
_(
"This feature is deprecated and will be removed on 2.0. "
"Take a look at the replacement feature "
"<a href='https://superset.apache.org/docs/installation/alerts-reports'>"
"Alerts & Reports documentation</a>"
)
),
"warning",
)
return super().list()

def pre_add(self, item: "AlertModelView") -> None:
item.recipients = get_email_address_str(item.recipients)

Expand Down
38 changes: 37 additions & 1 deletion superset/views/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""
DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
"""

import enum
from typing import Type, Union

import simplejson as json
from croniter import croniter
from flask import flash, g
from flask import flash, g, Markup
from flask_appbuilder import expose
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access
Expand Down Expand Up @@ -232,6 +236,22 @@ class DashboardEmailScheduleView(
"delivery_type": _("Delivery Type"),
}

@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
flash(
Markup(
_(
"This feature is deprecated and will be removed on 2.0. "
"Take a look at the replacement feature "
"<a href='https://superset.apache.org/docs/installation/alerts-reports'>"
"Alerts & Reports documentation</a>"
)
),
"warning",
)
return super().list()

def pre_add(self, item: "DashboardEmailScheduleView") -> None:
if item.dashboard is None:
raise SupersetException("Dashboard is mandatory")
Expand Down Expand Up @@ -296,6 +316,22 @@ class SliceEmailScheduleView(EmailScheduleView): # pylint: disable=too-many-anc
"email_format": _("Email Format"),
}

@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
flash(
Markup(
_(
"This feature is deprecated and will be removed on 2.0. "
"Take a look at the replacement feature "
"<a href='https://superset.apache.org/docs/installation/alerts-reports'>"
"Alerts & Reports documentation</a>"
)
),
"warning",
)
return super().list()

def pre_add(self, item: "SliceEmailScheduleView") -> None:
if item.slice is None:
raise SupersetException("Slice is mandatory")
Expand Down