Skip to main content

Request tracing and visualization for FastAPI applications.

Project description

WatchTower

WatchTower is a project-aware FastAPI runtime observability tool that maps requests to user-defined classes and functions, helping developers understand request flow and inspect profiling data without framework noise.

Requirements

  • Use async def endpoints for best tracing accuracy
  • Sync endpoints (def) may lead to incomplete or unstable traces

Example usage

from fastapi import FastAPI

from .api.routes import router
from .core.config import settings
from .core.logging_util import configure_logging
from watchtower import setup_watchtower

configure_logging()

app = FastAPI(
    title="ML Pipeline Server Example",
    version="1.0.0",
    description="A layered FastAPI example for demonstrating WatchTower tracing on realistic ML pipelines.",
)

setup_watchtower(
    app,
    source_root="examples/ml_pipeline_server",
    code_index_path=".watchtower-ml_pipeline_server/code_index.json",
    output_dir=".watchtower-ml_pipeline_server",
    enable_ui=True,
    ui_dist_dir="frontend/watchtower-ui/dist",
)

app.include_router(router, prefix=settings.api_prefix)


@app.get("/")
async def healthcheck():
    return {
        "status": "ok",
        "service": "ml-pipeline-server",
        "api_prefix": settings.api_prefix,
    }

Example of Request Flow animation of a complex server

Request Flow Animation

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

fastapi_watchtower-1.0.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

fastapi_watchtower-1.0.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_watchtower-1.0.1.tar.gz.

File metadata

  • Download URL: fastapi_watchtower-1.0.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fastapi_watchtower-1.0.1.tar.gz
Algorithm Hash digest
SHA256 23c4033f0f1cfc96d82b97a726181953e25255997a484a50e4788f9e1a72597f
MD5 a4f05cf5664a4a4f9994588b2aceeb1a
BLAKE2b-256 c7a25462380d4c1531762b089a5c5da3ca467c2847b21246b64beb8119b2a638

See more details on using hashes here.

File details

Details for the file fastapi_watchtower-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_watchtower-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a6edb324f24a579bd0439dafb12c143c8128b8821f72f1e771bb2e57188070e
MD5 419747606a3c609266356eec10c28353
BLAKE2b-256 536cd28984d85ebc07bcafcd6a11791541de82b7d2cbccfc4e9f4890faede6e8

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