Commit Graph

39 Commits

Author SHA1 Message Date
Rebecca Law
a341536de0 - Add comment to test and new if statement
- Update assert in test
2021-06-02 14:13:31 +01:00
Rebecca Law
b170b5ed80 This change is a temporary fix to allow users for high volume services to use the admin app.
The trouble is the aggregate query to return the big blue numbers on the dashboard and /notifications/{notification_type} page is taking too long to return.
I have some ideas on how to improve the query, but should take some time to do some more research and test. In the meantime, let's just ignore "todays" total numbers for the high volume services. There are only two services that this will affect.
2021-06-02 10:31:38 +01:00
David McDonald
04e23ca6a9 Revert "Bump utils version for new invalid address character" 2021-06-01 10:53:28 +01:00
Rebecca Law
f66f0a2e2d Bump moto dependency to resolve dependency conflicts 2021-05-25 14:20:25 +01:00
David McDonald
41d95378ea Remove everything for the performance platform
We no longer will send them any stats so therefore don't need the code
- the code to work out the nightly stats
- the performance platform client
- any configuration for the client
- any nightly tasks that kick off the sending off the stats

We will require a change in cronitor as we no longer will have this task
run meaning we need to delete the cronitor check.
2021-03-15 12:04:53 +00:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Rebecca Law
11d10d5293 Rename to performance_dashboard
Fix totals to return totals for all time rather than for date range.
Added more test data
2021-03-10 13:16:25 +00:00
Rebecca Law
b06850e611 Add an endpoint to return all the data required for the performance
platform page.
2021-03-05 09:59:03 +00:00
Katie Smith
5b8b0dfc6e Include pending notifications in monthly data by service report
The '/service/monthly-data-by-service` endpoint which is used for the
'Monthly notification statuses for live services' Platform Admin report
did not including `pending` notifications. This updates the DAO function
that the endpoint calls to group `pending` and `sending` notifications together.
2020-04-30 13:53:01 +01:00
Leo Hemsted
0448bca542 make create_nightly_notification_status_for_day take notification_type
the nightly task won't be affected, it'll just trigger three times more
sub-tasks.

this doesn't need to be a two-part deploy because we only trigger this
overnight, so as long as the deploy completes in daytime we don't need
to worry about celery task signatures
2019-12-05 14:43:33 +00:00
Leo Hemsted
913cf5e12d work out which table to get notification status data from
previously we checked notifications table, and if the results were
zero, checked the notification history table to see if there's data
in there. When we know that data isn't in notifications, we're still
checking. These queries take half a second per service, and we're
doing at least ten for each of the five thousand services we have in
notify. Most of these services have no data in either table for any
given day, and we can reduce the amount of queries we do by only
checking one table.

Check the data retention for a service, and then if the date is older
than the retention, get from history table.

NOTE: This requires that the delete tasks haven't run yet for the day!
If your retention is three days, this will look in the Notification
table for data from three days ago - expecting that shortly after the
task finishes, we'll delete that data.
2019-11-29 15:27:56 +00:00
Katie Smith
81de71dc1f Add dao function that gets the required data 2019-07-23 10:00:50 +01:00
Rebecca Law
ed611f982c We found a problem with the report tasks that populate the fact tables (or statistic tables). It is possible that the notification status can change for notifications after 4 days.
This PR updates those queries to look in either Notification or NotificationHistory. Since the data does not exist in both tables at the same time we can do with and not worry about the data retention.
The query will iterate over each service, then each notification type and query the data if no results then try the history table.
2019-07-18 15:29:54 +01:00
Leo Hemsted
1dc084be54 fix nightly ft stats tables task to respect BST
the create_nightly_notification_status task runs at 00:30am UK time,
however this means that in summer datetime.today() will return the
wrong date as the server (which runs on UTC) will run the task at
23:30 (populating the wrong row in the table).

fix this to use nice tz aware functions
2019-04-02 15:15:07 +01:00
Rebecca Law
a47ecf0711 Fix test where the year was static
Remove print
2019-04-01 11:43:02 +01:00
Rebecca Law
d83ee6171e Fix codestyle 2019-04-01 11:02:02 +01:00
Rebecca Law
b9b81bca8f Fix BST date bug for platform admin summary page.
Added test for that.
2019-04-01 10:56:55 +01:00
Rebecca Law
fe30d2879a Fix test 2019-03-29 15:46:36 +00:00
Rebecca Law
1806f092f3 Update the nightly task that send performance platform statistics to use ft_notification_status rather than notification_history.
The previous query was including all notifications regardless of notification_status. I don't think that's right, it shouldn't include things like technical-failure or validation-failed. Thoughts?

I also need to remove the query that's no longer being used.
2019-03-29 14:21:05 +00:00
Alexey Bezhan
90dc69b6bc Merge pull request #2303 from alphagov/ft-status-template-statistics
Change template statistics endpoint to use fact_notification_status_dao
2019-01-17 15:04:20 +00:00
Rebecca Law
3dca36ecfc Actually test the right thing :) 2019-01-15 16:16:19 +00:00
Rebecca Law
a4d89359c5 Adding a filter to exclude test keys for the template monthly usage query.
Added a test.
2019-01-15 16:13:38 +00:00
Pea Tyczynska
52831813d8 Change template statistics endpoint to use fact_notification_status_dao 2019-01-15 11:55:45 +00:00
Alexey Bezhan
876346f469 Add an option to group notification stats for 7 days by template
Currently, admin app requests service statistics (with notification
counts grouped by status) and template statistics (with counts by
template) in order to display the service dashboard.

Service statistics are gathered from FactNotificationStatus table
(counts for the last 7 days) combined with Notification (counts for
today).

Template statistics are currently gathered from redis cache, which
contains a separate counter per template per day. It's hard for us
to maintain consistency between redis and DB counts. Currently it
doesn't update the count for cancelled letters, counter resets in
the middle of the day might produce a wrong result for the rest of
the week and cleared redis cache can't be repopulated for services
with low data retention periods).

Since FactNotificationStatus already contains separate counts for
each template_id we can use the existing logic with some additional
filters to get separate counts for each template and status combination,
which would allow us to populate the service dashboard page from one
query response.
2019-01-14 16:58:57 +00:00
Rebecca Law
b5a3ef9576 Added order by.
Added more unit tests.
Remove comments.
2019-01-14 15:28:26 +00:00
Rebecca Law
c3c9d1eac9 Add unit tests.
Fix data types in result set.
2019-01-11 17:09:42 +00:00
Rebecca Law
507138cc94 Create a new query for template monthly stats. 2019-01-10 16:24:51 +00:00
Rebecca Law
bd9a6352fd Optimise the query for getting the platform statistics for all services. The page should render for all time after this change.
This is one step closer to eliminating the need to read from NotificationHistory.
2019-01-04 16:45:39 +00:00
Rebecca Law
39963d9784 Created a query to get the notification status counts per notification type and service for all service for a given date range.
The query follows the same pattern as the other queries, getting the statistics from the fact_notification_status table for dates older than today and union that with today.
Tests required.
2018-12-31 16:08:08 +00:00
Leo Hemsted
b80beab76c use ft_notification_status and notifications for job statistics
we previously always read from NotificationHistory to get the
notification status stats for a job. Now, if the job is more than three
days old read from ft_notification_status table, otherwise read from
the notifications table (to keep live updates).
2018-12-12 13:27:19 +00:00
Rebecca Law
c766febe94 Update /platform-stats to return the data from ft_notification_status, that way the request should not time out for a long date range.
Next steps is to update the query for platform admin stats for all services.
2018-12-03 15:46:44 +00:00
Pea Tyczynska
c146b86643 Adjust attribute key names and data types to work with format_statistics 2018-11-06 13:30:37 +00:00
Pea Tyczynska
c37c399741 Add results for notification stats for last 7 days and today 2018-11-06 11:57:08 +00:00
Pea Tyczynska
8a3dc8e039 Refactor 2018-10-30 17:15:15 +00:00
Pea Tyczynska
9015ffef48 Fetch notification statistics for last 7 days frpm FactNotificationStatus 2018-10-30 16:31:57 +00:00
Leo Hemsted
1589bb58bb make sure test keys are filtered out of stats 2018-07-03 14:58:32 +01:00
Leo Hemsted
089056ef72 add tests for new statistics and fact notification status functions 2018-07-03 14:58:32 +01:00
Rebecca Law
1ab4654396 Fix codestyle 2018-06-20 16:54:12 +01:00
Rebecca Law
709a6c38c7 Created a task to update ft_notification_status for the last three days. 2018-06-20 16:45:20 +01:00