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

Add a task in errorreports that reports all the errors to our telemetry server #12356

Closed
Tracked by #12214
akolson opened this issue Jun 25, 2024 · 3 comments
Closed
Tracked by #12214
Assignees
Labels
DEV: backend Python, databases, networking, filesystem... gsoc A GSoC project task

Comments

@akolson
Copy link
Member

akolson commented Jun 25, 2024

Overview

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:
    • For Eg:
[
  {
    "error_from": "frontend",
    "error_message": "custom message",
    "traceback": "custom traceback",
    "first_occurred": "2024-06-25T11:20:09.074Z",
    "last_occurred": "2024-06-25T11:20:09.074Z",
    "no_of_errors": 1
  },
  {
    "error_from": "backend",
    "error_message": "custom message",
    "traceback": "custom traceback",
    "first_occurred": "2024-06-25T11:20:09.074Z",
    "last_occurred": "2024-06-25T11:20:09.074Z",
    "no_of_errors": 1
  }
]
  • 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

Accessibility Requirements

NA

Resources

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

akolson commented Jun 25, 2024

@thesujai

@thesujai
Copy link
Contributor

Ready to go

@akolson
Copy link
Member Author

akolson commented Jul 1, 2024

Closed by #12357

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