Django 2.2 uncaught exceptions not being sent
See original GitHub issueDescribe the bug: …
I am not sure if it is a bug, because reading the documentation I was not able to find any explicit information talking about uncaught exceptions with Django (only with Flask), but all non handled exceptions are not being sent to APM server. However, running the test command (python manage.py elasticapm test
) the event is sent successfully
Environment (please complete the following information)
- OS: Linux (Docker image python:3.7.4)
- Python version: 3.7.4
- Framework and version [e.g. Django 2.1]: Django 2.2
- APM Server version: v7.5.0
- Agent version: 5.3.2
How to reproduce In order to tests the uncaught exceptions I did the following tests:
- Manually inserted an
raise ZeroDivisionError('APM TEST')
in one of my functions outside anytry/catch/
- Executed
raise ZeroDivisionError('APM TEST')
using python shell (python manage.py shell
)
Additional context
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'elasticapm.contrib.django',
...
]
MIDDLEWARE = [
'elasticapm.contrib.django.middleware.TracingMiddleware',
'elasticapm.contrib.django.middleware.Catch404Middleware',
...
]
ELASTIC_APM = {
'SERVICE_NAME': 'MYSERVICE',
'SECRET_TOKEN': 'SECRETTOKEN,
'SERVER_URL': 'SERVERURL', # noqa
'DEBUG': True
}
Running check command
root@26cb7a8c0615:/usr/src/app# python manage.py elasticapm check
Service name is set, good job!
SERVER_URL https://APM_ADDR:443 looks fine
DEBUG mode is disabled! Looking good!
Tracing middleware is configured! Awesome!
Looks like everything should be ready!
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
How to manage error reporting | Django documentation
Error reports are really helpful for debugging errors, so it is generally useful to record as much relevant information about those errors as...
Read more >Sentry not logging unhandled exceptions from django
Going to a simple view that deliberately raises an exception results in an event being logged from app01, but from app02 nothing is...
Read more >How to log uncaught exceptions in Flask routes with logging?
However, sometimes your Flask routes may encounter uncaught exceptions that cause your application to crash or return an error response.
Read more >Celery tasks uncaught exceptions not being sent to Sentry
Django : Celery tasks uncaught exceptions not being sent to Sentry [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >Handling Application Errors — Flask Documentation (2.2.x)
Unhandled Exceptions ¶ ... When there is no error handler registered for an exception, a 500 Internal Server Error will be returned instead....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @basepi, Here is the PR https://github.com/elastic/apm-agent-python/pull/943
I will add some tests, but before I would like to make sure that the behavior implemented fits your requirements.
Hey @romulorosa I still think this would be a cool addition. Would you mind opening a PR? Will be easier not to lose track of that way (rather than just a link to a diff).