Skip to content

src/dazzle_back/runtime/metrics/middleware.py

Generated: 2026-03-30T04:38:47.623407+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

FastAPI Middleware for automatic HTTP metrics collection.

Automatically tracks: - Request count (http_requests_total) - Request latency (http_latency_ms) - Error count (http_errors_total)

Key Exports

  • MetricsMiddleware
  • add_metrics_middleware
  • dispatch

Dependencies

Imports

  • re
  • time
  • collections.abc.Awaitable
  • collections.abc.Callable
  • typing.Any
  • starlette.middleware.base.BaseHTTPMiddleware
  • starlette.requests.Request
  • starlette.responses.Response
  • starlette.types.ASGIApp
  • emitter.MetricsEmitter

Event Interactions

None detected.

Invariants and Assumptions

No invariants documented.

Tests

  • tests/unit/test_tenant_middleware_routing.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.