Skip to content

Commit

Permalink
Merb file format improvements using the new Hash parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Jan 29, 2009
1 parent b00c69b commit 59b7022
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/request_log_analyzer/file_format/merb.rb
Expand Up @@ -15,7 +15,8 @@ class Merb < Base
line_definition :params do |line|
line.teaser = /Params/
line.regexp = /Params\:\ (\{.+\})/
line.captures << { :name => :params, :type => :eval, :provides => { :controller => :string, :action => :string } }
line.captures << { :name => :params, :type => :eval, :provides => {
:namespace => :string, :controller => :string, :action => :string, :format => :string } }
end

# ~ {:dispatch_time=>0.006117, :after_filters_time=>6.1e-05, :before_filters_time=>0.000712, :action_time=>0.005833}
Expand All @@ -29,7 +30,12 @@ class Merb < Base
<< { :name => :action_time, :type => :duration }
end

REQUEST_CATEGORIZER = Proc.new { |request| "#{request[:controller]}##{request[:action]}" }
REQUEST_CATEGORIZER = Proc.new do |request|
category = "#{request[:controller]}##{request[:action]}"
category = "#{request[:namespace]}::#{category}" if request[:namespace]
category = "#{category}.#{request[:format]}" if request[:format]
category
end

report do |analyze|
analyze.timespan :line_type => :started
Expand Down

0 comments on commit 59b7022

Please sign in to comment.