Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/favourdaniel/monitor-flask-app-metrics-with-prometheus-format
https://github.com/favourdaniel/monitor-flask-app-metrics-with-prometheus-format
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/favourdaniel/monitor-flask-app-metrics-with-prometheus-format
- Owner: FavourDaniel
- Created: 2023-11-22T12:47:39.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-27T05:39:58.000Z (12 months ago)
- Last Synced: 2023-11-27T06:37:37.167Z (12 months ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Monitor-Flask-App-metrics-with-Prometheus-format
This is a simple Flask application that exposes metrics in Prometheus format using the [prometheus_flask_exporter](https://github.com/rycus86/prometheus_flask_exporter).
To run the app, you need to have Python and pip installed on your machine, then install the required dependencies.## Steps to run Flask app
1. Activate your virtual environment (if not already activated)
```
source venv/bin/activate # On macOS or Linux
```
2. Install required packages
```
python -m pip install flask prometheus_flask_exporter
python -m pip install requests
```
3. Start the flask application
```
python app.py
```
The different endpoints for the application are `127.0.0.1:5000/one`, `127.0.0.1:5000/two`, `127.0.0.1:5000/three`, `127.0.0.1:5000/four` and `127.0.0.1:5000/error`.4. In a new terminal, start the generator
```
python app-generator.py
```
It will be used in generating request for the Flask application at the different endpoints.5. Send the metrics to a monitoring tool for visualization. You can do this with OpenTelemetry and SigNoz, read the article [here](https://signoz.io/blog/opentelemetry-collector-prometheus-receiver/).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbzf58qelvvm2tmb4mn6.png)