Skip to content

Commit

Permalink
Merge pull request #4270 from DataDog/appsec-remove-obsolete-code-fro…
Browse files Browse the repository at this point in the history
…m-gateway-watchers

Remove obsolete code from gateway watchers
  • Loading branch information
y9v authored Jan 10, 2025
2 parents 61d8723 + 85f6572 commit 7f8e8fd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 64 deletions.
9 changes: 1 addition & 8 deletions lib/datadog/appsec/contrib/graphql/gateway/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,7 @@ def watch_multiplex(gateway = Instrumentation.gateway)

next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_multiplex.arguments)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_multiplex.arguments)
end
end
end
Expand Down
27 changes: 3 additions & 24 deletions lib/datadog/appsec/contrib/rack/gateway/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@ def watch_request(gateway = Instrumentation.gateway)
block = Rack::Reactive::Request.publish(engine, gateway_request)
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_request.request)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_request.request)
end
end

Expand Down Expand Up @@ -88,14 +81,7 @@ def watch_response(gateway = Instrumentation.gateway)
block = Rack::Reactive::Response.publish(engine, gateway_response)
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_response.response)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_response.response)
end
end

Expand Down Expand Up @@ -126,14 +112,7 @@ def watch_request_body(gateway = Instrumentation.gateway)
block = Rack::Reactive::RequestBody.publish(engine, gateway_request)
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_request.request)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_request.request)
end
end
end
Expand Down
9 changes: 1 addition & 8 deletions lib/datadog/appsec/contrib/rails/gateway/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,7 @@ def watch_request_action(gateway = Instrumentation.gateway)
block = Rails::Reactive::Action.publish(engine, gateway_request)
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_request.request)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_request.request)
end
end
end
Expand Down
18 changes: 2 additions & 16 deletions lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@ def watch_request_dispatch(gateway = Instrumentation.gateway)
block = Rack::Reactive::RequestBody.publish(engine, gateway_request)
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_request.request)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_request.request)
end
end

Expand Down Expand Up @@ -86,14 +79,7 @@ def watch_request_routed(gateway = Instrumentation.gateway)
block = Sinatra::Reactive::Routed.publish(engine, [gateway_request, gateway_route_params])
next [nil, [[:block, event]]] if block

ret, res = stack.call(gateway_request.request)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(gateway_request.request)
end
end
end
Expand Down
9 changes: 1 addition & 8 deletions lib/datadog/appsec/monitor/gateway/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ def watch_user_id(gateway = Instrumentation.gateway)
block = Monitor::Reactive::SetUser.publish(engine, user)
throw(Datadog::AppSec::Ext::INTERRUPT, [nil, [[:block, event]]]) if block

ret, res = stack.call(user)

if event
res ||= []
res << [:monitor, event]
end

[ret, res]
stack.call(user)
end
end
end
Expand Down

0 comments on commit 7f8e8fd

Please sign in to comment.