Skip to content

Commit 53b0fbb

Browse files
committed
Add tracing around Client#make_response.
1 parent e0da7ab commit 53b0fbb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/async/http/client.rb

+12-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def call(request)
101101
# 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.
102102
connection = @pool.acquire
103103

104-
response = make_response(request, connection)
104+
response = make_response(request, connection, attempt)
105105

106106
# 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:
107107
connection = nil
@@ -177,12 +177,22 @@ def call(request)
177177
end
178178
end
179179
end
180+
181+
def make_response(request, connection, attempt)
182+
attributes = {
183+
'attempt': attempt,
184+
}
185+
186+
Traces.trace("async.http.client.make_response", attributes: attributes) do
187+
super
188+
end
189+
end
180190
end
181191
end
182192

183193
protected
184194

185-
def make_response(request, connection)
195+
def make_response(request, connection, attempt)
186196
response = request.call(connection)
187197

188198
response.pool = @pool

0 commit comments

Comments
 (0)