Skip to main content

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


Download files

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

Source Distribution

oriflux_sdk-0.1.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

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

oriflux_sdk-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

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

Hashes for oriflux_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18a8d2fa4e9995caf79dded32a29abb2d9b04af6b800a5ed62dd4fda2491a067
MD5 51def33aa1bbf3f2d7cd1bc9d0410cb1
BLAKE2b-256 674e600d63667576b97bcd2010f260ec9a05e1e80f95dbdff536a0c140c2e3ed

See more details on using hashes here.

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

Hashes for oriflux_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f755c6d691f05e1b2de5d6f72fdfc19b73055373ef7a6e78c77e08c62db11a42
MD5 ca1412256081745fcd76bbcfaac9023b
BLAKE2b-256 4f9ab5f99d5302f6cc897386dccbc300167d445dc30f9fe46bad07ae21b0a903

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