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.2.0.tar.gz (20.3 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.2.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

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

Hashes for latencyx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ea4a5ee66ea91e24ff396b95ca17a35e613b3fff83cf9c2792665a9db45141cd
MD5 a91866e5fc8310120a2facce72d21d5e
BLAKE2b-256 bd64b97687f2db008fcdf5218dd48614a240e95bfd85b5e677ac4523982b08cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for latencyx-0.2.0.tar.gz:

Publisher: publish.yaml on Devang-C/latencyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for latencyx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db75bb8c13594a9d7e3e52d40258aa7a72f5951dbe99fc29e67e95918fd75f2d
MD5 6e4d86688b5f9d7a0b3cd99ad0c13a9e
BLAKE2b-256 b57161df28c45490a87eaf2e374bcd938764604dfafd624b3315a4207ff32396

See more details on using hashes here.

Provenance

The following attestation bundles were made for latencyx-0.2.0-py3-none-any.whl:

Publisher: publish.yaml on Devang-C/latencyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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