-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capturing that retry attempts were exhausted #130
Comments
Thank you for the report. Creating issues is totally fine. Unfortunately we cannot add anything to the Before we do any of that, can you elaborate on your use case? If you have retries turned on and you still end up with an error then it is reasonable to assume retries were exhausted (otherwise it is a bug), why would you want to check it? |
when a request fails in this given application it usually means that a customer will end up creating a support ticket. so we want to create alerts for these error logs to act proactively, but as it is right now we might end up creating alerts even after successful retries. |
Would something like this work for you? req = Req.new(...)
case Req.Request.execute(r) do
{req, %Req.Response{} = resp} -> ...
{req, exception} -> ...
end in either case clause you'd be able to access req.private so you'd have access to all the information we keep around between requests. (There's no execute/1 function yet but I plan to add it.) @heydtn you added |
I've added added req = Req.new(url: "https://httpbin.org/status/500")
Req.Request.request(req) do
{:ok, request, response} ->
IO.puts request.private.req_retry_count
IO.puts "success: #{response.status}"
{:error, request, exception} ->
IO.inspect request.private.req_retry_count
IO.puts "failure: " <> Exception.message(exception)
end |
Hey, @wojtekmach! Thanks for the work on
Req
, most charming elixir HTTP lib ✨I was wondering what's the best way to figure out that retry attempts were exhausted. Not sure if creating an issue is the best format for that, sorry if that's not the case 😅
We wanted to log something specific when a request fails after retries but I'm not sure if there's any way to do that with the current APIs
example:
this error struct is exactly the same regardless of the retries. Is there any way to add something to it stating that retry attempts were all used?
If implementing something like this is a possibility for
Req
I could work on that.The text was updated successfully, but these errors were encountered: