Add a task in errorreports app that will report all the errors to our telemetry server
Description and outcomes
As of now most of the errors are traced and are stored in ErrorReports model, so we shall be able to report those errors to our telemetry server.
Create a task ping_error_report() inkolibri/core/errorreports/tasks/ that will be using ErrorReports.get_unsent_errors() to query unsent errors from ErrorReports and then make a post request to our telemetry API (to be implemented yet) with the errors. The JSON request structure will be:
After the task is created, enqueue it when our current ping_back mechanism has been successfully executed. So the enqueue can be done in a try/catch block within a try/catch block in kolibri.core.analytics.tasks._ping(). So the basic workflow will remain, if ping_back is successful, we enqueue errorr eport task, if error report fails we do nothing, so when ping_back is again enqueued and successful, the error-report task is enqueued again.
After posting the errors, mark each posted error as sent(set sent of ErrorReport as true) using mark_as_sent() method
Acceptance Criteria
ping_error_report() task created in errorreports/tasks.py.
Error are marked as sent once reported
The task is properly enqueued in kolibri.core.analytics.tasks._ping() when ping_once is successful
Tests are written to ensure:
When the ping_back mechanism is successful, it enqueues ping_error_report()
When the task is enqueued, it filters unsent errors and makes a proper 200 request to the telemetry API
Assumptions and Dependencies
As the telemetry API is not implemented, TDD should be followed.
Scope
Creating the task and registering it
Enqueuing the task in _ping()
Out-of-Scope:
Implementing telemetry API to receive the post request
Overview
Add a task in errorreports app that will report all the errors to our telemetry server
Description and outcomes
ErrorReports
model, so we shall be able to report those errors to our telemetry server.ping_error_report()
inkolibri/core/errorreports/tasks/
that will be usingErrorReports.get_unsent_errors()
to query unsent errors fromErrorReports
and then make a post request to our telemetry API (to be implemented yet) with the errors. The JSON request structure will be:ping_back
mechanism has been successfully executed. So the enqueue can be done in a try/catch block within a try/catch block inkolibri.core.analytics.tasks._ping()
. So the basic workflow will remain, ifping_back
is successful, we enqueue errorr eport task, if error report fails we do nothing, so whenping_back
is again enqueued and successful, the error-report task is enqueued again.sent
ofErrorReport
as true) usingmark_as_sent()
methodAcceptance Criteria
ping_error_report()
task created inerrorreports/tasks.py
.ping_back
mechanism is successful, it enqueuesping_error_report()
Assumptions and Dependencies
Scope
_ping()
Out-of-Scope:Accessibility Requirements
NA
Resources