Skip to content

Commit

Permalink
Add client request tracing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 3, 2024
1 parent 6041cac commit 56748ff
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lib/async/http/protocol/http1/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ def call(request, task: Task.current)
self.close(error)
raise
end

Traces::Provider(self) do
def write_request(...)
Traces.trace("async.http.protocol.http1.client.write_request") do
super
end
end

def read_response(...)
Traces.trace("async.http.protocol.http1.client.read_response") do
super
end
end
end
end
end
end
Expand Down
24 changes: 23 additions & 1 deletion lib/async/http/protocol/http2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,32 @@ def call(request)
@count += 1

response = create_response
write_request(response, request)
read_response(response)

return response
end

def write_request(response, request)
response.send_request(request)
end

def read_response(response)
response.wait
end

Traces::Provider(self) do
def write_request(...)
Traces.trace("async.http.protocol.http2.client.write_request") do
super
end
end

return response
def read_response(...)
Traces.trace("async.http.protocol.http2.client.read_response") do
super
end
end
end
end
end
Expand Down

0 comments on commit 56748ff

Please sign in to comment.