request-log-analyzer 1.9.7 → 1.9.8
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/delayed_job2.rb +2 -2
- data/lib/request_log_analyzer/file_format/delayed_job21.rb +2 -2
- data/lib/request_log_analyzer/tracker/numeric_value.rb +5 -1
- data/request-log-analyzer.gemspec +2 -2
- data/spec/unit/file_format/delayed_job21_format_spec.rb +6 -0
- data/spec/unit/file_format/delayed_job2_format_spec.rb +6 -0
- data/spec/unit/tracker/numeric_value_tracker_spec.rb +4 -1
- metadata +10 -4
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.8"
|
17
17
|
|
18
18
|
|
19
19
|
autoload :Controller, 'request_log_analyzer/controller'
|
@@ -8,7 +8,7 @@ module RequestLogAnalyzer::FileFormat
|
|
8
8
|
|
9
9
|
line_definition :job_lock do |line|
|
10
10
|
line.header = true
|
11
|
-
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \* \[Worker\(\
|
11
|
+
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \* \[Worker\(\S+ host:(\S+) pid:(\d+)\)\] acquired lock on (\S+)/
|
12
12
|
|
13
13
|
line.capture(:timestamp).as(:timestamp)
|
14
14
|
line.capture(:host)
|
@@ -18,7 +18,7 @@ module RequestLogAnalyzer::FileFormat
|
|
18
18
|
|
19
19
|
line_definition :job_completed do |line|
|
20
20
|
line.footer = true
|
21
|
-
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \* \[JOB\] \
|
21
|
+
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \* \[JOB\] \S+ host:(\S+) pid:(\d+) completed after (\d+\.\d+)/
|
22
22
|
line.capture(:timestamp).as(:timestamp)
|
23
23
|
line.capture(:host)
|
24
24
|
line.capture(:pid).as(:integer)
|
@@ -8,7 +8,7 @@ module RequestLogAnalyzer::FileFormat
|
|
8
8
|
|
9
9
|
line_definition :job_lock do |line|
|
10
10
|
line.header = true
|
11
|
-
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \[Worker\(\
|
11
|
+
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \[Worker\(\S+ host:(\S+) pid:(\d+)\)\] acquired lock on (\S+)/
|
12
12
|
|
13
13
|
line.capture(:timestamp).as(:timestamp)
|
14
14
|
line.capture(:host)
|
@@ -18,7 +18,7 @@ module RequestLogAnalyzer::FileFormat
|
|
18
18
|
|
19
19
|
line_definition :job_completed do |line|
|
20
20
|
line.footer = true
|
21
|
-
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \[Worker\(\
|
21
|
+
line.regexp = /(#{timestamp('%Y-%m-%dT%H:%M:%S%z')}): \[Worker\(\S+ host:(\S+) pid:(\d+)\)\] (\S+) completed after (\d+\.\d+)/
|
22
22
|
line.capture(:timestamp).as(:timestamp)
|
23
23
|
line.capture(:host)
|
24
24
|
line.capture(:pid).as(:integer)
|
@@ -121,10 +121,14 @@ module RequestLogAnalyzer::Tracker
|
|
121
121
|
# Returns all the categories and the tracked duration as a hash than can be exported to YAML
|
122
122
|
def to_yaml_object
|
123
123
|
return nil if @categories.empty?
|
124
|
+
@categories.each do |cat, info|
|
125
|
+
info[:stddev] = stddev(cat)
|
126
|
+
info[:median] = median(cat) if info[:buckets]
|
127
|
+
info[:interval_95_percent] = percentile_interval(cat, 95) if info[:buckets]
|
128
|
+
end
|
124
129
|
@categories
|
125
130
|
end
|
126
131
|
|
127
|
-
|
128
132
|
# Returns the bucket index for a value
|
129
133
|
def bucket_index(value)
|
130
134
|
return 0 if value < @min_bucket_value
|
@@ -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.8"
|
6
|
+
s.date = "2010-12-01"
|
7
7
|
|
8
8
|
s.rubyforge_project = 'r-l-a'
|
9
9
|
|
@@ -18,6 +18,12 @@ describe RequestLogAnalyzer::FileFormat::DelayedJob do
|
|
18
18
|
:job => 'S3FileJob', :host => 'hostname.co.uk', :pid => 11888)
|
19
19
|
end
|
20
20
|
|
21
|
+
it "should parse a :job_lock line correctly when the worker is one of many" do
|
22
|
+
line = "2010-05-17T17:37:34+0000: [Worker(delayed_job.0 host:hostname.co.uk pid:11888)] acquired lock on S3FileJob"
|
23
|
+
@file_format.should parse_line(line).as(:job_lock).and_capture(:timestamp => 20100517173734,
|
24
|
+
:job => 'S3FileJob', :host => 'hostname.co.uk', :pid => 11888)
|
25
|
+
end
|
26
|
+
|
21
27
|
it "should parse a :job_completed line correctly" do
|
22
28
|
line = '2010-05-17T17:37:35+0000: [Worker(delayed_job host:hostname.co.uk pid:11888)] S3FileJob completed after 1.0676'
|
23
29
|
@file_format.should parse_line(line).as(:job_completed).and_capture(:timestamp => 20100517173735,
|
@@ -18,6 +18,12 @@ describe RequestLogAnalyzer::FileFormat::DelayedJob do
|
|
18
18
|
:job => 'S3FileJob', :host => 'hostname.co.uk', :pid => 11888)
|
19
19
|
end
|
20
20
|
|
21
|
+
it "should parse a :job_lock line correctly when the worker is one of many" do
|
22
|
+
line = "2010-05-17T17:37:34+0000: * [Worker(delayed_job.0 host:hostname.co.uk pid:11888)] acquired lock on S3FileJob"
|
23
|
+
@file_format.should parse_line(line).as(:job_lock).and_capture(:timestamp => 20100517173734,
|
24
|
+
:job => 'S3FileJob', :host => 'hostname.co.uk', :pid => 11888)
|
25
|
+
end
|
26
|
+
|
21
27
|
it "should parse a :job_completed line correctly" do
|
22
28
|
line = '2010-05-17T17:37:35+0000: * [JOB] delayed_job host:hostname.co.uk pid:11888 completed after 1.0676'
|
23
29
|
@file_format.should parse_line(line).as(:job_completed).and_capture(:timestamp => 20100517173735,
|
@@ -133,8 +133,11 @@ describe RequestLogAnalyzer::Tracker::NumericValue do
|
|
133
133
|
@tracker.update(request(:category => 'a', :blah => 2))
|
134
134
|
@tracker.update(request(:category => 'b', :blah => 3))
|
135
135
|
@tracker.to_yaml_object.keys.should =~ ['a', 'b']
|
136
|
+
|
136
137
|
@tracker.to_yaml_object['a'].should include(:min => 2, :hits => 1, :max => 2, :mean => 2.0, :sum => 2, :sum_of_squares => 0.0)
|
137
|
-
@tracker.to_yaml_object['
|
138
|
+
@tracker.to_yaml_object['a'][:interval_95_percent].member?(2).should be_true
|
139
|
+
@tracker.to_yaml_object['b'].should include(:min => 3, :hits => 1, :max => 3, :mean => 3.0, :sum => 3, :sum_of_squares => 0.0)
|
140
|
+
@tracker.to_yaml_object['b'][:interval_95_percent].should be_true
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 1.9.
|
8
|
+
- 8
|
9
|
+
version: 1.9.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Willem van Bergen
|
@@ -15,13 +15,14 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-01 00:00:00 -05:00
|
19
19
|
default_executable: request-log-analyzer
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rake
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
@@ -34,6 +35,7 @@ dependencies:
|
|
34
35
|
name: rspec
|
35
36
|
prerelease: false
|
36
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
37
39
|
requirements:
|
38
40
|
- - ~>
|
39
41
|
- !ruby/object:Gem::Version
|
@@ -47,6 +49,7 @@ dependencies:
|
|
47
49
|
name: activerecord
|
48
50
|
prerelease: false
|
49
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
50
53
|
requirements:
|
51
54
|
- - ">="
|
52
55
|
- !ruby/object:Gem::Version
|
@@ -59,6 +62,7 @@ dependencies:
|
|
59
62
|
name: sqlite3-ruby
|
60
63
|
prerelease: false
|
61
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
62
66
|
requirements:
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
@@ -231,6 +235,7 @@ rdoc_options:
|
|
231
235
|
require_paths:
|
232
236
|
- lib
|
233
237
|
required_ruby_version: !ruby/object:Gem::Requirement
|
238
|
+
none: false
|
234
239
|
requirements:
|
235
240
|
- - ">="
|
236
241
|
- !ruby/object:Gem::Version
|
@@ -238,6 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
243
|
- 0
|
239
244
|
version: "0"
|
240
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
|
+
none: false
|
241
247
|
requirements:
|
242
248
|
- - ">="
|
243
249
|
- !ruby/object:Gem::Version
|
@@ -247,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
253
|
requirements:
|
248
254
|
- To use the database inserter, ActiveRecord and an appropriate database adapter are required.
|
249
255
|
rubyforge_project: r-l-a
|
250
|
-
rubygems_version: 1.3.
|
256
|
+
rubygems_version: 1.3.7
|
251
257
|
signing_key:
|
252
258
|
specification_version: 3
|
253
259
|
summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
|