Skip to main content

Monpi is a dead simple, lightweight, plug‑and‑play monitoring middleware for FastAPI applications. It intercepts every request and response and send automated discord messages via webhooks for every server side exception and HTTP Status code 5xxs

Project description

Monpi – FastAPI Monitoring Middleware

Python Version FastAPI

Monpi is a dead simple, lightweight, plug‑and‑play monitoring middleware for FastAPI applications. It intercepts every request and response and send automated discord messages via webhooks for every server side exception and HTTP status code 500 and above , i.e , server erros

Features

  • Request/Response tracking – Stores URL, HTTP method, response time, status code
  • Discord alerts – sends detailed error notifications for 5xx status codes or unhandled exceptions
  • In‑memory data store – keeps a rolling history of the last N requests (configurable)
  • Built‑in endpoints/monitor/data and /monitor/health to inspect collected metrics
  • Zero‑overhead – uses async middleware that doesn’t block your endpoints

Installation

pip install monpi    

Quick Start

from fastapi import FastAPI
from monpi.middleware import Monitor

app = FastAPI

monitor = Monitor(app = app,
                  save_limit = 1000,   //Save data of last 1000 request-response cycle, By default set to 100
                  aleart=True,           //Optional If aleart set to true you must provide discord webhooks url
                  discord_webhook = "your_discord_server_webhook_url"
                  )


After starting application you can for data in the following GET Endpoints

{BASE_URL}/monpi/data  //Returns Request ID, URL, Method, Response time

{BASE_URL}/monpi/health //Returns CPU and RAM usage percentage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monpi-0.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monpi-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file monpi-0.0.2.tar.gz.

File metadata

  • Download URL: monpi-0.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for monpi-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ca827f56ef63db6aa6770945c6540914dc2784b7355a58771f3cea69580ba39e
MD5 643f686df9666adf04eefccb505ef5ec
BLAKE2b-256 a8117e00e4003199794b818adacaf61ec9f91f3ba9d4269a892cd2431b05d781

See more details on using hashes here.

File details

Details for the file monpi-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: monpi-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for monpi-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 569cc187ee4bbf7ecc300f72146d0c602405f822c1d72caa4acc22ab1230c6b4
MD5 b777bdd80986fdadfcd4809a9fb1483e
BLAKE2b-256 39f0c8e91d1b315ed4d7b775f40419572b7448d8cdec1a5f678937e971e89a47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page