APM not showing data in Kibana when running app through gunicorn wsgi

No data is being shown in Kibana UI or APM server logs if I run the app in production using gunicorn WSGI but if I run it through command line with the same settings, it works fine.

Kibana version: 7.4.1

Elasticsearch version: 7.4.1

APM Server version: 7.4.1

APM Agent language and version: Python 5.2.2

Browser version: Safari 13.0.2

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Curl to download page. It's a fresh install.

Steps to reproduce:

  1. Create a basic flask app and begin and end a transaction in an API.
  2. Run it as gunicorn wsgi:app gunicorn_file.py
  3. Hit the Flask API url.

Errors in browser console (if relevant):

There are no errors but there also aren't any APM server logs that the events are being sent to the server. Consequently no data in the Kibana UI.

Provide logs and/or server output (if relevant):

If RUM enabled:

{"request_id": "2838cae6-2a85-427e-8b7d-2a0376cb9b0a", "method": "POST", "URL": "/config/v1/agents", "content_length": 49, "remote_address": "127.0.0.1", "user-agent": "elasticapm-python/5.2.2", "response_code": 200}

Else:

{"request_id": "2838cae6-2a85-427e-8b7d-2a0376cb9b0a", "method": "POST", "URL": "/config/v1/agents", "content_length": 49, "remote_address": "127.0.0.1", "user-agent": "elasticapm-python/5.2.2", "response_code": 403, "error": "forbidden request: endpoint is disabled"}

I was able to resolve this by removing pre_load = True from the gunicorn file.
Welcome to any other solutions that'll help me get around this.

Thanks for posting your issue, @umarriqbal! Since you also posted an issue I'm going to follow up there, primarily, but wanted to welcome you to the forum (and leave a bread crumb for future visitors to this post).