Metadata-Version: 2.4
Name: krontos
Version: 0.1.1
Summary: A fast, non-blocking API analytics and latency tracking middleware for FastAPI.
Author: aimrrs
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Requires-Dist: starlette>=0.35.0
Description-Content-Type: text/markdown

# 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 `asyncio` background 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:

```bash
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.

```bash
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.