Skip to content

Commit

Permalink
Add tracing around Client#make_response.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 22, 2024
1 parent e0da7ab commit 53b0fbb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/async/http/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 53b0fbb

Please sign in to comment.