Zero-config latency tracking for FastAPI (and later more)
Project description
LatencyX
Lightweight auto-instrumentation for Python web apps. Because OpenTelemetry made you question your life choices.
Built for solo developers and small teams who want observability without needing a PhD in distributed systems.
Why LatencyX?
- One-line setup -
latencyx.init(app)and you're done - Auto-instrumentation - FastAPI, HTTP clients (httpx). More coming.
- Multiple exporters - Console, JSON files
- Minimal dependencies - Won't break your deployment
- Actually simple - No 50-page configuration docs
Quick Start
pip install latencyx
from fastapi import FastAPI
import latencyx
app = FastAPI()
latencyx.init(app) # That's it.
@app.get("/")
async def root():
return {"hello": "world"}
Output:
INFO:latencyx:[http.server] GET / duration=50.58ms status=200 method=GET client=127.0.0.1 path=/
CLI Monitoring
Watch your traces in real-time with a pretty CLI:
latencyx tail
๐ Watching LatencyX traces from: latencyx_traces.jsonl
Press Ctrl+C to stop
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TYPE โ NAME โ DURATION โ STATUS โ DETAILS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
http.server โ GET / โ 50.58ms โ 200 โ client=127.0.0.1
http.client โ GET api.github.com/users/github โ 656.2ms โ 200 โ host=api.github.com
http.server โ GET /external โ 662.0ms โ 200 โ client=127.0.0.1
business_logic โ custom_operation โ 100.2ms โ success โ
http.server โ GET /custom โ 101.1ms โ 200 โ client=127.0.0.1
It's basically tail -f but doesn't hurt your eyes.
What Gets Traced?
- FastAPI endpoints (automatic)
- HTTP client calls via httpx (automatic)
- Custom operations via context managers
For advanced usage, configuration options, and examples, see USAGE.md in the repository.
Comparison with OpenTelemetry
| Feature | LatencyX | OpenTelemetry |
|---|---|---|
| Setup | 1 line | 50+ lines |
| Dependencies | Minimal | Heavy |
| Learning curve | Minutes | Hours/Days |
| Best for | Solo devs, small teams | Large enterprises |
LatencyX isn't trying to replace OpenTelemetry. If you need distributed tracing across 50 microservices, use OTel. If you just want to know why your API is slow, use LatencyX.
Roadmap
| Feature | Status | Notes |
|---|---|---|
| FastAPI instrumentation | โ Done | Works today |
| HTTP client tracing (httpx) | โ Done | Works today |
| Console & JSON exporters | โ Done | Works today |
| Flask instrumentation | Planned | Because not everyone uses FastAPI |
| SQLAlchemy support | Planned | Async + sync |
| PostgreSQL (psycopg2, asyncpg) | Planned | Native drivers |
| Redis tracing | Planned | Cache tracing that doesn't lie |
| MySQL support | Planned | For the other half |
| Async jobs (Celery, RQ) | Planned | Background tasks need love too |
Vote for these by opening an issue:
| Feature | Why it's in maybe-land |
|---|---|
| Distributed tracing with trace IDs | Complex, needs real use cases |
| WebSocket tracing | Depends on demand |
| Sentry/Datadog integration | Only if people actually need it |
| Slow query detection | Might build if requested |
| APM tool integrations | Tell me which ones matter |
If something here would make your life easier, let me know. Otherwise, it stays in maybe-land.
Contributing
This is a solo project right now, but contributions are welcome:
- Feature requests - Open an issue and tell me what you need
- Bug reports - If something breaks, let me know
- Code contributions - PRs welcome, but let's keep it simple
No formal process yet. Just open an issue or PR.
Installation
# Basic installation
pip install latencyx
# With optional dependencies
pip install latencyx[http] # HTTP client tracing
pip install latencyx[all] # Everything
License
MIT License - use it however you want.
Made for developers who want observability without the headache.
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 latencyx-0.2.0.tar.gz.
File metadata
- Download URL: latencyx-0.2.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea4a5ee66ea91e24ff396b95ca17a35e613b3fff83cf9c2792665a9db45141cd
|
|
| MD5 |
a91866e5fc8310120a2facce72d21d5e
|
|
| BLAKE2b-256 |
bd64b97687f2db008fcdf5218dd48614a240e95bfd85b5e677ac4523982b08cc
|
Provenance
The following attestation bundles were made for latencyx-0.2.0.tar.gz:
Publisher:
publish.yaml on Devang-C/latencyx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latencyx-0.2.0.tar.gz -
Subject digest:
ea4a5ee66ea91e24ff396b95ca17a35e613b3fff83cf9c2792665a9db45141cd - Sigstore transparency entry: 1356261012
- Sigstore integration time:
-
Permalink:
Devang-C/latencyx@feb387988d8d7ea7f3466811a1e7961013bf0586 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Devang-C
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@feb387988d8d7ea7f3466811a1e7961013bf0586 -
Trigger Event:
push
-
Statement type:
File details
Details for the file latencyx-0.2.0-py3-none-any.whl.
File metadata
- Download URL: latencyx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.6 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 |
db75bb8c13594a9d7e3e52d40258aa7a72f5951dbe99fc29e67e95918fd75f2d
|
|
| MD5 |
6e4d86688b5f9d7a0b3cd99ad0c13a9e
|
|
| BLAKE2b-256 |
b57161df28c45490a87eaf2e374bcd938764604dfafd624b3315a4207ff32396
|
Provenance
The following attestation bundles were made for latencyx-0.2.0-py3-none-any.whl:
Publisher:
publish.yaml on Devang-C/latencyx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latencyx-0.2.0-py3-none-any.whl -
Subject digest:
db75bb8c13594a9d7e3e52d40258aa7a72f5951dbe99fc29e67e95918fd75f2d - Sigstore transparency entry: 1356261066
- Sigstore integration time:
-
Permalink:
Devang-C/latencyx@feb387988d8d7ea7f3466811a1e7961013bf0586 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Devang-C
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@feb387988d8d7ea7f3466811a1e7961013bf0586 -
Trigger Event:
push
-
Statement type: