Sending data even with Django DEBUG=True
See original GitHub issueSetting Django DEBUG to True does not stop elastic agent from sending data to APM.
django.VERSION = (2, 2, 10, 'final', 0)
elastic-apm==5.4.3
This all runs in a docker image python:3.8.2
APM server is hosted at Elastic Cloud (they pointed me here), I don’t see where to check version, but since it was deployed 2 weeks ago, it should be the latest version (at least there is no option to update right now).
My tests:
lr@lr-local:~/app/kernelratings$ ./manage.py elasticapm check
[2020-03-26 14:58:51,341|INFO|customers.apps] Loading all registries...
[2020-03-26 14:58:55,294|INFO|customers.apps] Loaded all registries in 3.95 seconds!
Service name is set, good job!
SERVER_URL https://************************.apm.eu-west-1.aws.cloud.es.io looks fine
Looks like you're running in DEBUG mode. ElasticAPM will NOT gather any data while DEBUG is set to True.
If you want to test ElasticAPM while DEBUG is set to True, you can force ElasticAPM to gather data by setting ELASTIC_APM["DEBUG"] to True, like this
ELASTIC_APM = {
"DEBUG": True,
# your other ELASTIC_APM settings
}
Tracing middleware is configured! Awesome!
Please fix the above errors.
Then, I go to Kibana --> APM and I can see there is data sent from that container. I check the container-id reported in APM and it is the id of the container that reported the message pasted above (checked with “docker ps”)
If I totally remove the ELASTIC_APM setting (whiwle keeping Django DEBUG=True) and re-run Django, it shows errors (elastic-apm is then trying to connect to localhost…) all the time like these:
[2020-03-24 11:03:51,771|WARNING|urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3afa00fa30>: Failed to establish a new connection: [Errno 111] Connection refused')': /intake/v2/events
[2020-03-24 11:03:39,133|WARNING|urllib3.connectionpool] Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3afa110940>: Failed to establish a new connection: [Errno 111] Connection refused')': /config/v1/agents
- requirements.txt:
numpy==1.18.1
scipy==1.4.1
scikit-learn==0.22.1
pandas==1.0.1
sklearn-pandas==1.8.0
xgboost==0.81
amqp==2.5.2
argparse==1.4.0
billiard==3.6.3.0
boto==2.49.0
boto3==1.12.7
celery==4.4.1
certifi==2019.11.28
cffi==1.14.0
cryptography==2.8
cython==0.29.15
elastic-apm==5.4.3
Django==2.2.10
django-ace-overlay==0.8.0
django-appconf==1.0.3
django-bootstrap-toolkit==2.15.0
django-celery-beat==2.0.0
django-celery-results==1.2.1
django-compressor==2.4
django-extensions==2.2.8
django-health-check==3.12.1
django-mysql==3.3.0
django-redis==4.11.0
django-statsd-mozilla==0.4.0
django-storages==1.9.1
django-timezone-field==4.0
django-tracking2==0.5.0
docopt==0.6.2
gender-guesser==0.4.0
google-api-python-client==1.7.8
google-measurement-protocol==1.0.0
gunicorn==19.9.0
ipython==7.13.0
jinja2==2.10.1
joblib==0.14.1
jsonschema==3.0.2
kombu==4.6.8
libsaas==0.4
maxminddb==1.4.1
meld3==2.0.0
mysqlclient==1.4.6
ndg-httpsclient==0.5.1
nltk==3.4.4
openpyxl==3.0.3
Pillow==6.1.0
psutil==5.6.3
pycparser==2.19
pycurl==7.43.0.3
Pygments==2.4.2
pymailcheck==1.0.0
pyOpenSSL==19.0.0
python-dateutil==2.8.1
pytz==2019.3
pyzmq==18.1.0
redis==3.4.1
requests==2.23.0
rollbar==0.14.7
setproctitle==1.1.10
simple-salesforce==0.74.2
six==1.12.0
South==1.0.2
statsd==3.3.0
tornado==6.0.3
ua-parser==0.7.1
Unidecode==1.1.1
urllib3==1.25.6
user_agents==1.1.0
xlrd==1.2.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Django Error Reporting Email when Debug = True
If you only have one email, make sure you have a comma in the list: ADMINS = (('Admin', 'admin@my-domain.com'),). I tried these and...
Read more >Logging - Django documentation
The logging system handles potentially sensitive information. For example, the log record may contain information about a web request or a stack trace,...
Read more >Developing with asyncio — Python 3.11.1 documentation
Debug Mode : By default asyncio runs in product... ... While a Task is running in the event loop, no other Tasks can...
Read more >Django Tutorial Part 11: Deploying Django to production
DEBUG . This should be set as False in production ( DEBUG = False ). This stops the sensitive/confidential debug trace and variable ......
Read more >Python and Django tutorial in Visual Studio Code
(All operating systems) A download from Anaconda (for data science purposes). ... The "django": true entry also tells VS Code to enable debugging...
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 Free
Top 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
I finally found that these settings disable all the attempts to connect to APM:
Hi @xavier-lr
The
recording
flag that @basepi mentioned is almost finished and available in PR #790. Would you mind giving that a try to see if it fulfills your use case? You can install it like this:Then you can set
enabled
to false to completely disable the agent. We will deprecateactive
in one of our next releases.