Disable Django APM agent

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

Kibana version: 7.6

Elasticsearch version: 7.6

APM Server version: 7.6

APM Agent language and version: python, elastic-apm==5.5.2

Browser version: Google Chrome , Version 81.0.4044.138

Original install method (e.g. download page, yum, deb, from source, etc.) and version:

Django project that run in different environments (prod, staging, test, local). I want to disable APM agent in some envs.

  • ELASTIC_APM['DISABLE_SEND'] = True - doesn't help. Still receive "response_code": 401, "error": "unauthorized" errors in APM server.
  • ELASTIC_APM['ENABLED'] = False - (found this somewhere) - doesn't help too
  • ELASTIC_APM['SERVER_URL'] = '' - not sure that its good idea, as agent still operate (probably).

What is the proper way to disable APM python agent?

Welcome @Taras_Slyvka!

The easiest way to completely disable the agent is actually one that you tried:

This was introduced in v5.6.0. If you upgrade, it should work!

Hope that helps!

Thank you for this response.

Should I use ELASTIC_APM['ENABLED'] = False in combination with ELASTIC_APM['DISABLE_SEND'] = True?

In case when only one flag being used ELASTIC_APM['ENABLED'] = False - there is trying to send data in the case when an error happens.

Thanks, Taras.

If you're on 5.6.0 and ENABLED is False, there should be no data sent by the agent. If you're still seeing agent activity, it's a bug, and we'd love to help solve it. Can you open an issue here?