Skip to content

Commit

Permalink
Fix compatibility with Ruby 3.0 separation of kw args (#3)
Browse files Browse the repository at this point in the history
With the release of ruby 3.0 (https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/) keyword and positional arguments are separated (https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)

In this case we need to explicitly pass a hash to the `increment` method calls.

Co-authored-by: Daniel Marin Cabillas <[email protected]>
  • Loading branch information
danmarcab and Daniel Marin Cabillas authored Jan 22, 2021
1 parent 8533a60 commit 4a93326
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/yabeda/http_requests/sniffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ class Sniffer
def request(data_item)
yield
Yabeda.http_request_total.increment(
host: data_item.request.host,
port: data_item.request.port,
method: data_item.request.method
{
host: data_item.request.host,
port: data_item.request.port,
method: data_item.request.method
}
)
end

Expand All @@ -23,10 +25,12 @@ def response(data_item)

def log_http_response_total(data_item)
Yabeda.http_response_total.increment(
host: data_item.request.host,
port: data_item.request.port,
method: data_item.request.method,
status: data_item.response.status
{
host: data_item.request.host,
port: data_item.request.port,
method: data_item.request.method,
status: data_item.response.status
}
)
end

Expand Down

0 comments on commit 4a93326

Please sign in to comment.