The telemetry every backend emits.
span/4 wraps one request in [:jev, :request, :start | :stop | :exception]
and fires [:jev, :answer] once per answered question. Jev.HTTP uses it,
and a Jev.Backend of your own should too, so a calibration histogram or a
cost sum sees local models and Jev alike.
| Event | Measurements | Metadata |
|---|---|---|
[:jev, :request, :start] | system_time | backend, endpoint, model, questions, state_hash, tag |
[:jev, :request, :stop] | duration, input_tokens, output_tokens, cost | plus status, request_id, confidence |
[:jev, :request, :exception] | duration | plus kind, reason, stacktrace |
[:jev, :answer] | confidence, probability | name, type, answer, plus the start metadata |
questions is a map of question name to type. The state is never in
metadata, only its hash.
Summary
Functions
Runs fun as one request, emitting the events above.
Types
Functions
@spec span(Jev.entry(), Jev.questions(), map(), (-> result())) :: {:ok, Jev.reply()} | {:error, term()}
Runs fun as one request, emitting the events above.
metadata is what the backend knows before the call: backend, tag, and
for Jev.HTTP endpoint and model. questions and state_hash are added.
fun returns {:ok, reply}, {:ok, reply, stop_metadata} to add to the
stop event, or {:error, reason}. A Jev.Error reason contributes its
status and request_id; any other reason is put under error.
Returns {:ok, reply} or {:error, reason}.