A fast, non-blocking API analytics and latency tracking middleware for FastAPI.
Project description
Krontos
High-performance API telemetry and analytics middleware for FastAPI.
Krontos is a lightweight, non-blocking telemetry engine that sits inside your FastAPI application. It automatically intercepts all incoming HTTP requests, calculates exact millisecond latency, captures status codes, and securely fires the logs to your analytics dashboard—without ever slowing down your user's response time.
Features
- Zero Latency Overhead: Telemetry payloads are compiled and fired using
asynciobackground tasks. Your users never wait for the analytics engine. - Plug & Play: Drop it into any FastAPI app with exactly one line of code.
- Fail-Safe: Built-in exception handling ensures that if the telemetry server goes offline, your application stays up and running perfectly.
- Comprehensive Metrics: Tracks route paths, HTTP methods, response times, and error rates automatically.
Installation
Install the package via pip:
pip install krontos
(Requires Python 3.8+ and FastAPI)
Quick Start
To start tracking your API, simply import krontosAPI and add it to your FastAPI app as middleware.
You will need an API Key and a Project Name, which you can generate from your Krontos Dashboard.
from fastapi import FastAPI
from krontos import krontosAPI
app = FastAPI(title="My Awesome API")
# 1. Mount the Krontos Tracking Layer
app.add_middleware(
krontosAPI,
api_key="krontosapi_key_YOUR_SECURE_KEY_HERE",
project="My-Production-App"
)
# 2. Build your app normally!
@app.get("/users")
def get_users():
return {"message": "This endpoint is now being tracked!"}
@app.get("/checkout")
async def checkout():
# Krontos will automatically log the exact latency of this route
return {"status": "success"}
Viewing Your Data
Once your app is live and receiving traffic, log into the Krontos Dashboard to view your real-time time-series charts, pinpoint bottleneck endpoints, and monitor your error rates.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krontos-0.1.1.tar.gz.
File metadata
- Download URL: krontos-0.1.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
467a1b6f7685cd9d58a2ec467cce04c45da512816887508aa99d8929fa1a0098
|
|
| MD5 |
9ebb72d76cc6cfe77ffef5d849497ccb
|
|
| BLAKE2b-256 |
2c72f27c4d921636fbfb868495303626a8889105ebee314a4246d8b3bdbe5690
|
File details
Details for the file krontos-0.1.1-py3-none-any.whl.
File metadata
- Download URL: krontos-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ea6d4501041fc18c6943ac76b3b8e07218c0efce95df12c06ef79ae9a446e9f
|
|
| MD5 |
b25d58b5d4a115d9b62ba86653c05688
|
|
| BLAKE2b-256 |
eb9b22a860a3b5bf552b5154cd35c4d5704eb22ed0407c9a8dc23502208a139f
|