diff --git a/lib/async/http/client.rb b/lib/async/http/client.rb index c755e87..2ecee61 100755 --- a/lib/async/http/client.rb +++ b/lib/async/http/client.rb @@ -101,7 +101,7 @@ def call(request) # As we cache pool, it's possible these pool go bad (e.g. closed by remote host). In this case, we need to try again. It's up to the caller to impose a timeout on this. If this is the last attempt, we force a new connection. connection = @pool.acquire - response = make_response(request, connection) + response = make_response(request, connection, attempt) # This signals that the ensure block below should not try to release the connection, because it's bound into the response which will be returned: connection = nil @@ -177,12 +177,22 @@ def call(request) end end end + + def make_response(request, connection, attempt) + attributes = { + 'attempt': attempt, + } + + Traces.trace("async.http.client.make_response", attributes: attributes) do + super + end + end end end protected - def make_response(request, connection) + def make_response(request, connection, attempt) response = request.call(connection) response.pool = @pool