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

* docs: deprecated old alerts and dash/charts reports

* revert celery default config

* fix lint
This commit is contained in:
Daniel Vaz Gaspar 2021-03-05 09:40:08 +00:00 committed by GitHub
parent 9fc03f0424
commit 94fc5d586e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 100 additions and 10 deletions

View File

@ -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.

View File

@ -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**

View File

@ -412,6 +412,10 @@ class SupersetAppInitializer:
# 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,
@ -431,6 +435,9 @@ class SupersetAppInitializer:
)
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",

View File

@ -424,6 +424,7 @@ EXTRA_SEQUENTIAL_COLOR_SCHEMES: List[Dict[str, Any]] = []
# ---------------------------------------------------
# Thumbnail config (behind feature flag)
# Also used by Alerts & Reports
# ---------------------------------------------------
THUMBNAIL_SELENIUM_USER = "admin"
THUMBNAIL_CACHE_CONFIG: CacheConfig = {
@ -891,24 +892,35 @@ DB_CONNECTION_MUTATOR = None
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
@ -917,26 +929,29 @@ SCHEDULED_EMAIL_DEBUG_MODE = False
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"
# 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

View File

@ -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

View File

@ -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
@ -81,7 +85,6 @@ class BaseAlertReportView(BaseSupersetView):
and is_feature_enabled("ALERT_REPORTS")
):
return abort(404)
return super().render_app_template()
@expose("/<pk>/log/", methods=["GET"])
@ -209,6 +212,23 @@ 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)

View File

@ -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
@ -232,6 +236,23 @@ 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")
@ -296,6 +317,23 @@ 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")