Skip to content

Commit

Permalink
update erroreports task to report more fields
Browse files Browse the repository at this point in the history
  • Loading branch information
thesujai authored and akolson committed Jul 1, 2024
1 parent c713fad commit da7f8f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions kolibri/core/errorreports/tasks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import json
import logging

import requests
from django.core.serializers.json import DjangoJSONEncoder
from django.db import connection
from requests.exceptions import ConnectionError
from requests.exceptions import RequestException
Expand All @@ -20,12 +18,16 @@ def serialize_error_reports_to_json_response(errors):
for error in errors:
errors_list.append(
{
"error_from": error.error_from,
"category": error.category,
"error_message": error.error_message,
"traceback": error.traceback,
"first_occurred": error.first_occurred,
"last_occurred": error.last_occurred,
"no_of_errors": error.no_of_errors,
"reported": error.reported,
"events": error.events,
"release_version": error.release_version,
"context_frontend": error.context_frontend,
"context_backend": error.context_backend,
}
)
return json.dumps(errors_list, cls=DjangoJSONEncoder)
Expand All @@ -34,7 +36,7 @@ def serialize_error_reports_to_json_response(errors):
@register_task
def ping_error_reports(server):
try:
errors = ErrorReports.get_unsent_errors()
errors = ErrorReports.get_unreported_errors()
errors_json = serialize_error_reports_to_json_response(errors)
requests.post(
join_url(server, "/api/v1/errors/"),
Expand Down
Empty file.

0 comments on commit da7f8f0

Please sign in to comment.