Restful Api developed with Flask using Prometheus and Grafana for monitoring and containerization with Docker :rocket:

Overview

School of Athena

Hephaestus 🚀

  • In Greek mythology, Hephaestus was either the son of Zeus and Hera or he was Hera's parthenogenous child. ... As a smithing god, Hephaestus made all the weapons of the gods in Olympus. He served as the blacksmith of the gods, and was worshipped in the manufacturing and industrial centres of Greece, particularly Athens.

Get Started 🚀

  • An Restful Api project developed with Flask.

  • I used Prometheus and Grafana for monitoring and containerization with Docker.

Monitoring

  • Using Prometheus Flask exporter This library provides HTTP request metrics to export into Prometheus. It can also track method invocations using convenient functions.

  • Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.

containerization

  • Docker hosts and containers monitoring with Prometheus, Grafana, Flask, MySQL.

  • To run the project you need docker-compose and run this command:

docker-compose up -d
  • To stop:
docker-compose down

Requirements 🚀

Installation

  • Get started by cloning the repository :
git clone https://github.com/yezz123/Hephaestus
pip install -r requirements.txt
  • Then in your app/init.py change the MYSQL connection :

or you can use wait for mysql to launch and connect to your mysql Provider.

db = SQLAlchemy()

SQLALCHEMY_DATABASE_URI = "mysql+pymysql://username:password@db/Database_db"
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False

Notes : You can Change the SQLALCHEMY Database to SQLite for example :

SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/test.db"

Curl

  • Curl is used in command lines or scripts to transfer data.

Routes

  • "/" : show information's about what routes are available.

  • "/fibonacci/" : the n-th fibonacci number.

  • "/power//" : show power of first number to second number

  • "/factorial/" : show the factorial of a number

  • "/get_requests" : show all requests saved in DB

  • "/metric" : show metrics

Ports

  • On port 9090 is a instance of Prometheus that collect metrics from the Flask app.

  • On port 3000 is an instance of Grafana that displays the data collected by Prometheus (user: admin, pass: admin).

  • To see the Grafana dashboard:

  • localhost:3000/grafana

Contributing

  • Contributions are welcome ❤️

  • Please share any features, and add unit tests!

  • Use the pull request and issue systems to contribute.

Credits & Thanks 🏆

Medium Twitter Discord

You might also like...
Prometheus exporter for several chia node statistics
Prometheus exporter for several chia node statistics

prometheus-chia-exporter Prometheus exporter for several chia node statistics It's assumed that the full node, the harvester and the wallet run on the

Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python Examples. The beyonic APIs Doc Reference: https://apidocs.beyonic.com/ To start using the Beyonic API Python API, you need to start

Cookiecutter API for creating Custom Skills for Azure Search using Python and Docker

cookiecutter-spacy-fastapi Python cookiecutter API for quick deployments of spaCy models with FastAPI Azure Search The API interface is compatible wit

Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⭐

FRDP Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⛏ . Getting Started Fe

This is an API developed in python with the FastApi framework and putting into practice the recommendations of the book Clean Architecture in Python by Leonardo Giordani,

This is an API developed in python with the FastApi framework and putting into practice the recommendations of the book Clean Architecture in Python by Leonardo Giordani,

Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.
Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.

Flask-vs-FastAPI Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks. IntroductionIn Flask is a popular mic

🍃 A comprehensive monitoring and alerting solution for the status of your Chia farmer and harvesters.
🍃 A comprehensive monitoring and alerting solution for the status of your Chia farmer and harvesters.

chia-monitor A monitoring tool to collect all important metrics from your Chia farming node and connected harvesters. It can send you push notificatio

Fastapi performans monitoring

Fastapi-performans-monitoring This project is a simple performance monitoring for FastAPI. License This project is licensed under the terms of the MIT

Owner
Yasser Tahiri
Backend Developer 👨🏼‍💻 who speaks @python. 🐍 Creator of @BnademOverflow. I love Open Source & Ancient Greece.
Yasser Tahiri
CURSO PROMETHEUS E GRAFANA: Observability in a real world

Curso de monitoração com o Prometheus Esse curso ensina como usar o Prometheus como uma ferramenta integrada de monitoração, entender seus conceitos,

Rafael Cirolini 318 Dec 23, 2022
A RESTful API for creating and monitoring resource components of a hypothetical build system. Built with FastAPI and pydantic. Complete with testing and CI.

diskspace-monitor-CRUD Background The build system is part of a large environment with a multitude of different components. Many of the components hav

Nick Hopewell 67 Dec 14, 2022
:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.

Project generator and manager for FastAPI. Source Code: View it on Github Features ?? Creates customizable project boilerplate. Creates customizable a

Yagiz Degirmenci 1k Jan 2, 2023
Prometheus exporter for metrics from the MyAudi API

Prometheus Audi Exporter This Prometheus exporter exports metrics that it fetches from the MyAudi API. Usage Checkout submodules Install dependencies

Dieter Maes 7 Dec 19, 2022
OpenAPI for Todolist RESTful API

swagger-client OpenAPI for Todolist RESTful API This Python package is automatically generated by the Swagger Codegen project: API version: 1 Package

Iko Afianando 1 Dec 19, 2021
Fetching Cryptocurrency Prices from Coingecko and Displaying them on Grafana

cryptocurrency-prices-grafana Fetching Cryptocurrency Prices from Coingecko and Displaying them on Grafana About This stack consists of: Prometheus (t

Ruan Bekker 7 Aug 1, 2022
Prometheus exporter for Starlette and FastAPI

starlette_exporter Prometheus exporter for Starlette and FastAPI. The middleware collects basic metrics: Counter: starlette_requests_total Histogram:

Steve Hillier 225 Jan 5, 2023
Prometheus exporter for Starlette and FastAPI

starlette_exporter Prometheus exporter for Starlette and FastAPI. The middleware collects basic metrics: Counter: starlette_requests_total Histogram:

Steve Hillier 82 Feb 13, 2021
Prometheus integration for Starlette.

Starlette Prometheus Introduction Prometheus integration for Starlette. Requirements Python 3.6+ Starlette 0.9+ Installation $ pip install starlette-p

José Antonio Perdiguero 229 Dec 21, 2022
Prometheus integration for Starlette.

Starlette Prometheus Introduction Prometheus integration for Starlette. Requirements Python 3.6+ Starlette 0.9+ Installation $ pip install starlette-p

José Antonio Perdiguero 125 Feb 13, 2021