Update the current ErrorReports to have more context of errors
Description and Outcomes
The ErrorReports model should be updated to have the following fields. Please note that the descriptions of the fields below remains same as is, with a few name field name changes and new fields.
Define two validators to pass into JSONField as JSON_Schema_Validator in errorreports/validators (create new validators.py). See one of the validators here: link and see how this validator is passed to class: link
ContextFrontendValidator
{
"component": "Applicable for Vue only, will be defaulted to 'Not from Vue'",
"browser": "Chrome, Firefox, etc",
"device": {
"type": "mobile/desktop/or more technical",
"platform": "will be the OS",
"screen": {
"width": "",
"height": ""
}
},
"release_version": "0.3",
"node_version": "1.10.0"
}
Separe insert_or_update_errors() of ErrorReports into two function insert_or_update_frontend() which will be used in errorreports/api.py for frontend error logging and this function shall insert into ErrorReports by storing context into context_frontendand setting the context_backend as None. Another function shall be insert_or_update_backend() which will be used by errorreports/middleware.py to insert into ErrorReports by storing context into context_backend and setting the context_frontend as None.
Update the current errorreports/serializers to handle frontend data appropriately. And update the errorreports/api to use insert_or_update_frontend()
Update the current errorreports/middleware to capture the attributes mentioned in backend validator and use new insert_or_update_backend() to do the insertion to table
Update current kolibri/core/assests/core-app/index.js to capture new attributes in the frontend validator, and update the errorReportsUtils.js to handle the newfields appropriately
Update the current errorreports.tasks.serialize_error_reports_to_json_response to appropriately convert the new ErrorReports and post it into telemetry server
Acceptance Criteria
Model is updated and migrations are done
Validators are defined
API to handle frontend error is updated
Middle to handle backend error is updated
Frontend error tracing is updated with proper edits in errorReportsUtils.js
errorreports.tasks.serialize_error_reports_to_json_response is updated
All test cases should be up-to-date with changes
Assumptions and Dependencies
NA
Scope
Updating Model and migrations
Updating error capturing and inserting mechanism in both frontend and backend to support the validators of new model
Updating errorreports.tasks.serialize_error_reports_to_json_response to properly handle new fields
Overview
Update the current
ErrorReports
to have more context of errorsDescription and Outcomes
error_msg
traceback
first_occured
last_occured
category
(earlier called errorFrom)events
(earlier called no_of_errors)reported
(earlier called sent)context_frontend
- JSONField (new) (Allow null)context_backend
- JSONField (new) (Allow null)Define two validators to pass into
JSONField
as JSON_Schema_Validator inerrorreports/validators
(create newvalidators.py
). See one of the validators here: link and see how this validator is passed to class: linkContextFrontendValidator
ContextFrontendValidator
insert_or_update_errors()
ofErrorReports
into two functioninsert_or_update_frontend()
which will be used inerrorreports/api.py
for frontend error logging and this function shall insert intoErrorReports
by storing context intocontext_frontend
and setting thecontext_backend
asNone
. Another function shall beinsert_or_update_backend()
which will be used byerrorreports/middleware.py
to insert intoErrorReports
by storing context intocontext_backend
and setting thecontext_frontend
asNone
.errorreports/serializers
to handle frontend data appropriately. And update theerrorreports/api
to useinsert_or_update_frontend()
errorreports/middleware
to capture the attributes mentioned in backend validator and use newinsert_or_update_backend()
to do the insertion to tablekolibri/core/assests/core-app/index.js
to capture new attributes in the frontend validator, and update theerrorReportsUtils.js
to handle the newfields appropriatelyerrorreports.tasks.serialize_error_reports_to_json_response
to appropriately convert the newErrorReports
and post it into telemetry serverAcceptance Criteria
errorreports.tasks.serialize_error_reports_to_json_response
is updatedAssumptions and Dependencies
NA
Scope
errorreports.tasks.serialize_error_reports_to_json_response
to properly handle new fieldsAccessibility Requirements
NA
Resources