Good point about the 200 being sent before the answer exists. One thing to add to the outcome list is a separate label for client disconnects. When a user closes the tab mid stream, the server sees a cancelled request, and counting that as an error will eat your error budget for no real fault. It is also worth making sure the disconnect actually cancels the upstream model call, otherwise you keep paying for tokens nobody reads.
Thanks, this was a really useful comment, and I've noted down both points.
Disconnects were already kept out of the errors, but in a separate counter. They're now their own outcome, cancelled, excluded explicitly from the error SLI, with a rule test. On cancelling upstream, I'm adding an end-to-end cancellation test against a fake model server, so it proves the server actually sees the disconnect and stops generating, not just that my own loop stopped. Next is checking each provider's side: whether billing stops once the stream closes.
Osama Malik
Good point about the 200 being sent before the answer exists. One thing to add to the outcome list is a separate label for client disconnects. When a user closes the tab mid stream, the server sees a cancelled request, and counting that as an error will eat your error budget for no real fault. It is also worth making sure the disconnect actually cancels the upstream model call, otherwise you keep paying for tokens nobody reads.