Highlight failing jobs on the dashboard

> When we have jobs that have over 3% failure rates we should highlight
> those so that peoples attention is drawn to deal with the failure.
>
> They would then go to the job view to see what the details are where
> they could filter by failure, but that's a different story...
>
> This is just about calculating and highlighting those that need their
> attention.

— https://www.pivotaltracker.com/story/show/121206123

This commit:

- calculates the failure rate for each job
- makes jobs with a failure rate of > 3% go red on the dashboard
This commit is contained in:
Chris Hill-Scott
2016-06-14 16:47:22 +01:00
parent 9eb777b867
commit 56d9c29e91
5 changed files with 46 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ from app import (
service_api_client,
template_statistics_client
)
from app.statistics_utils import sum_of_statistics, add_rates_to
from app.statistics_utils import sum_of_statistics, add_rates_to, add_rate_to_jobs
from app.utils import user_has_permissions
@@ -169,5 +169,5 @@ def get_dashboard_statistics_for_service(service_id):
'sms_allowance_remaining': max(0, (sms_free_allowance - sms_sent)),
'sms_chargeable': max(0, sms_sent - sms_free_allowance),
'sms_rate': sms_rate,
'jobs': job_api_client.get_job(service_id, limit_days=7)['data']
'jobs': add_rate_to_jobs(job_api_client.get_job(service_id, limit_days=7)['data'])
}