request-log-analyzer 1.9.1 → 1.9.2
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 +1 -1
- data/lib/request_log_analyzer/file_format/rails.rb +1 -1
- data/request-log-analyzer.gemspec +2 -2
- data/spec/unit/file_format/format_autodetection_spec.rb +6 -6
- data/spec/unit/file_format/rails3_format_spec.rb +1 -8
- data/spec/unit/file_format/rails_format_spec.rb +5 -0
- metadata +4 -17
data/lib/request_log_analyzer.rb
CHANGED
@@ -13,7 +13,7 @@ module RequestLogAnalyzer
|
|
13
13
|
|
14
14
|
# The current version of request-log-analyzer.
|
15
15
|
# Do not change the value by hand; it will be updated automatically by the gem release script.
|
16
|
-
VERSION = "1.9.
|
16
|
+
VERSION = "1.9.2"
|
17
17
|
|
18
18
|
|
19
19
|
autoload :Controller, 'request_log_analyzer/controller'
|
@@ -82,7 +82,7 @@ module RequestLogAnalyzer::FileFormat
|
|
82
82
|
|
83
83
|
# Rails > 2.1 completed line example
|
84
84
|
# Completed in 614ms (View: 120, DB: 31) | 200 OK [http://floorplanner.local/demo]
|
85
|
-
RAILS_22_COMPLETED = /Completed in (\d+)ms \((?:View: (\d+)
|
85
|
+
RAILS_22_COMPLETED = /Completed in (\d+)ms \((?:View: (\d+))?(?:, DB: (\d+)\))? \| (\d\d\d).+\[(http.+)\]/
|
86
86
|
|
87
87
|
# A hash of definitions for all common lines in Rails logs.
|
88
88
|
LINE_DEFINITIONS = {
|
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = "request-log-analyzer"
|
3
3
|
|
4
4
|
# Do not set the version and date field manually, this is done by the release script
|
5
|
-
s.version = "1.9.
|
6
|
-
s.date = "2010-
|
5
|
+
s.version = "1.9.2"
|
6
|
+
s.date = "2010-10-01"
|
7
7
|
|
8
8
|
s.rubyforge_project = 'r-l-a'
|
9
9
|
|
@@ -5,32 +5,32 @@ describe RequestLogAnalyzer::FileFormat do
|
|
5
5
|
describe '.autodetect' do
|
6
6
|
it "should autodetect a Merb log" do
|
7
7
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:merb))
|
8
|
-
file_format.should
|
8
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Merb)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should autodetect a MySQL slow query log" do
|
12
12
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:mysql_slow_query))
|
13
|
-
file_format.should
|
13
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Mysql)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should autodetect a Rails 1.x log" do
|
17
17
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:rails_1x))
|
18
|
-
file_format.should
|
18
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Rails)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should autodetect a Rails 2.x log" do
|
22
22
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:rails_22))
|
23
|
-
file_format.should
|
23
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::RailsDevelopment)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should autodetect an Apache access log" do
|
27
27
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:apache_common))
|
28
|
-
file_format.should
|
28
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Apache)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should autodetect a Rack access log" do
|
32
32
|
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:sinatra))
|
33
|
-
file_format.should
|
33
|
+
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Rack)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should not find any file format with a bogus file" do
|
@@ -21,19 +21,12 @@ describe RequestLogAnalyzer::FileFormat::Rails do
|
|
21
21
|
:controller => 'QueriesController', :action => 'index', :format => 'HTML')
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
# it "should parse beta :completed lines correctly" do
|
26
|
-
# line = 'Completed in 9ms (Views: 4.9ms | ActiveRecord: 0.5ms) with 200'
|
27
|
-
# @file_format.should parse_line(line).as(:completed).and_capture(
|
28
|
-
# :duration => 0.009, :status => 200)
|
29
|
-
# end
|
30
|
-
|
31
24
|
it "should parse :completed lines correctly" do
|
32
25
|
line = 'Completed 200 OK in 170ms (Views: 78.4ms | ActiveRecord: 48.2ms)'
|
33
26
|
@file_format.should parse_line(line).as(:completed).and_capture(
|
34
27
|
:duration => 0.170, :status => 200)
|
35
28
|
end
|
36
|
-
|
29
|
+
|
37
30
|
it "should pase :failure lines correctly" do
|
38
31
|
line = "ActionView::Template::Error (undefined local variable or method `field' for #<Class>) on line #3 of /Users/willem/Code/warehouse/app/views/queries/execute.csv.erb:"
|
39
32
|
@file_format.should parse_line(line).as(:failure).and_capture(:line => 3,
|
@@ -75,6 +75,11 @@ describe RequestLogAnalyzer::FileFormat::Rails do
|
|
75
75
|
@rails.should parse_line(line).as(:completed).and_capture(:duration => 0.614, :db => 0.031, :view => 0.120, :status => 200, :url => 'http://floorplanner.local/demo')
|
76
76
|
end
|
77
77
|
|
78
|
+
it "should parse a Rails 2.2 style :completed line correctly when AR is disabled" do
|
79
|
+
line = prefix + 'Completed in 597ms (View: 298 | 200 OK [http://shapado.com]'
|
80
|
+
@rails.should parse_line(line).as(:completed).and_capture(:duration => 0.597, :db => nil, :view => 0.298, :status => 200, :url => 'http://shapado.com')
|
81
|
+
end
|
82
|
+
|
78
83
|
it "should parse a :failure line with exception correctly" do
|
79
84
|
line = prefix + "NoMethodError (undefined method `update_domain_account' for nil:NilClass):"
|
80
85
|
@rails.should parse_line(line).as(:failure).and_capture(:error => 'NoMethodError', :message => "undefined method `update_domain_account' for nil:NilClass")
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: request-log-analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 49
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 9
|
9
|
-
-
|
10
|
-
version: 1.9.
|
8
|
+
- 2
|
9
|
+
version: 1.9.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Willem van Bergen
|
@@ -16,18 +15,16 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-
|
18
|
+
date: 2010-10-01 00:00:00 +02:00
|
20
19
|
default_executable: request-log-analyzer
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: rake
|
24
23
|
prerelease: false
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
25
|
requirements:
|
28
26
|
- - ">="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
28
|
segments:
|
32
29
|
- 0
|
33
30
|
version: "0"
|
@@ -37,11 +34,9 @@ dependencies:
|
|
37
34
|
name: rspec
|
38
35
|
prerelease: false
|
39
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
37
|
requirements:
|
42
38
|
- - ">="
|
43
39
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
40
|
segments:
|
46
41
|
- 0
|
47
42
|
version: "0"
|
@@ -51,11 +46,9 @@ dependencies:
|
|
51
46
|
name: activerecord
|
52
47
|
prerelease: false
|
53
48
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
49
|
requirements:
|
56
50
|
- - ">="
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
hash: 3
|
59
52
|
segments:
|
60
53
|
- 0
|
61
54
|
version: "0"
|
@@ -65,11 +58,9 @@ dependencies:
|
|
65
58
|
name: sqlite3-ruby
|
66
59
|
prerelease: false
|
67
60
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
61
|
requirements:
|
70
62
|
- - ">="
|
71
63
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
64
|
segments:
|
74
65
|
- 0
|
75
66
|
version: "0"
|
@@ -239,27 +230,23 @@ rdoc_options:
|
|
239
230
|
require_paths:
|
240
231
|
- lib
|
241
232
|
required_ruby_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
233
|
requirements:
|
244
234
|
- - ">="
|
245
235
|
- !ruby/object:Gem::Version
|
246
|
-
hash: 3
|
247
236
|
segments:
|
248
237
|
- 0
|
249
238
|
version: "0"
|
250
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
-
none: false
|
252
240
|
requirements:
|
253
241
|
- - ">="
|
254
242
|
- !ruby/object:Gem::Version
|
255
|
-
hash: 3
|
256
243
|
segments:
|
257
244
|
- 0
|
258
245
|
version: "0"
|
259
246
|
requirements:
|
260
247
|
- To use the database inserter, ActiveRecord and an appropriate database adapter are required.
|
261
248
|
rubyforge_project: r-l-a
|
262
|
-
rubygems_version: 1.3.
|
249
|
+
rubygems_version: 1.3.6
|
263
250
|
signing_key:
|
264
251
|
specification_version: 3
|
265
252
|
summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
|