The telemetry events LlmCall emits.
The library emits and attaches no handler: there is no reporter, no metrics
backend and no default Logger output, so the cost is zero until a host calls
:telemetry.attach_many/4.
Events cover the calls that decode a provider response — LlmCall.complete/3,
stream/3, generate/3 and poll/3. A call that fails before the request is
built (a :validation error from validate_request/2 or encode_request/2)
emits nothing: no request was made, and the caller already holds the error.
LlmCall.execute/2 and fetch/2 emit nothing here either: they are Finch
requests with a JSON body, already covered by
[:finch, :request, :start | :stop | :exception].
Every event carries the same four metadata keys: operation (:complete,
:stream, :generate, :poll), provider, codec, and model (nil for a
call that has no %LlmCall.Request{}, such as poll/3).
[:llm_call, :request, ...]
:start— metadata as above, measurements%{system_time: integer}.:stop— measurements%{duration: :native}plus theLlmCall.Usagetoken counts the provider reported. A count that isnilis omitted, never zero: "not reported" and "reported zero" are different facts. Metadata addsoutcome: :okandstop_reason, oroutcome: :erroranderror_kind,status,retryable,retry_after_ms.:exception— measurements%{duration: :native}; metadata addskind,reasonandstacktrace. Emitted instead of:stopwhen the call raises, and the raise still reaches the caller.
[:llm_call, :stream, ...]
:start— emitted when the stream is reduced, not when it is built: building a stream issues no request.:first_event— measurements%{duration: :native}, the time to the first event. Emitted once, on the first event yielded; a stream that yields none does not emit it.:first_text— the same measurements, on the first:text_deltainstead. This is the time to the first token a caller can see: a:message_startor a:thinking_deltadoes not count, so a stream that only emits those has no:first_text.first_text - first_eventis the provider's skeleton-frame overhead, which is what separates "the provider is slow" from "the network is slow".:stop— measurements%{duration: :native}; metadata addsoutcome: :done | :halted,statusandevents(the count yielded).:exception— as for a request.
A stream that is built and never reduced emits nothing, and one whose consumer
dies mid-read emits :start with no terminal event.
What metadata never carries
No header, no request or response body, no message and no delta. See
docs/design.md §26.2: an Inspect exception can stay in a log, and telemetry
metadata ends up in a third-party tracing backend.