Elastic apm instrumentation not working for my Flask application running in python 3.x

I am unable to find out transaction traces on kibana server after using the apm object like this.

app = Flask(__name__)
app.secret_key = "ahugekey@netcore#2019"
app.config['ELASTIC_APM'] = {
          'SERVICE_NAME': 'onboarding',
          'SERVER_URL': 'http://14.142.143.138:8200'
}
apm = ElasticAPM(app)

Also i want to capture HTTP transaction labels from the code. Please help in the same.

Hi @Ankit_kumar_Srivasta,

Welcome to the community! I can think of a couple of things to check:

  1. Is your Flask app running in debug mode? If so you may need to follow the steps in the docs to set DEBUG for the agent as errors and traces are only sent when the app is not in debug node?
  2. Otherwise, do you see any errors in your logs that look to belong to the agent? It could give an indication of another issue.

Do let us know if either of those help.

Hi, thanks @carly.richmond for the reply. The application is running like this

app.run(host= host,port=port)

I think by default the debug mode flag is False in python.
Still i am facing the same error. I just want to capture labels for two particular end points in kibana using elastic apm server.
Also i dont see any error related to APM agent in the logs.

Hi @Ankit_kumar_Srivasta,

Have you tried setting the debug mode anyway to double check? I assume by no errors in the logs there are no errors in either the APM server or the application logs?

Can you confirm which versions of Flask and Python you're using and that they are in the listed supported versions?

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