Skip to main content

A plug-and-play performance monitoring tool for FastAPI with a real-time dashboard.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

FastAPI Performance Monitor

CI codecov PyPI version PyPI - Python Version PyPI - License

A simple, plug-and-play performance monitoring tool for FastAPI applications, providing real-time metrics and a dashboard with zero configuration.


╔═════════════════════════════════════════════════════════════════════════════╗
║ FastAPI Performance Dashboard                                                 ║
╠════════════════════════════════╦════════════════════════════════════════════╣
║ SLA ComplianceOverall Metrics                            ║
║   Latency SLA Met: true         ║   Total Requests: 1,245                      ║
║   Availability SLA Met: true    ║   Success Count: 1,230 (98.8%)               ║
║                                ║   Error Count: 15 (1.2%)                     ║
╠════════════════════════════════╩════════════════════════════════════════════╣
║ Endpoint Metrics (GET /items/{item_id})                                 ║
╠════════════════════════════════╦════════════════════════════════════════════╣
║   Total Requests: 834          ║   P50 Response Time: 52 ms                   ║
║   Success Count: 830           ║   P90 Response Time: 110 ms                  ║
║   Error Count: 4               ║   P95 Response Time: 154 ms                  ║
║                                ║   P99 Response Time: 230 ms                  ║
╚════════════════════════════════╩════════════════════════════════════════════╝

Features

  • Zero Configuration: Add a single line of code to your app to get started.
  • Real-time Metrics: Tracks total requests, success/error counts, and error rates.
  • Latency Percentiles: Calculates P50, P90, P95, and P99 response times to give you a clear picture of your application's responsiveness.
  • SLA Monitoring: Automatically determines if your application is meeting its latency and availability service-level agreements (SLAs).
  • Interactive Dashboard: A clean, real-time dashboard to visualize all performance metrics.
  • Lightweight: Designed to have a minimal performance impact on your application.

Installation

pip install fastapi-performance-monitor

Quick Start

In your main application file, import add_performance_monitor and apply it to your FastAPI app instance.

# main.py
from fastapi import FastAPI
from fastapi_performance_monitor import add_performance_monitor
import time
import random

app = FastAPI()

# Add this single line to enable the monitor
add_performance_monitor(app)

@app.get("/")
def read_root():
    # Simulate some work
    time.sleep(random.uniform(0.05, 0.5))
    return {"message": "Hello World"}

@app.get("/error")
def cause_error():
    raise ValueError("This is a test error")

Once your application is running, the following endpoints will be available:

  • Performance Dashboard: http://localhost:8000/performance
  • Metrics API Endpoint: http://localhost:8000/health/metrics

The dashboard provides a user-friendly interface to view the metrics, while the JSON endpoint allows for programmatic access, perfect for integrating with alerting or other monitoring systems.

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

fastapi_performance_monitor-0.1.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

fastapi_performance_monitor-0.1.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_performance_monitor-0.1.2.tar.gz.

File metadata

File hashes

Hashes for fastapi_performance_monitor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ddaa01655c466e5e0a5c8ef6e4dd8bb075ccf17be7d710d74289ed948880ec00
MD5 7ab2167af4e52914c60e92d531c6f799
BLAKE2b-256 6628f39223c07d5145db054a0700e3b8b6ef711b00f18ca223f4edb76992f696

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_performance_monitor-0.1.2.tar.gz:

Publisher: publish.yml on parhamdavari/fastapi-performance-monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastapi_performance_monitor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_performance_monitor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4065ee3255258c56ab3afb6df28fda7c68f03e44c8d3d4cbe200b466b05fc5
MD5 258f19663da09f8249eb685352de6e12
BLAKE2b-256 b0b783f0a3bda19c9f151751720ca0663d05bbd9e6973a6b0631512256aa6fc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_performance_monitor-0.1.2-py3-none-any.whl:

Publisher: publish.yml on parhamdavari/fastapi-performance-monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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