Philter.Timing (Philter v0.3.0)

Copy Markdown View Source

Per-phase timing capture for proxy requests.

Captures pool checkout, connection, send, and receive durations from the underlying HTTP client's telemetry events.

Uses a single globally-attached telemetry handler (attached lazily on first use). Per-request opt-in is via a process dictionary flag — when no proxy has opted in, the handler is a single Process.get/1 returning nil.

Timing capture is single-flight-per-process: only one proxy/2 call per process can capture timing at a time. The :philter_timing_ref process dictionary key is shared, so a reentrant proxy/2 call in the same process would overwrite the ref. This is by design — Plug request processes handle one request at a time.