Skip to content

Commit

Permalink
Add extra traces to the redirect and proxy middleware.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 26, 2024
1 parent 8529aeb commit 4cb77ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ permissions:

env:
CONSOLE_OUTPUT: XTerm
TRACES_BACKEND: traces/backend/test
METRICS_BACKEND: metrics/backend/test

jobs:
test:
Expand Down
10 changes: 9 additions & 1 deletion lib/falcon/middleware/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require 'protocol/http/middleware'

require 'console/event/failure'
require 'traces/provider'

module Falcon
module Middleware
Expand Down Expand Up @@ -138,7 +139,6 @@ def call(request)

client = connect(host.endpoint)

Console.debug(self, "Sending request...", host: host, request: request, count: @count)
client.call(request)
else
super
Expand All @@ -147,6 +147,14 @@ def call(request)
Console::Event::Failure.for(error).emit(self)
return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, [error.class.name]]
end

Traces::Provider(self) do
def call(request)
Traces.trace('falcon.middleware.proxy.call', attributes: {authority: request.authority}) do
super
end
end
end
end
end
end
8 changes: 8 additions & 0 deletions lib/falcon/middleware/redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ def call(request)
super
end
end

Traces::Provider(self) do
def call(request)
Traces.trace('falcon.middleware.redirect.call', attributes: {authority: request.authority}) do
super
end
end
end
end
end
end

0 comments on commit 4cb77ca

Please sign in to comment.