Missing Flask requests?

Hi, I am trying my first Python-APM Flask example. I have pretty basic code:

# app.py
from flask import Flask  
from elasticapm.contrib.flask import ElasticAPM

app = Flask(__name__) # name for the Flask app (refer to output)
# running the server

APM_SERVER = 'https://localhost:8200'
app.config['ELASTIC_APM'] = {
    'SERVICE_NAME': 'ScottFlask',
    'SERVER_URL': APM_SERVER
}
apm = ElasticAPM(app)

@app.route("/", methods=['GET', 'POST', 'PUT']) # decorator
def home(): # route handler function
    # returning a response
    return "Hello World!"
app.run(debug = True) # to allow for debugging and auto-reload

And I am seeing general metrics getting posted, but when I hit the route with my browser, I am not seeing anything getting logged for that. And I was expecting some form of automatic instrumentation to happen.

I am running Python 3.10 and I am running 2.0.0 version of Flask. 6.10.1 of the elastic-apm, and my cluster is running 8.2

OK, I figured it out. I was running in debug mode. Very subtle!

1 Like

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