Class: Yabeda::HttpRequests::Sniffer

Inherits:
Object
  • Object
show all
Defined in:
lib/yabeda/http_requests/sniffer.rb

Overview

Middleware for sniffer gem

Instance Method Summary collapse

Instance Method Details

#request(data_item) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/yabeda/http_requests/sniffer.rb', line 7

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.upcase
    }
  )
end

#response(data_item) ⇒ Object



18
19
20
21
22
# File 'lib/yabeda/http_requests/sniffer.rb', line 18

def response(data_item)
  yield
  log_http_response_total(data_item)
  log_http_response_duration(data_item)
end