Oriflux API analytics — zero-dependency ASGI middleware with client-side 60 s aggregation
Project description
oriflux-sdk
API analytics middleware for Oriflux — zero dependencies, MIT-licensed, < 1 ms per request.
pip install oriflux-sdk
from oriflux_sdk import OrifluxMiddleware
app.add_middleware(OrifluxMiddleware, api_key="ofx_ing_…") # FastAPI / Starlette / any ASGI
That's the whole integration. The middleware aggregates client-side in 60 s windows (Apitally pattern): request counts, error counts, latency histograms and payload sizes keyed by templated endpoint, method, status code, consumer and caller IP — the IP is what lets Oriflux resolve caller geography at ingestion (then discard it; it is never stored). Cardinality is capped at ~2 000 keys per window with an explicit overflow bucket.
Your API is never impacted: recording is in-memory dict arithmetic, flushing happens on a daemon thread with a 3 s timeout, failures are dropped (never retried, never raised), and a circuit breaker pauses flushing entirely while Oriflux is unreachable.
Options
| Option | Default | Purpose |
|---|---|---|
api_key |
— (required) | the source's ingest key |
endpoint |
https://in.oriflux.sponge-theory.dev |
self-hosted / first-party proxy target |
consumer |
None |
callable(scope) -> str to attribute traffic to an API consumer |
flush_interval_s |
60 |
aggregation window |
max_keys |
2000 |
cardinality cap per window |
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 oriflux_sdk-0.1.0.tar.gz.
File metadata
- Download URL: oriflux_sdk-0.1.0.tar.gz
- Upload date:
- Size: 34.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18a8d2fa4e9995caf79dded32a29abb2d9b04af6b800a5ed62dd4fda2491a067
|
|
| MD5 |
51def33aa1bbf3f2d7cd1bc9d0410cb1
|
|
| BLAKE2b-256 |
674e600d63667576b97bcd2010f260ec9a05e1e80f95dbdff536a0c140c2e3ed
|
File details
Details for the file oriflux_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: oriflux_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f755c6d691f05e1b2de5d6f72fdfc19b73055373ef7a6e78c77e08c62db11a42
|
|
| MD5 |
ca1412256081745fcd76bbcfaac9023b
|
|
| BLAKE2b-256 |
4f9ab5f99d5302f6cc897386dccbc300167d445dc30f9fe46bad07ae21b0a903
|