Module: StatsWhisper::Caller
Instance Method Summary
collapse
Methods included from Config
#app_name, #config, #whitelist
Methods included from Parser
#build_key, #parse
Instance Method Details
#gather_stats(env, response_time) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/stats_whisper/caller.rb', line 12
def gather_stats(env, response_time)
if timing_allowed?(env["REQUEST_PATH"])
req_path = parse(env["REQUEST_PATH"])
StatsWhisper.backend.timing(build_key(app_name, 'http', env["REQUEST_METHOD"],
req_path,
'response_time'),
response_time)
StatsWhisper.backend.increment(build_key(app_name, 'http', req_path, 'visits'))
end
StatsWhisper.backend.increment(build_key(app_name, 'http', 'visits'))
end
|
#timing_allowed?(request_path) ⇒ Boolean
25
26
27
28
29
30
|
# File 'lib/stats_whisper/caller.rb', line 25
def timing_allowed?(request_path)
whitelist.empty? || whitelist.any? do |pattern|
Regexp.new(pattern) =~ request_path
end
end
|