wvanbergen-request-log-analyzer 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/request_log_analyzer.rb
CHANGED
@@ -11,7 +11,7 @@ module RequestLogAnalyzer
|
|
11
11
|
|
12
12
|
# The current version of request-log-analyzer.
|
13
13
|
# This will be diplayed in output reports etc.
|
14
|
-
VERSION = '1.2.
|
14
|
+
VERSION = '1.2.5'
|
15
15
|
|
16
16
|
# Loads constants in the RequestLogAnalyzer namespace using self.load_default_class_file(base, const)
|
17
17
|
# <tt>const</tt>:: The constant that is not yet loaded in the RequestLogAnalyzer namespace. This should be passed as a string or symbol.
|
@@ -16,18 +16,16 @@ module RequestLogAnalyzer::FileFormat
|
|
16
16
|
line.teaser = /Params/
|
17
17
|
line.regexp = /Params\:\ (\{.+\})/
|
18
18
|
line.captures << { :name => :params, :type => :eval, :provides => {
|
19
|
-
:namespace => :string, :controller => :string, :action => :string, :format => :string } }
|
19
|
+
:namespace => :string, :controller => :string, :action => :string, :format => :string, :method => :string } }
|
20
20
|
end
|
21
21
|
|
22
22
|
# ~ {:dispatch_time=>0.006117, :after_filters_time=>6.1e-05, :before_filters_time=>0.000712, :action_time=>0.005833}
|
23
23
|
line_definition :completed do |line|
|
24
24
|
line.footer = true
|
25
|
-
line.
|
26
|
-
line.
|
27
|
-
|
28
|
-
|
29
|
-
<< { :name => :before_filters_time, :type => :duration } \
|
30
|
-
<< { :name => :action_time, :type => :duration }
|
25
|
+
line.regexp = /(\{.*\:dispatch_time\s*=>\s*\d+\.\d+.*\})/
|
26
|
+
line.captures << { :name => :times_hash, :type => :eval, :provides => {
|
27
|
+
:dispatch_time => :duration, :after_filters_time => :duration,
|
28
|
+
:before_filters_time => :duration, :action_time => :duration } }
|
31
29
|
end
|
32
30
|
|
33
31
|
REQUEST_CATEGORIZER = Proc.new do |request|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Aug 31 18:35:23 typekit-web001 merb: ~
|
2
|
+
Aug 31 18:35:23 typekit-web001 merb: cache: [GET /] miss
|
3
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ Started request handling: Mon Aug 31 18:35:25 +0000 2009
|
4
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ Routed to: {"action"=>"index", "controller"=>"home"}
|
5
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ Params: {"action"=>"index", "controller"=>"home"}
|
6
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ In repository block default
|
7
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ (0.000000) SELECT `id`, `created_at`, `updated_at`, `braintree_vault_id`, `cancelled_at` FROM `accounts` WHERE (`id` IN (6214)) ORDER BY `id`
|
8
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ Redirecting to: /plans (302)
|
9
|
+
Aug 31 18:35:24 typekit-web001 merb: ~ {:after_filters_time=>0.0, :before_filters_time=>0.0, :dispatch_time=>0.012001, :action_time=>0.012001}
|
@@ -23,15 +23,34 @@ describe RequestLogAnalyzer::Source::LogParser, :merb do
|
|
23
23
|
@log_parser.parse_file(log_fixture(:merb))
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should parse all details from
|
26
|
+
it "should parse all details from the first request correctly" do
|
27
27
|
request = nil
|
28
28
|
@log_parser.parse_file(log_fixture(:merb)) { |found_request| request ||= found_request }
|
29
29
|
|
30
30
|
request.should be_completed
|
31
|
+
request[:controller].should == 'session'
|
32
|
+
request[:action].should == 'destroy'
|
33
|
+
request[:method].should == 'delete'
|
34
|
+
request[:params].should be_kind_of(Hash)
|
31
35
|
request[:timestamp].should == 20080829111023 # 'Fri Aug 29 11:10:23 +0200 2008'
|
32
36
|
request[:dispatch_time].should == 0.243424
|
33
37
|
request[:after_filters_time].should == 6.9e-05
|
34
38
|
request[:before_filters_time].should == 0.213213
|
35
39
|
request[:action_time].should == 0.241652
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should parse a prefixed Merb file correctly" do
|
44
|
+
request = nil
|
45
|
+
@log_parser.parse_file(log_fixture(:merb_prefixed)) { |found_request| request ||= found_request }
|
46
|
+
|
47
|
+
request.should be_completed
|
48
|
+
request[:timestamp].should == 20090831183525
|
49
|
+
request[:controller].should == 'home'
|
50
|
+
request[:action].should == 'index'
|
51
|
+
request[:dispatch_time].should == 0.012001
|
52
|
+
request[:after_filters_time].should == 0.0
|
53
|
+
request[:before_filters_time].should == 0.0
|
54
|
+
request[:action_time].should == 0.012001
|
36
55
|
end
|
37
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wvanbergen-request-log-analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- spec/fixtures/decompression.tgz
|
81
81
|
- spec/fixtures/header_and_footer.log
|
82
82
|
- spec/fixtures/merb.log
|
83
|
+
- spec/fixtures/merb_prefixed.log
|
83
84
|
- spec/fixtures/multiple_files_1.log
|
84
85
|
- spec/fixtures/multiple_files_2.log
|
85
86
|
- spec/fixtures/rails_1x.log
|