gunicorn + flask,kibana show no data
See original GitHub issueDescribe the bug: …
To Reproduce
- … gunicorn worker-class gevent
- …flask
- …elastic-apm 6.4.0
- …
Environment (please complete the following information)
- OS: [e.g. Linux]Linux
- Python version: 3.6.8
- Framework and version [e.g. Django 2.1]:
- APM Server version:7.3.1
- Agent version:
Additional context my flask flask_extensions.py code:
from flask import Flask
from elasticapm.contrib.flask import ElasticAPM
from config import config
flask_app = Flask(__name__)
flask_app.config.from_object(config)
flask_app.config['ELASTIC_APM'] = {
'SERVICE_NAME': 'flask',
'SECRET_TOKEN': 'xxx',
'SERVER_URL': 'http://localhost:8200',
}
apm = ElasticAPM()
apm.init_app(flask_app)
app.py content.
from flask_extensions import flask_app
if __name__ == '__main__':
flask_app.run(host='0.0.0.0', port=8000, debug=False)
example a:
run shell python app.py
, after that, kibana can show some data.
example b: run shell
gunicorn --access-logfile - --error-logfile - \
--workers 32 \
--timeout 300 \
--threads 2 \
--bind 0.0.0.0:8000 \
--worker-class gevent \
--worker-connections 2000 \
app:flask_app \
2>&1 | tee ./backend_log.log
after that ,request the same url ,but can see nothing on kibana. i have tried change to pre_load = False or preload_app = False, but no effect.
Add any other context about the problem here.
-
Agent config options
Click to expand
replace this line with your agent config options remember to mask any sensitive fields like tokens
-
requirements.txt
:Click to expand
replace this line with your `requirements.txt`
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
APM not showing data in Kibana when running app through ...
Create a basic flask app and begin and end a transaction in an API. Run it as gunicorn wsgi:app gunicorn_file.py. Hit the Flask...
Read more >gunicorn - unknown log output to console - Stack Overflow
I have set these two loggers in my config file and they work well, but there is still an unexpected log record printed...
Read more >Logging From Flask Application To ElasticSearch Via Logstash
In this blog post, I will explain how to send logs from Flask application to Elasticsearch via Logstash. As a bonus, I will...
Read more >Monitoring Python Applications with Elastic APM
A guide to monitoring Flask, FastAPI and Python Applications with Elastic APM and Kibana.
Read more >Get Application Performance Metrics on Python Flask With ...
This is just simple request paths to demonstrate the metrics via APM (Application Performance Monitoring) on Kibana. Install Flask and APM Agent.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Alsheh ah, good to know. We document this requirement (e.g. https://www.elastic.co/guide/en/apm/agent/python/current/flask-support.html#flask-installation), so I don’t think there’s much more we can do here.
I’m closing this, as I wasn’t able to reproduce any issues specific to gunicorn/flask.