enroute

Tracing

Every routed call can write a Trace. Persist it, redact it, or sample it down.

Trace is the record for one request. TraceWriter sends traces to a sink. Use JSONLSink for a local file or SQLiteSink for a queryable store.

from enroute import Enroute, JSONLSink, Redactor, Sampler, TraceWriter

sink = JSONLSink(".enroute/traces.jsonl")
writer = TraceWriter(sink, redactor=Redactor(), sampler=Sampler(rate=1.0))
client = Enroute(sink=sink, redactor=Redactor(), sampler=Sampler(rate=1.0))
response = client.chat(
    model="openai/gpt-5.6-luna",
    messages=[{"role": "user", "content": "ping"}],
)
print(response.model, response.latency_ms)
writer.close()

Redactor strips secrets before persistence. Sampler keeps a fraction of traces. Set capture_content=False on the client if you only want metadata.

Hosted gateway traffic also appears under Traces in this workspace so you can see latency and spend without opening a local sink.