src/dazzle_back/runtime/api_tracker.py¶
Generated: 2026-03-30T04:38:46.770574+00:00
Commit: 615f1354a103
Language: python
Scope: dazzle_back
Purpose¶
External API Call Tracker.
Instruments outbound API calls to track: - Latency and response times - Success/error rates - Request/response sizes - Costs (for metered APIs like OpenAI, Stripe)
Usage: # As context manager async with api_tracker.track("stripe", "/v1/charges", "POST") as ctx: ...
Key Exports¶
ApiCostConfigTrackingContextApiTrackerTrackedHttpxClientcreate_openai_cost_calculatorconfigure_openai_trackingconfigure_anthropic_trackingset_request_sizeset_responseset_errorset_costadd_metadatalatency_msconfigure_costtracktracedrequestgetpostput
Dependencies¶
Imports¶
__future__.annotationsfunctoolsloggingtimecollections.abc.Callablecontextlib.asynccontextmanagerdataclasses.dataclassdataclasses.fielddatetime.UTCdatetime.datetimetyping.TYPE_CHECKINGtyping.Anytyping.ParamSpectyping.TypeVaruuid.uuid4dazzle_back.runtime.ops_database.ApiCallRecorddazzle_back.runtime.ops_database.OpsDatabasecollections.abc.AsyncGeneratorcollections.abc.Awaitabledazzle_back.events.bus.EventBus
Event Interactions¶
Emits: ops.api_call
Invariants and Assumptions¶
No invariants documented.
Tests¶
tests/integration/test_runtime_e2e.pytests/integration/test_runtime_pipeline.pytests/unit/test_runtime_test_routes.pytests/unit/test_runtime_services.pytests/unit/test_runtime_mcp_tools.py
Notes¶
This page was automatically generated by tools/gen_reference_docs.py.