Redact diagnostic data before it crosses the logging boundary
Design bounded structured diagnostics that preserve operation evidence while excluding credentials, private content and raw provider errors.
Render latency, token and cost telemetry without making absent or truncated evidence look like a fast, free operation.
A telemetry field can contain a measured positive value, a measured zero or no measurement. Those states have different meanings. A model request with no token report is not proven token-free, and an event with no duration is not proven instantaneous. Keep absence explicit from ingestion through storage, export and display.
Lupin’s shared trace schema makes duration, token usage and cost optional. Its cost object carries amount, currency and source when present. That structure supports honest partial evidence, but a dashboard can still destroy the distinction by filling missing numbers with zero during aggregation.
For a mean latency, count only events with a valid duration and show the measurement coverage beside the result. For a sum, state whether it covers every eligible event or only measured ones. Missing durations should reduce coverage, not improve the apparent performance of an incident.
Keep currency and cost source attached to monetary telemetry. A trace-level cost field is diagnostic information and does not automatically replace the usage ledger or invoice. Avoid adding a model estimate, provider-confirmed activity cost and customer retail estimate into an unlabeled total. They can represent different accounting layers.
The Lupin API trace middleware labels its request duration as the authenticated handler scope. Authentication phase timing is captured separately and phases can overlap. A dashboard should not sum overlapping phases and present the result as total wall-clock latency.
Likewise, a provider event duration is not necessarily end-to-end user latency. Queue time, context preparation, approval waiting and delivery can sit outside that span. Choose a clearly named start and end boundary for each metric, and distinguish observed elapsed time from an inferred stage breakdown.
Trace storage and batches are bounded, and the trace records carry a truncated flag. Missing events can reflect clipping, capture settings, expiry or unavailable persistence. None of those conditions establishes that the omitted stage never happened. Show the diagnostic coverage warning near the affected timeline or aggregate.
Lupin defaults to metadata capture and short retention. Increasing retention cannot restore expired diagnostics. An empty search result after expiry therefore differs from a fresh trace proving no tool call occurred. Use durable operation or usage evidence for questions that outlive the trace’s diagnostic window.
Create local fixtures with absent duration, explicit duration zero, positive duration, absent usage, explicit token zero and a truncated batch. Verify text, sorting and aggregate denominators. A table should display unknown or unavailable for absence and reserve zero for an actual numeric zero.
Also test an entirely unmeasured group. It should produce no numeric average rather than zero milliseconds. These are small presentation checks with operational consequences: accurate missingness stops teams from declaring an outage cheap or fast simply because the telemetry failed at the same time as the service.
Reviewed against the checked-in Lupin implementation and official reference documentation on 2026-11-05. Operational examples are illustrative; no live paid action, provider mutation or external message was executed.
Prepared with AI assistance by Lupin editorial. How we research and maintain these guides.