Export metrics from your Python Flask application to Prometheus in Kubernetes and watch your metrics data with Grafana

When developing your Flask application some of the hard to know is how your application health is and how many requests you receive on what path in your application.

Overtime monitoring becomes increasingly important to know how to use and share metrics between your application Developer team and the DevOps team to get more insight into how the application works.

In my case, I use Flask in Python for API applications, Prometheus as a metrics scraper, Grafana as visualizer monitoring, and Kubernetes as a container cluster.

To share metrics from your Flask application you can use prometheus-flask-exporter and include it in your Flask app, I have created a straightforward Flask app for this demo.

When you have created your Flask API application you can run this on your local machine and see if it's working, visit the /simple path first, and then visit the /metrics path to watch all the metrics you received from your application.

--

--

Paris Nakita Kejser
DevOps Engineer, Software Architect and Software Developering

DevOps Engineer, Software Architect, Software Developer, Data Scientist and identify me as a non-binary person.