FastAPI observability SDK for Lumonox
Project description
Lumonox SDK (Python)
Lumonox SDK instruments a FastAPI app and sends request/error events to Lumonox with safe defaults.
Install
| Goal | PyPI one-liner | Import / process |
|---|---|---|
API + bundled dashboard UI (ingest, dashboard, static export under /lumonox/ui/) |
pip install lumonox |
from lumonox import mount_on_app (or lumonox_backend / uvicorn lumonox_backend.main:app) |
| Instrument your FastAPI app (send-only SDK) | pip install lumonox-sdk |
from lumonox import lumonox |
| API + UI + SDK in one environment | pip install "lumonox-sdk[stack]" |
from lumonox import lumonox, mount_on_app |
uv add works the same (uv add lumonox, uv add "lumonox-sdk[stack]", …).
From a git checkout (offline wheels from repo root):
./scripts/build_sdk_release_wheels.sh # writes dist/wheels/*.whl
pip install dist/wheels/lumonox-*.whl dist/wheels/lumonox_sdk-*.whl
Publish to PyPI
Artifacts are standard wheel + sdist from the workspace root (hatchling via uv build):
uv build --package lumonox-sdk -o dist/pypi-sdk
python -m pip install twine # once
twine check dist/pypi-sdk/*
twine upload dist/pypi-sdk/*
Recommended: use trusted publishing from GitHub Actions instead of storing a long-lived PyPI token in CI secrets:
- SDK:
.github/workflows/publish-lumonox-sdk-pypi.yml→ projectlumonox-sdk - API + bundled UI:
.github/workflows/publish-lumonox-pypi.yml→ projectlumonox
On main: the SDK workflow runs when sdk/pyproject.toml, sdk/src/**, sdk/README.md, or sdk/LICENSE change. The lumonox publish workflow runs when backend/pyproject.toml, backend/src/**, or frontend/** change. Both upload only when the corresponding [project] version is not already on PyPI.
lumonox-sdk[stack] on PyPI: publish lumonox first (or same release train) so the extra can resolve lumonox>=0.2.6.
One-time on PyPI: create projects lumonox-sdk and lumonox, add trusted publishers for each workflow, then merge version bumps or run workflows manually.
Integration
from fastapi import FastAPI
from lumonox import lumonox, monitor
app = FastAPI()
lumonox(app) # recommended default
# monitor(app) # backwards-compatible alias for existing integrations
lumonox() defaults environment to development so request events match common dashboard server-scope filters. Use lumonox(app, environment="production") when you need production labels.
By default, lumonox() (and monitor() for existing integrations) target a remote Lumonox project (set LUMONOX_API_KEY / LUMONOX_INGEST_URL). It uses bounded in-memory buffering, async background sending, and silent failure behavior so host apps stay healthy if Lumonox is unavailable.
If either variable is missing, the sender stays off: middleware still runs, but no events are enqueued (minimal overhead). A one-time WARNING is emitted on process startup so misconfiguration is obvious without breaking the host app.
Key runtime controls
LUMONOX_API_KEYLUMONOX_INGEST_URL(orLUMONOX_ENDPOINT)LUMONOX_FLUSH_INTERVAL_SECONDSLUMONOX_BATCH_MAX_EVENTSLUMONOX_MAX_QUEUE_SIZELUMONOX_DEBUGLUMONOX_REQUEST_SAMPLE_RATE(0.0-1.0; default1.0)LUMONOX_IGNORE_PATH_PREFIXES(comma-separated, default/health,/ready)LUMONOX_CAPTURE_HEADERS— whentrue/1/yes, capture request headers in events (default off for production-safe privacy).LUMONOX_CAPTURE_QUERY_PARAMS— when truthy, capture query parameters (default off).
lumonox() and monitor() support explicit kwargs for runtime behavior:
capture_headers(default followsLUMONOX_CAPTURE_HEADERS, else False)capture_query_params(default followsLUMONOX_CAPTURE_QUERY_PARAMS, else False)request_sample_rate(float0.0-1.0, keeps 5xx/error capture unsampled)ignore_path_prefixes(tuple/list of path prefixes to skip, e.g.("/health", "/ready"))scrub_keys(additional sensitive keys to redact)queue_maxsize,batch_size,flush_interval_s,max_retries,retry_backoff_s
Security defaults
- Sensitive keys are scrubbed before send.
- Headers and query strings are not captured unless explicitly enabled (kwargs or env vars above)—opt in when debugging, not in production, unless you accept the PII risk.
- Middleware captures error context and re-raises original exceptions.
Troubleshooting (“no events”)
- Confirm
LUMONOX_API_KEYandLUMONOX_INGEST_URLare both set forlumonox()(see startupWARNINGwhen remote send is disabled). - Enable
LUMONOX_DEBUG=1temporarily to surface queue drops or send failures on stderr. - Check dashboard server-scope filters (environment / service) vs the
environmentandservice_namefields you send from the SDK. - Dashboard shows traffic but requests/errors look empty while DuckDB tools show rows: you likely opened a different DuckDB file than the API. Set
LUMONOX_DATA_DIRor an absoluteLUMONOX_DUCKDB_PATHon the backend and confirm startup logs (Startup settings [event_store]: … duckdb_path=…).
Canonical behavior and constraints are defined in DEVELOPMENT.md.
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
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 lumonox_sdk-0.2.5.tar.gz.
File metadata
- Download URL: lumonox_sdk-0.2.5.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6926a2cccc6ad048a5df47f0fce5f4b9866a630f14431e08594f1d5ca8a8999
|
|
| MD5 |
2803953b7d95753667146f08d39f59f5
|
|
| BLAKE2b-256 |
4cb7b1384aed5e3f61e7950d4ce84ac7e3841163278daaa12397b527a27da5f9
|
Provenance
The following attestation bundles were made for lumonox_sdk-0.2.5.tar.gz:
Publisher:
publish-lumonox-sdk-pypi.yml on sintimaski/lumonox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lumonox_sdk-0.2.5.tar.gz -
Subject digest:
b6926a2cccc6ad048a5df47f0fce5f4b9866a630f14431e08594f1d5ca8a8999 - Sigstore transparency entry: 1512231631
- Sigstore integration time:
-
Permalink:
sintimaski/lumonox@be8f64c163dd3805d0cd2088a4b59e06d815ea17 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sintimaski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-lumonox-sdk-pypi.yml@be8f64c163dd3805d0cd2088a4b59e06d815ea17 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lumonox_sdk-0.2.5-py3-none-any.whl.
File metadata
- Download URL: lumonox_sdk-0.2.5-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
744188bfe4d1aebac987391b41c9ea6afaebd423f7a3a490224d22572c43b7bb
|
|
| MD5 |
efcecfdce0ef3a9a0a9681c3b21fc3a1
|
|
| BLAKE2b-256 |
4ce3f2cf201a6463c1872a807f58ad61f90e5aed6b4d69632f17af50c18fbdf0
|
Provenance
The following attestation bundles were made for lumonox_sdk-0.2.5-py3-none-any.whl:
Publisher:
publish-lumonox-sdk-pypi.yml on sintimaski/lumonox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lumonox_sdk-0.2.5-py3-none-any.whl -
Subject digest:
744188bfe4d1aebac987391b41c9ea6afaebd423f7a3a490224d22572c43b7bb - Sigstore transparency entry: 1512231761
- Sigstore integration time:
-
Permalink:
sintimaski/lumonox@be8f64c163dd3805d0cd2088a4b59e06d815ea17 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sintimaski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-lumonox-sdk-pypi.yml@be8f64c163dd3805d0cd2088a4b59e06d815ea17 -
Trigger Event:
push
-
Statement type: