request-log-analyzer 1.2.1 → 1.2.6

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.
Files changed (44) hide show
  1. data/.gitignore +10 -0
  2. data/Rakefile +3 -1
  3. data/lib/request_log_analyzer/aggregator/database.rb +79 -46
  4. data/lib/request_log_analyzer/controller.rb +12 -7
  5. data/lib/request_log_analyzer/file_format/merb.rb +5 -7
  6. data/lib/request_log_analyzer/line_definition.rb +9 -0
  7. data/lib/request_log_analyzer/request.rb +2 -2
  8. data/lib/request_log_analyzer/source/log_parser.rb +4 -0
  9. data/lib/request_log_analyzer.rb +1 -1
  10. data/request-log-analyzer.gemspec +36 -0
  11. data/spec/fixtures/header_and_footer.log +6 -0
  12. data/spec/fixtures/merb_prefixed.log +9 -0
  13. data/spec/integration/command_line_usage_spec.rb +0 -2
  14. data/spec/lib/{helper.rb → helpers.rb} +1 -3
  15. data/spec/lib/macros.rb +2 -0
  16. data/spec/lib/matchers.rb +63 -0
  17. data/spec/lib/mocks.rb +12 -1
  18. data/spec/lib/testing_format.rb +6 -0
  19. data/spec/spec.opts +3 -0
  20. data/spec/spec_helper.rb +13 -4
  21. data/spec/unit/aggregator/database_spec.rb +234 -0
  22. data/spec/unit/aggregator/summarizer_spec.rb +0 -2
  23. data/spec/unit/controller/controller_spec.rb +0 -2
  24. data/spec/unit/controller/log_processor_spec.rb +0 -2
  25. data/spec/unit/file_format/file_format_api_spec.rb +50 -71
  26. data/spec/unit/file_format/line_definition_spec.rb +49 -45
  27. data/spec/unit/file_format/merb_format_spec.rb +20 -2
  28. data/spec/unit/file_format/rails_format_spec.rb +0 -2
  29. data/spec/unit/filter/anonymize_filter_spec.rb +0 -1
  30. data/spec/unit/filter/field_filter_spec.rb +0 -3
  31. data/spec/unit/filter/filter_spec.rb +17 -0
  32. data/spec/unit/filter/timespan_filter_spec.rb +0 -3
  33. data/spec/unit/source/log_parser_spec.rb +5 -4
  34. data/spec/unit/source/request_spec.rb +91 -52
  35. data/spec/unit/tracker/duration_tracker_spec.rb +0 -6
  36. data/spec/unit/tracker/frequency_tracker_spec.rb +0 -6
  37. data/spec/unit/tracker/hourly_spread_spec.rb +0 -4
  38. data/spec/unit/tracker/timespan_tracker_spec.rb +0 -4
  39. data/spec/unit/tracker/tracker_api_spec.rb +0 -2
  40. data/tasks/github-gem.rake +199 -192
  41. metadata +120 -92
  42. data/RELEASE_NOTES.rdoc +0 -10
  43. data/spec/unit/aggregator/database_inserter_spec.rb +0 -106
  44. data/tasks/rspec.rake +0 -12
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -10,12 +10,33 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-07-15 00:00:00 +02:00
13
+ date: 2009-09-02 00:00:00 +02:00
14
14
  default_executable: request-log-analyzer
15
- dependencies: []
16
-
17
- description: Rails log analyzer's purpose is to find what actions are best candidates for optimization. This tool will parse all requests in the Rails logfile and aggregate the information. Once it is finished parsing the log file, it will show the requests that take op most server time using various metrics.
18
- email: willem@vanbergen.org
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.2.4
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: git
28
+ type: :development
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.1.0
35
+ version:
36
+ description: " Request log analyzer's purpose is to find ot how your web application is being used and to focus your optimization efforts.\n This tool will parse all requests in the application's log file and aggregate the information. Once it is finished parsing \n the log file(s), it will show the requests that take op most server time using various metrics. It can also insert all \n parsed request information into a database so you can roll your own analysis. It supports Rails- and Merb-based applications \n out of the box, but file formats of other applications can easily be supported by supplying an easy to write log file format \n definition.\n"
37
+ email:
38
+ - willem@railsdoctors.com
39
+ - bart@railsdoctors.com
19
40
  executables:
20
41
  - request-log-analyzer
21
42
  extensions: []
@@ -23,88 +44,94 @@ extensions: []
23
44
  extra_rdoc_files:
24
45
  - README.rdoc
25
46
  files:
26
- - DESIGN.rdoc
27
- - LICENSE
28
- - README.rdoc
29
- - RELEASE_NOTES.rdoc
30
- - Rakefile
31
- - bin/request-log-analyzer
32
- - lib/cli/command_line_arguments.rb
33
- - lib/cli/progressbar.rb
34
- - lib/cli/tools.rb
35
- - lib/request_log_analyzer.rb
36
- - lib/request_log_analyzer/aggregator.rb
37
- - lib/request_log_analyzer/aggregator/database.rb
38
- - lib/request_log_analyzer/aggregator/echo.rb
39
- - lib/request_log_analyzer/aggregator/summarizer.rb
47
+ - spec/unit/filter/anonymize_filter_spec.rb
48
+ - lib/request_log_analyzer/line_definition.rb
49
+ - lib/request_log_analyzer/output/html.rb
40
50
  - lib/request_log_analyzer/controller.rb
41
- - lib/request_log_analyzer/file_format.rb
42
- - lib/request_log_analyzer/file_format/merb.rb
43
- - lib/request_log_analyzer/file_format/rails.rb
51
+ - spec/fixtures/rails_22_cached.log
44
52
  - lib/request_log_analyzer/file_format/rails_development.rb
45
- - lib/request_log_analyzer/filter.rb
46
- - lib/request_log_analyzer/filter/anonymize.rb
47
- - lib/request_log_analyzer/filter/field.rb
48
- - lib/request_log_analyzer/filter/timespan.rb
49
- - lib/request_log_analyzer/line_definition.rb
53
+ - spec/lib/macros.rb
54
+ - spec/fixtures/merb_prefixed.log
55
+ - tasks/request_log_analyzer.rake
56
+ - spec/unit/file_format/file_format_api_spec.rb
57
+ - spec/integration/command_line_usage_spec.rb
58
+ - spec/fixtures/decompression.log.bz2
50
59
  - lib/request_log_analyzer/log_processor.rb
51
- - lib/request_log_analyzer/output.rb
52
- - lib/request_log_analyzer/output/fixed_width.rb
53
- - lib/request_log_analyzer/output/html.rb
54
- - lib/request_log_analyzer/request.rb
55
- - lib/request_log_analyzer/source.rb
56
- - lib/request_log_analyzer/source/database.rb
57
- - lib/request_log_analyzer/source/log_parser.rb
58
60
  - lib/request_log_analyzer/tracker.rb
59
- - lib/request_log_analyzer/tracker/duration.rb
61
+ - lib/request_log_analyzer/filter.rb
62
+ - spec/fixtures/rails_unordered.log
63
+ - bin/request-log-analyzer
64
+ - request-log-analyzer.gemspec
65
+ - DESIGN.rdoc
66
+ - spec/unit/filter/timespan_filter_spec.rb
67
+ - lib/request_log_analyzer/filter/field.rb
60
68
  - lib/request_log_analyzer/tracker/frequency.rb
61
- - lib/request_log_analyzer/tracker/hourly_spread.rb
62
- - lib/request_log_analyzer/tracker/timespan.rb
63
- - spec/fixtures/decompression.log
64
- - spec/fixtures/decompression.log.bz2
65
69
  - spec/fixtures/decompression.log.gz
66
- - spec/fixtures/decompression.log.zip
70
+ - spec/fixtures/decompression.log
71
+ - spec/lib/matchers.rb
72
+ - spec/fixtures/test_order.log
73
+ - lib/request_log_analyzer/output/fixed_width.rb
74
+ - lib/request_log_analyzer/filter/anonymize.rb
75
+ - spec/lib/testing_format.rb
76
+ - lib/request_log_analyzer/tracker/timespan.rb
77
+ - lib/request_log_analyzer/aggregator.rb
78
+ - lib/cli/progressbar.rb
79
+ - README.rdoc
80
+ - spec/fixtures/merb.log
81
+ - lib/request_log_analyzer/tracker/hourly_spread.rb
82
+ - .gitignore
83
+ - spec/unit/tracker/tracker_api_spec.rb
84
+ - spec/unit/tracker/duration_tracker_spec.rb
85
+ - lib/request_log_analyzer/aggregator/echo.rb
86
+ - spec/unit/controller/log_processor_spec.rb
87
+ - lib/request_log_analyzer.rb
88
+ - Rakefile
89
+ - spec/spec_helper.rb
90
+ - spec/unit/filter/filter_spec.rb
91
+ - lib/request_log_analyzer/aggregator/summarizer.rb
92
+ - lib/request_log_analyzer/file_format/rails.rb
93
+ - spec/fixtures/test_language_combined.log
67
94
  - spec/fixtures/decompression.tar.gz
95
+ - spec/unit/filter/field_filter_spec.rb
96
+ - spec/spec.opts
97
+ - lib/request_log_analyzer/aggregator/database.rb
98
+ - lib/request_log_analyzer/filter/timespan.rb
99
+ - lib/request_log_analyzer/source/log_parser.rb
68
100
  - spec/fixtures/decompression.tgz
69
- - spec/fixtures/merb.log
101
+ - spec/unit/tracker/timespan_tracker_spec.rb
102
+ - spec/unit/tracker/hourly_spread_spec.rb
103
+ - spec/fixtures/header_and_footer.log
104
+ - lib/cli/tools.rb
105
+ - lib/request_log_analyzer/file_format/merb.rb
70
106
  - spec/fixtures/multiple_files_1.log
71
- - spec/fixtures/multiple_files_2.log
107
+ - spec/unit/file_format/merb_format_spec.rb
108
+ - spec/unit/file_format/line_definition_spec.rb
109
+ - lib/request_log_analyzer/source.rb
110
+ - lib/request_log_analyzer/request.rb
111
+ - spec/unit/controller/controller_spec.rb
112
+ - lib/request_log_analyzer/output.rb
113
+ - spec/lib/helpers.rb
72
114
  - spec/fixtures/rails_1x.log
73
- - spec/fixtures/rails_22.log
74
- - spec/fixtures/rails_22_cached.log
75
- - spec/fixtures/rails_unordered.log
76
- - spec/fixtures/syslog_1x.log
77
- - spec/fixtures/test_file_format.log
78
- - spec/fixtures/test_language_combined.log
79
- - spec/fixtures/test_order.log
80
- - spec/integration/command_line_usage_spec.rb
81
- - spec/lib/helper.rb
82
115
  - spec/lib/mocks.rb
83
- - spec/lib/testing_format.rb
84
- - spec/spec_helper.rb
85
- - spec/unit/aggregator/database_inserter_spec.rb
86
- - spec/unit/aggregator/summarizer_spec.rb
87
- - spec/unit/controller/controller_spec.rb
88
- - spec/unit/controller/log_processor_spec.rb
89
- - spec/unit/file_format/file_format_api_spec.rb
90
- - spec/unit/file_format/line_definition_spec.rb
91
- - spec/unit/file_format/merb_format_spec.rb
92
- - spec/unit/file_format/rails_format_spec.rb
93
- - spec/unit/filter/anonymize_filter_spec.rb
94
- - spec/unit/filter/field_filter_spec.rb
95
- - spec/unit/filter/timespan_filter_spec.rb
96
- - spec/unit/source/log_parser_spec.rb
116
+ - spec/fixtures/decompression.log.zip
97
117
  - spec/unit/source/request_spec.rb
98
- - spec/unit/tracker/duration_tracker_spec.rb
99
- - spec/unit/tracker/frequency_tracker_spec.rb
100
- - spec/unit/tracker/hourly_spread_spec.rb
101
- - spec/unit/tracker/timespan_tracker_spec.rb
102
- - spec/unit/tracker/tracker_api_spec.rb
118
+ - spec/unit/source/log_parser_spec.rb
119
+ - spec/fixtures/test_file_format.log
120
+ - lib/request_log_analyzer/source/database.rb
121
+ - spec/unit/aggregator/database_spec.rb
103
122
  - tasks/github-gem.rake
104
- - tasks/request_log_analyzer.rake
105
- - tasks/rspec.rake
123
+ - lib/request_log_analyzer/tracker/duration.rb
124
+ - lib/request_log_analyzer/file_format.rb
125
+ - spec/unit/aggregator/summarizer_spec.rb
126
+ - spec/fixtures/rails_22.log
127
+ - spec/fixtures/multiple_files_2.log
128
+ - spec/fixtures/syslog_1x.log
129
+ - LICENSE
130
+ - spec/unit/tracker/frequency_tracker_spec.rb
131
+ - spec/unit/file_format/rails_format_spec.rb
132
+ - lib/cli/command_line_arguments.rb
106
133
  has_rdoc: true
107
- homepage: http://github.com/wvanbergen/request-log-analyzer/wikis
134
+ homepage: http://railsdoctors.com
108
135
  licenses: []
109
136
 
110
137
  post_install_message:
@@ -129,30 +156,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
156
  - !ruby/object:Gem::Version
130
157
  version: "0"
131
158
  version:
132
- requirements: []
133
-
159
+ requirements:
160
+ - To use the database inserter, ActiveRecord and an appropriate database adapter are required.
134
161
  rubyforge_project: r-l-a
135
- rubygems_version: 1.3.2
162
+ rubygems_version: 1.3.4
136
163
  signing_key:
137
164
  specification_version: 3
138
- summary: A command line tool to analyze Rails logs
165
+ summary: A command line tool to analyze request logs for Rails, Merb and other application servers
139
166
  test_files:
167
+ - spec/unit/filter/anonymize_filter_spec.rb
168
+ - spec/unit/file_format/file_format_api_spec.rb
140
169
  - spec/integration/command_line_usage_spec.rb
141
- - spec/unit/aggregator/database_inserter_spec.rb
142
- - spec/unit/aggregator/summarizer_spec.rb
143
- - spec/unit/controller/controller_spec.rb
170
+ - spec/unit/filter/timespan_filter_spec.rb
171
+ - spec/unit/tracker/tracker_api_spec.rb
172
+ - spec/unit/tracker/duration_tracker_spec.rb
144
173
  - spec/unit/controller/log_processor_spec.rb
145
- - spec/unit/file_format/file_format_api_spec.rb
146
- - spec/unit/file_format/line_definition_spec.rb
147
- - spec/unit/file_format/merb_format_spec.rb
148
- - spec/unit/file_format/rails_format_spec.rb
149
- - spec/unit/filter/anonymize_filter_spec.rb
174
+ - spec/unit/filter/filter_spec.rb
150
175
  - spec/unit/filter/field_filter_spec.rb
151
- - spec/unit/filter/timespan_filter_spec.rb
152
- - spec/unit/source/log_parser_spec.rb
176
+ - spec/unit/tracker/timespan_tracker_spec.rb
177
+ - spec/unit/tracker/hourly_spread_spec.rb
178
+ - spec/unit/file_format/merb_format_spec.rb
179
+ - spec/unit/file_format/line_definition_spec.rb
180
+ - spec/unit/controller/controller_spec.rb
153
181
  - spec/unit/source/request_spec.rb
154
- - spec/unit/tracker/duration_tracker_spec.rb
182
+ - spec/unit/source/log_parser_spec.rb
183
+ - spec/unit/aggregator/database_spec.rb
184
+ - spec/unit/aggregator/summarizer_spec.rb
155
185
  - spec/unit/tracker/frequency_tracker_spec.rb
156
- - spec/unit/tracker/hourly_spread_spec.rb
157
- - spec/unit/tracker/timespan_tracker_spec.rb
158
- - spec/unit/tracker/tracker_api_spec.rb
186
+ - spec/unit/file_format/rails_format_spec.rb
data/RELEASE_NOTES.rdoc DELETED
@@ -1,10 +0,0 @@
1
- === 1.2.1
2
- * Compressed logfile support
3
- * Parsable YAML results as output (use --dump <filename> )
4
- * Full Rdoc
5
- * Release notes
6
- * Updated rails take tasks
7
-
8
- === 1.2.0
9
- * Ruby 1.9 support
10
- * Rcov coverage
@@ -1,106 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe RequestLogAnalyzer::Aggregator::Database, "schema creation" do
4
-
5
- include RequestLogAnalyzer::Spec::Helper
6
-
7
- before(:each) do
8
- log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
9
- @database_inserter = RequestLogAnalyzer::Aggregator::Database.new(log_parser, :database => ':memory:')
10
- end
11
-
12
-
13
- it "should create the correct tables" do
14
- ActiveRecord::Migration.should_receive(:create_table).with("warnings")
15
- ActiveRecord::Migration.should_receive(:create_table).with("requests")
16
- ActiveRecord::Migration.should_receive(:create_table).with("first_lines")
17
- ActiveRecord::Migration.should_receive(:create_table).with("test_lines")
18
- ActiveRecord::Migration.should_receive(:create_table).with("eval_lines")
19
- ActiveRecord::Migration.should_receive(:create_table).with("last_lines")
20
-
21
- ActiveRecord::Migration.should_receive(:add_index).with("eval_lines", [:request_id])
22
- ActiveRecord::Migration.should_receive(:add_index).with("first_lines", [:request_id])
23
- ActiveRecord::Migration.should_receive(:add_index).with("test_lines", [:request_id])
24
- ActiveRecord::Migration.should_receive(:add_index).with("last_lines", [:request_id])
25
-
26
- @database_inserter.prepare
27
- end
28
-
29
- it "should create a default Request class" do
30
- @database_inserter.prepare
31
- TestingFormat::Database::Request.ancestors.should include(ActiveRecord::Base)
32
- TestingFormat::Database::Request.column_names.should include('first_lineno')
33
- TestingFormat::Database::Request.column_names.should include('last_lineno')
34
- end
35
-
36
- it "should create associations for the default Request class" do
37
- @database_inserter.prepare
38
- @request = TestingFormat::Database::Request.new
39
- @request.should respond_to(:test_lines)
40
- @request.test_lines.should
41
- end
42
-
43
- it "should create the default table names" do
44
- @database_inserter.prepare
45
- @database_inserter.file_format.line_definitions.each do |name, definition|
46
- klass = TestingFormat::Database.const_get("#{name}_line".camelize)
47
- klass.column_names.should include('id')
48
- klass.column_names.should include('lineno')
49
- klass.column_names.should include('request_id')
50
- end
51
- end
52
-
53
- it "should create the correct fields in the table" do
54
- @database_inserter.prepare
55
-
56
- TestingFormat::Database::FirstLine.column_names.should include('request_no')
57
- TestingFormat::Database::LastLine.column_names.should include('request_no')
58
- TestingFormat::Database::TestLine.column_names.should include('test_capture')
59
- end
60
-
61
- it "should create fields for provides" do
62
- @database_inserter.prepare
63
- TestingFormat::Database::EvalLine.column_names.should include('evaluated')
64
- TestingFormat::Database::EvalLine.column_names.should include('greating')
65
- TestingFormat::Database::EvalLine.column_names.should include('what')
66
- end
67
-
68
- end
69
-
70
- describe RequestLogAnalyzer::Aggregator::Database, "record insertion" do
71
- include RequestLogAnalyzer::Spec::Helper
72
-
73
- before(:each) do
74
- log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
75
- @database_inserter = RequestLogAnalyzer::Aggregator::Database.new(log_parser, :database => ':memory:')
76
- @database_inserter.prepare
77
-
78
- @incomplete_request = testing_format.request( {:line_type => :first, :request_no => 564})
79
- @completed_request = testing_format.request( {:line_type => :first, :request_no => 564},
80
- {:line_type => :test, :test_capture => "awesome"},
81
- {:line_type => :test, :test_capture => "indeed"},
82
- {:line_type => :eval, :evaluated => { :greating => 'howdy'}, :greating => 'howdy' },
83
- {:line_type => :last, :request_no => 564})
84
- end
85
-
86
- it "should insert a record in the request table" do
87
- TestingFormat::Database::Request.count.should == 0
88
- @database_inserter.aggregate(@incomplete_request)
89
- TestingFormat::Database::Request.count.should == 1
90
- end
91
-
92
- it "should insert records in all relevant line tables" do
93
- @database_inserter.aggregate(@completed_request)
94
- request = TestingFormat::Database::Request.first
95
- request.should have(2).test_lines
96
- request.should have(1).first_lines
97
- request.should have(1).eval_lines
98
- request.should have(1).last_lines
99
- end
100
-
101
- it "should log a warning in the warnings table" do
102
- TestingFormat::Database::Warning.should_receive(:create!).with(hash_including(:warning_type => 'test_warning'))
103
- @database_inserter.warning(:test_warning, "Testing the warning system", 12)
104
- end
105
-
106
- end
data/tasks/rspec.rake DELETED
@@ -1,12 +0,0 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
3
-
4
- namespace :spec do
5
- desc "Run all rspec with RCov"
6
- Spec::Rake::SpecTask.new(:rcov) do |t|
7
-
8
- t.spec_files = FileList['spec/**/*_spec.rb']
9
- t.rcov = true
10
- t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
11
- end
12
- end