Right now, Archyve creates an instance of ApiCall every time it makes a request to an external API. It's decent at creating these even when the reponses are HTTP errors (i.e. status is not between 200 and 399).
However, in the case where the request does not return an HTTP response at all (e.g. timeout, connection refused), it does not always create a request. Fix this.
One option is to convert all HTTP comms to use Faraday, and use the instrument call to create ApiCalls, which is what the OpenAI client is doing right now. (Verify that our instrument method is getting called when no HTTP response is returned first!)
A nice side effect of the Faraday option is that all of our Net::HTTP calls would be converted to Faraday as well, possibly making the code easier to read and maybe even making it easier to implement SSE when it comes to OpenAI stuff.
Right now, Archyve creates an instance of ApiCall every time it makes a request to an external API. It's decent at creating these even when the reponses are HTTP errors (i.e. status is not between 200 and 399).
However, in the case where the request does not return an HTTP response at all (e.g. timeout, connection refused), it does not always create a request. Fix this.
One option is to convert all HTTP comms to use Faraday, and use the
instrument
call to create ApiCalls, which is what the OpenAI client is doing right now. (Verify that ourinstrument
method is getting called when no HTTP response is returned first!)A nice side effect of the Faraday option is that all of our Net::HTTP calls would be converted to Faraday as well, possibly making the code easier to read and maybe even making it easier to implement SSE when it comes to OpenAI stuff.