Weird specifc Flask App not sending monitoring data to APM

Hi all,

I have 3 Python Flask API running on AWS and a EC2 running ES and APM. 2 APIs are sending data to APM correctly, but one is not.

It's weird, because all 3 API uses same Flask, Flask-RESTful and elastic-apm[flask] versions. They use the same ELASTIC_APM, changing only the SERVICE_NAME. Im not using SECRET_TOKEN. All EC2 are in the same region and they all use the same security group.

I can confirm that the EC2, where the bugged API is, can connect to APM server because I run an ipyhton on the API virtualenv and use the apm created by the API to send an apm.capture_message() with success. If I put an apm.capture_message() or an apm.capture_exception(), these are sent correctly too. The automatic monitoring data is that are not going to the apm-server.

I tailed the apm-server log and the data are not getting there, so I'm strongly believing the problem is in the Flask API. There are differences between the APIs and I think some package in this API are not working well with APM Agent.

I need help to figure out what's going on. I can send more information if you needed. I don't want to put everything here to make this clean, but I can post the pip freeze and the general initialization of Flask API for both environments if this could help.

ty!

Hi Márcio!

The Python agent should log any issues it has sending data to an elasticapm.errors logger. Depending on how exactly your logging is set up (which tends to be different from Flask app to Flask app), you need to add a handler for this logger to see its output.

BTW, which app server do you use? If you're on uWSGI, make sure to enable threading.

Failing that, your requirements.txt and initialization code could indeed help with resolving your problem :slight_smile:

Cheers
Beni

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.