Skip to main content

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

latencyx-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

latencyx-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file latencyx-0.1.0.tar.gz.

File metadata

  • Download URL: latencyx-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for latencyx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7bff6bed61e96c4c6d302623b269e746cc6b60a3aafcdd251a6458fdaa7fb52d
MD5 a6bbf0a6781553876da1b4eb5f00e719
BLAKE2b-256 cfd22e4b0c62d1bbce569c3f9c9228f6497fdef6d3ed9727acd72d4fde2b2e79

See more details on using hashes here.

File details

Details for the file latencyx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: latencyx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for latencyx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f585bcc560dd399fd67ad8dc32e229cf38c34aae420cfeebe0b3911e3c2803e7
MD5 5bee4d133c8fa65fab68cb8590693d6e
BLAKE2b-256 084be0a3b06bfb6138060e52c4f31bd4aeb82dfa6627b1e31a007ae0e6c0f5a9

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