From 67a40aef52ec41b9fb53fa48da7ad80be4db8cd2 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 24 Sep 2024 23:50:46 +1200 Subject: [PATCH] More extensive proxy trace attributes. --- lib/falcon/middleware/proxy.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/falcon/middleware/proxy.rb b/lib/falcon/middleware/proxy.rb index dac39994..438dc911 100644 --- a/lib/falcon/middleware/proxy.rb +++ b/lib/falcon/middleware/proxy.rb @@ -150,7 +150,20 @@ def call(request) Traces::Provider(self) do def call(request) - Traces.trace('falcon.middleware.proxy.call', attributes: {authority: request.authority}) do + attributes = { + authority: request.authority, + } + + if host = lookup(request) + attributes[:endpoint] = host.endpoint.inspect + + if client = @clients[host.endpoint] + attributes[:client] = client.as_json + attributes[:pool] = client.pool.as_json + end + end + + Traces.trace('falcon.middleware.proxy.call', attributes: attributes) do super end end