redash/tests
Omer Lachish 7fb33e3ebb
Failed Scheduled Queries Report (#3798)
* initial work on e-mail report for failed queries

* send failure report only for scheduled queries and not for adhoc queries

* add setting to determine if to send failure reports

* add setting to determine interval of aggregated e-mail report

* html templating of scheduled query failure report

* break line

* support timeouts for failure reports

* aggregate errors within message and warn if approaching threshold

* handle errors in QueryExecutor.run instead of on_failure

* move failure report to its own module

* indicate that failure count is since last report

* copy changes

* format with <code>

* styling, copy and add a link to the query instead of the query text

* separate reports with <hr>

* switch to UTC

* move <h2> to actual e-mail subject

* add explicit message for SoftTimeLimitExceeded

* fix test to use soft time limits

* default query failure threshold to 100

* use base_url from utils

* newlines. newlines everywhere.

* remove redundant import

* apply new design for failure report

* use jinja to format the failure report

* don't show comment block if no comment is provided

* don't send emails if, for some reason, there are no available errors

* subtract 1 from failure count, because the first one is represented by 'Last failed'

* don't show '+X more failures' if there's only one

* extract subject to variable

* format as text, while we're at it

* allow scrolling for long exception messages

* test that e-mails are scheduled only  when beneath limit

* test for indicating when approaching report limits + refactor

* test that failures are aggregated

* test that report counts per query and reason

* test that the latest failure occurence is reported

* force sending reports for testing purposes

* Update redash/templates/emails/failures.html

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Update redash/templates/emails/failures.html

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Update redash/tasks/failure_report.py

* add org setting for email reports

* remove logo from failure report email

* correctly use the organization setting for sending failure reports

* use user id as key for failure reports data structure

* Update redash/tasks/failure_report.py

Co-Authored-By: Arik Fraimovich <arik@arikfr.com>

* build comments while creating context for e-mail templates

* figure out the base url when creating the e-mail

* no need to expire pending failure report keys as they are deleted anyway when sent

* a couple of CodeClimate changes

* refactor key creationg to a single location

* refactor tests to send e-mail from a single function

* use beat to schedule a periodic send_aggregated_errors task instead of using countdown per email

* remove pending key as it is no longer required when a periodic task picks up the reports to send

* a really important blank line. REALLY important.

* Revert "a really important blank line. REALLY important."

This reverts commit c7d8ed89721434cb4eeb03a7360472d9dfe68af2.

* a really important blank line. REALLY important. It is the best blank line.

* don't send failure emails to disabled users
2019-07-28 12:40:54 +03:00
..
handlers Add "deprecated" flag to query runners (and alert destinations) (#3972) 2019-07-22 10:36:31 +03:00
models Support multi-byte search for query names and descriptions (#3908) 2019-07-08 10:01:47 +03:00
query_runner Add support for int/float values in guess_type (#3913) 2019-06-20 08:55:31 +03:00
serializers Query Result API response shouldn't include query information for non authenticated users (#3985) 2019-07-18 12:12:49 +03:00
tasks Failed Scheduled Queries Report (#3798) 2019-07-28 12:40:54 +03:00
utils Nest query ACL to dropdowns (#3544) 2019-03-20 09:16:10 +02:00
__init__.py Split redash/__init__.py to prevent import time side-effects. (#3601) 2019-04-18 18:39:38 +02:00
factories.py Revert "Schema Viewer Drawer (#3291)" (#3585) 2019-03-14 10:51:30 +02:00
test_authentication.py Authorize according to API key (if given) over cookies (#3877) 2019-06-12 11:45:28 +03:00
test_cli.py Revert "Schema Viewer Drawer (#3291)" (#3585) 2019-03-14 10:51:30 +02:00
test_configuration.py Fix #908: updating configuration without secrets was failing 2016-03-10 11:56:49 +02:00
test_handlers.py Remove legacy session identifier support (#3866) 2019-06-03 22:18:24 +03:00
test_models.py Fix OverflowError on celery worker (#3899) 2019-06-16 11:34:29 +03:00
test_permissions.py Allow Parameters on Public Dashboards (#3659) 2019-07-15 15:09:30 +03:00
test_utils.py Remove tree validations and introduce ParameterizedQuery (#3230) 2019-01-17 10:26:00 +02:00