request-log-analyzer 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,8 @@ begin
17
17
 
18
18
  command_line.command(:console) do |cons|
19
19
  cons.option(:database, :alias => :d, :required => true)
20
+ cons.option(:format, :alias => :f)
21
+ cons.option(:apache_format)
20
22
  end
21
23
 
22
24
  command_line.command(:strip) do |strip|
@@ -8,7 +8,7 @@ class DatabaseConsole
8
8
  end
9
9
 
10
10
  def run!
11
- libraries = ['irb/completion', 'rubygems', './lib/request_log_analyzer', './lib/cli/database_console_init']
11
+ libraries = ['irb/completion', 'rubygems','./lib/cli/database_console_init']
12
12
  libaries_string = libraries.map { |l| "-r #{l}" }.join(' ')
13
13
 
14
14
  ENV['RLA_DBCONSOLE_DATABASE'] = @arguments[:database]
@@ -1,5 +1,7 @@
1
1
  # Setup the include path
2
- $:.unshift(File.expand_path('..', File.dirname(__FILE__))
2
+ $:.unshift(File.expand_path('..', File.dirname(__FILE__)))
3
+ require 'request_log_analyzer'
4
+ require 'request_log_analyzer/database'
3
5
 
4
6
  $database = RequestLogAnalyzer::Database.new(ENV['RLA_DBCONSOLE_DATABASE'])
5
7
  $database.load_database_schema!
@@ -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.11.1"
16
+ VERSION = "1.12.0"
17
17
 
18
18
  # Convert a string/symbol in camelcase ({RequestLogAnalyzer::Controller}) to underscores
19
19
  # (<tt>request_log_analyzer/controller</tt>). This function can be used to load the file (using
@@ -24,8 +24,8 @@ class RequestLogAnalyzer::Database::Base < ActiveRecord::Base
24
24
  klass.line_definition = definition
25
25
 
26
26
  # Set relations with requests and sources table
27
- klass.belongs_to :request
28
- klass.belongs_to :source
27
+ klass.belongs_to :request, :class_name => RequestLogAnalyzer::Database::Request.name
28
+ klass.belongs_to :source, :class_name => RequestLogAnalyzer::Database::Source.name
29
29
 
30
30
  # Serialize complex fields into the database
31
31
  definition.captures.select { |c| c.has_key?(:provides) }.each do |capture|
@@ -45,12 +45,12 @@ class RequestLogAnalyzer::Database::Base < ActiveRecord::Base
45
45
  klass.set_table_name(table)
46
46
 
47
47
  if klass.column_names.include?('request_id')
48
- klass.belongs_to :request
48
+ klass.belongs_to :request, :class_name => RequestLogAnalyzer::Database::Request.name
49
49
  RequestLogAnalyzer::Database::Request.has_many table.to_sym
50
50
  end
51
51
 
52
52
  if klass.column_names.include?('source_id')
53
- klass.belongs_to :source
53
+ klass.belongs_to :source, :class_name => RequestLogAnalyzer::Database::Source.name
54
54
  RequestLogAnalyzer::Database::Source.has_many table.to_sym
55
55
  end
56
56
 
@@ -2,7 +2,7 @@ module RequestLogAnalyzer::FileFormat
2
2
 
3
3
  # Default FileFormat class for Rails 3 logs.
4
4
  #
5
- # For now, this is just a basic implementation. It will probaby change after
5
+ # For now, this is just a basic implementation. It will probaby change after
6
6
  # Rails 3 final has been released.
7
7
  class Rails3 < Base
8
8
 
@@ -32,14 +32,14 @@ module RequestLogAnalyzer::FileFormat
32
32
 
33
33
  # Parameters: {"action"=>"cached", "controller"=>"cached"}
34
34
  line_definition :parameters do |line|
35
- line.teaser = / Parameters:/
36
- line.regexp = / Parameters:\s+(\{.*\})/
35
+ line.teaser = / Parameters:/
36
+ line.regexp = / Parameters:\s+(\{.*\})/
37
37
  line.capture(:params).as(:eval)
38
38
  end
39
39
 
40
40
  # Completed 200 OK in 224ms (Views: 200.2ms | ActiveRecord: 3.4ms)
41
41
  # Completed 302 Found in 23ms
42
- # Completed in 189ms
42
+ # Completed in 189ms
43
43
  line_definition :completed do |line|
44
44
  line.footer = true
45
45
  line.teaser = /Completed /
@@ -63,8 +63,8 @@ module RequestLogAnalyzer::FileFormat
63
63
  end
64
64
 
65
65
  # # Not parsed at the moment:
66
- # SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
67
- # Query Load (0.4ms) SELECT `queries`.* FROM `queries`
66
+ # SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
67
+ # Query Load (0.4ms) SELECT `queries`.* FROM `queries`
68
68
  # Rendered collection (0.0ms)
69
69
  # Rendered queries/index.html.erb (0.6ms)
70
70
 
@@ -79,9 +79,9 @@ module RequestLogAnalyzer::FileFormat
79
79
  analyze.frequency :method, :title => 'HTTP methods'
80
80
  analyze.frequency :status, :title => 'HTTP statuses returned'
81
81
 
82
- analyze.duration :duration, :category => REQUEST_CATEGORIZER, :title => "Request duration", :line_type => :completed
83
- analyze.duration :view, :category => REQUEST_CATEGORIZER, :title => "View rendering time", :line_type => :completed
84
- analyze.duration :db, :category => REQUEST_CATEGORIZER, :title => "Database time", :line_type => :completed
82
+ analyze.duration :duration, :category => REQUEST_CATEGORIZER, :title => "Request duration", :line_type => :completed
83
+ analyze.duration :view, :category => REQUEST_CATEGORIZER, :title => "View rendering time", :line_type => :completed
84
+ analyze.duration :db, :category => REQUEST_CATEGORIZER, :title => "Database time", :line_type => :completed
85
85
 
86
86
  analyze.frequency :category => REQUEST_CATEGORIZER, :title => 'Process blockers (> 1 sec duration)',
87
87
  :if => lambda { |request| request[:duration] && request[:duration] > 1.0 }
@@ -92,7 +92,7 @@ module RequestLogAnalyzer::FileFormat
92
92
  MONTHS = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
93
93
 
94
94
  def convert_timestamp(value, definition)
95
- # the time value can be in 2 formats:
95
+ # the time value can be in 2 formats:
96
96
  # - 2010-10-26 02:27:15 +0000 (ruby 1.9.2)
97
97
  # - Thu Oct 25 16:15:18 -0800 2010
98
98
  if value =~ /^#{CommonRegularExpressions::TIMESTAMP_PARTS['Y']}/
@@ -113,4 +113,4 @@ module RequestLogAnalyzer::FileFormat
113
113
  end
114
114
 
115
115
  end
116
- end
116
+ end
@@ -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.11.1"
6
- s.date = "2011-08-20"
5
+ s.version = "1.12.0"
6
+ s.date = "2012-01-25"
7
7
 
8
8
  s.rubyforge_project = 'r-l-a'
9
9
 
@@ -42,7 +42,7 @@ describe RequestLogAnalyzer::Database::Base do
42
42
  end
43
43
 
44
44
  it "should set the :belongs_to relationship with the Request class" do
45
- @orm_class.should_receive(:belongs_to).with(:request)
45
+ @orm_class.should_receive(:belongs_to).with(:request, {:class_name=>"RequestLogAnalyzer::Database::Request"})
46
46
  RequestLogAnalyzer::Database::Base.subclass_from_line_definition(@line_definition)
47
47
  end
48
48
 
@@ -57,7 +57,7 @@ describe RequestLogAnalyzer::Database::Base do
57
57
  end
58
58
 
59
59
  it "should set the :belongs_to relationship with the Source class" do
60
- @orm_class.should_receive(:belongs_to).with(:source)
60
+ @orm_class.should_receive(:belongs_to).with(:source, {:class_name=>"RequestLogAnalyzer::Database::Source"})
61
61
  RequestLogAnalyzer::Database::Base.subclass_from_line_definition(@line_definition)
62
62
  end
63
63
 
@@ -96,7 +96,7 @@ describe RequestLogAnalyzer::Database::Base do
96
96
  end
97
97
 
98
98
  it "should create the :belongs_to relation to the request class" do
99
- @klass.should_receive(:belongs_to).with(:request)
99
+ @klass.should_receive(:belongs_to).with(:request, {:class_name=>"RequestLogAnalyzer::Database::Request"})
100
100
  RequestLogAnalyzer::Database::Base.subclass_from_table('completed_lines')
101
101
  end
102
102
 
@@ -106,7 +106,7 @@ describe RequestLogAnalyzer::Database::Base do
106
106
  end
107
107
 
108
108
  it "should create the :belongs_to relation to the source class" do
109
- @klass.should_receive(:belongs_to).with(:source)
109
+ @klass.should_receive(:belongs_to).with(:source, {:class_name=>"RequestLogAnalyzer::Database::Source"})
110
110
  RequestLogAnalyzer::Database::Base.subclass_from_table('completed_lines')
111
111
  end
112
112
 
metadata CHANGED
@@ -1,81 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
- version: !ruby/object:Gem::Version
4
- version: 1.11.1
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.12.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Willem van Bergen
9
9
  - Bart ten Brinke
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-20 00:00:00.000000000 -04:00
14
- default_executable: request-log-analyzer
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+
14
+ date: 2012-01-25 00:00:00 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
17
  name: rake
18
- requirement: &2153310460 !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
19
20
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
24
25
  type: :development
25
- prerelease: false
26
- version_requirements: *2153310460
27
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
- requirement: &2153309700 !ruby/object:Gem::Requirement
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
30
31
  none: false
31
- requirements:
32
+ requirements:
32
33
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: '2.0'
34
+ - !ruby/object:Gem::Version
35
+ version: "2.0"
35
36
  type: :development
36
- prerelease: false
37
- version_requirements: *2153309700
38
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
39
  name: activerecord
40
- requirement: &2153309000 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
41
42
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
46
47
  type: :development
47
- prerelease: false
48
- version_requirements: *2153309000
49
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
50
  name: sqlite3
51
- requirement: &2153308320 !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
52
53
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
56
- version: '0'
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
57
58
  type: :development
58
- prerelease: false
59
- version_requirements: *2153308320
60
- description: ! " Request log analyzer's purpose is to find out how your web application
61
- is being used, how it performs and to\n focus your optimization efforts. This
62
- tool will parse all requests in the application's log file and aggregate the \n
63
- \ information. Once it is finished parsing the log file(s), it will show the requests
64
- that take op most server time \n using various metrics. It can also insert all
65
- parsed request information into a database so you can roll your own\n analysis.
66
- It supports Rails-, Merb- and Rack-based applications logs, Apache and Amazon S3
67
- access logs and MySQL \n slow query logs out of the box, but file formats of
68
- other applications can easily be supported by supplying an \n easy to write log
69
- file format definition.\n"
70
- email:
59
+ version_requirements: *id004
60
+ description: " Request log analyzer's purpose is to find out how your web application is being used, how it performs and to\n focus your optimization efforts. This tool will parse all requests in the application's log file and aggregate the \n information. Once it is finished parsing the log file(s), it will show the requests that take op most server time \n using various metrics. It can also insert all parsed request information into a database so you can roll your own\n analysis. It supports Rails-, Merb- and Rack-based applications logs, Apache and Amazon S3 access logs and MySQL \n slow query logs out of the box, but file formats of other applications can easily be supported by supplying an \n easy to write log file format definition.\n"
61
+ email:
71
62
  - willem@railsdoctors.com
72
63
  - bart@railsdoctors.com
73
- executables:
64
+ executables:
74
65
  - request-log-analyzer
75
66
  extensions: []
76
- extra_rdoc_files:
67
+
68
+ extra_rdoc_files:
77
69
  - README.rdoc
78
- files:
70
+ files:
79
71
  - .gitignore
80
72
  - .infinity_test
81
73
  - .travis.yml
@@ -218,41 +210,39 @@ files:
218
210
  - spec/unit/tracker/traffic_tracker_spec.rb
219
211
  - tasks/github-gem.rake
220
212
  - tasks/request_log_analyzer.rake
221
- has_rdoc: true
222
213
  homepage: http://railsdoctors.com
223
214
  licenses: []
215
+
224
216
  post_install_message:
225
- rdoc_options:
217
+ rdoc_options:
226
218
  - --title
227
219
  - request-log-analyzer
228
220
  - --main
229
221
  - README.rdoc
230
222
  - --line-numbers
231
223
  - --inline-source
232
- require_paths:
224
+ require_paths:
233
225
  - lib
234
- required_ruby_version: !ruby/object:Gem::Requirement
226
+ required_ruby_version: !ruby/object:Gem::Requirement
235
227
  none: false
236
- requirements:
237
- - - ! '>='
238
- - !ruby/object:Gem::Version
239
- version: '0'
240
- required_rubygems_version: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: "0"
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
241
233
  none: false
242
- requirements:
243
- - - ! '>='
244
- - !ruby/object:Gem::Version
245
- version: '0'
246
- requirements:
247
- - To use the database inserter, ActiveRecord and an appropriate database adapter are
248
- required.
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ version: "0"
238
+ requirements:
239
+ - To use the database inserter, ActiveRecord and an appropriate database adapter are required.
249
240
  rubyforge_project: r-l-a
250
- rubygems_version: 1.6.2
241
+ rubygems_version: 1.8.15
251
242
  signing_key:
252
243
  specification_version: 3
253
- summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL
254
- and other web application servers
255
- test_files:
244
+ summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
245
+ test_files:
256
246
  - spec/integration/command_line_usage_spec.rb
257
247
  - spec/integration/mailer_spec.rb
258
248
  - spec/integration/munin_plugins_rails_spec.rb