Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the ErrorReports model to have more context on errors #12376

Open
Tracked by #12214
akolson opened this issue Jun 28, 2024 · 2 comments
Open
Tracked by #12214

Update the ErrorReports model to have more context on errors #12376

akolson opened this issue Jun 28, 2024 · 2 comments
Assignees
Labels
DEV: backend Python, databases, networking, filesystem... gsoc A GSoC project task

Comments

@akolson
Copy link
Member

akolson commented Jun 28, 2024

Overview

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.
    • 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 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"
}
- `ContextFrontendValidator`
{
  "release_version": "0.3",
  "request_info": {
    "url": "",
    "method": "",
    "headers": "",
    "query_params": ""
  },
  "server": {
    "host": "",
    "port": ""
  },
  "installed_packages": "(looks redundant, as release_version will be sufficient )",
  "python_version": ""
}
  • 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
  • Updating the test cases

Accessibility Requirements

NA

Resources

@akolson akolson added DEV: backend Python, databases, networking, filesystem... gsoc A GSoC project task labels Jun 28, 2024
@akolson akolson added this to the Distributed Error Reporting milestone Jun 28, 2024
@akolson
Copy link
Member Author

akolson commented Jun 28, 2024

@thesujai

@thesujai
Copy link
Contributor

Yup ready to take this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... gsoc A GSoC project task
Projects
None yet
Development

No branches or pull requests

2 participants