request-log-analyzer 1.11.0 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ script: bundle exec rake
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.1
5
+ - 1.9.2
6
+ - ruby-head
7
+ - ree
8
+ - rbx
9
+ - rbx-2.0
10
+ - jruby
data/README.rdoc CHANGED
@@ -28,11 +28,12 @@ For more details, other file formats, and available command line options, see th
28
28
 
29
29
  $ time ./bin/request-log-analyzer 40MBRailsFile.log
30
30
 
31
- ruby-1.9.2-p0 15.19s user 0.95s system 99% cpu 16.143 total
32
- ruby-1.8.7 25.21s user 1.02s system 99% cpu 26.238 total
33
- jruby-1.5.3 32.64s user 4.84s system 99% cpu 37.629 total
34
- rbx 46.60s user 2.71s system 108% cpu 45.324 total
35
- macruby 75.00s user 20.10s system 110% cpu 1:26.13 total
31
+ ruby-1.9.2-p180 15.19s user 0.95s system 99% cpu 16.143 total
32
+ ree-1.8.7-2011.03 22.81s user 1.28s system 92% cpu 25.938 total
33
+ ruby-1.8.7-p334 25.21s user 1.02s system 99% cpu 26.238 total
34
+ jruby-1.5.3 32.64s user 4.84s system 99% cpu 37.629 total
35
+ rbx-2.0.0pre 39.62s user 2.24s system 104% cpu 40.098 total
36
+ macruby 75.00s user 20.10s system 110% cpu 1:26.13 total
36
37
 
37
38
  == Additional information
38
39
 
@@ -21,7 +21,7 @@ begin
21
21
 
22
22
  command_line.command(:strip) do |strip|
23
23
  strip.minimum_parameters = 1
24
- strip.option(:format, :alias => :f, :default => 'rails')
24
+ strip.option(:format, :alias => :f, :default => 'rails3')
25
25
  strip.option(:output, :alias => :o)
26
26
  strip.switch(:discard_teaser_lines, :t)
27
27
  strip.switch(:keep_junk_lines, :j)
@@ -34,7 +34,7 @@ begin
34
34
  command_line.option(:file, :alias => :e)
35
35
  command_line.option(:mail, :alias => :m)
36
36
  command_line.option(:mailhost, :default => 'localhost')
37
- command_line.option(:mailsubject)
37
+ command_line.option(:mailsubject)
38
38
  command_line.option(:parse_strategy, :default => 'assume-correct')
39
39
  command_line.option(:yaml)
40
40
  command_line.option(:dump) # To be deprecated
@@ -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.0"
16
+ VERSION = "1.11.1"
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
@@ -77,7 +77,7 @@ module RequestLogAnalyzer
77
77
 
78
78
  # Guess file format
79
79
  if !options[:format] && options[:source_files]
80
- options[:format] = :rails # Default
80
+ options[:format] = :rails3 # Default
81
81
 
82
82
  if options[:source_files] != $stdin
83
83
  if options[:source_files].class == String
@@ -30,11 +30,11 @@ module RequestLogAnalyzer::Filter
30
30
  # Returns nil otherwise
31
31
  # <tt>request</tt> Request object.
32
32
  def filter(request)
33
- if @after && @before && request.timestamp <= @before && @after <= request.timestamp
33
+ if @after && @before && request.timestamp && request.timestamp <= @before && @after <= request.timestamp
34
34
  return request
35
- elsif @after && @before.nil? && @after <= request.timestamp
35
+ elsif @after && @before.nil? && request.timestamp && @after <= request.timestamp
36
36
  return request
37
- elsif @before && @after.nil? && request.timestamp <= @before
37
+ elsif @before && @after.nil? && request.timestamp && request.timestamp <= @before
38
38
  return request
39
39
  end
40
40
 
@@ -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.0"
6
- s.date = "2011-04-27"
5
+ s.version = "1.11.1"
6
+ s.date = "2011-08-20"
7
7
 
8
8
  s.rubyforge_project = 'r-l-a'
9
9
 
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency('rspec', '~> 2.0')
32
32
 
33
33
  s.add_development_dependency('activerecord')
34
- s.add_development_dependency('sqlite3-ruby')
34
+ s.add_development_dependency('sqlite3')
35
35
 
36
36
  s.authors = ['Willem van Bergen', 'Bart ten Brinke']
37
37
  s.email = ['willem@railsdoctors.com', 'bart@railsdoctors.com']
@@ -39,6 +39,6 @@ Gem::Specification.new do |s|
39
39
 
40
40
  # The files and test_files directives are set automatically by the release script.
41
41
  # Do not change them by hand, but make sure to add the files to the git repository.
42
- s.files = %w(.gitignore .infinity_test DESIGN.rdoc Gemfile LICENSE README.rdoc Rakefile bin/request-log-analyzer lib/cli/command_line_arguments.rb lib/cli/database_console.rb lib/cli/database_console_init.rb lib/cli/progressbar.rb lib/cli/tools.rb lib/request_log_analyzer.rb lib/request_log_analyzer/aggregator.rb lib/request_log_analyzer/aggregator/database_inserter.rb lib/request_log_analyzer/aggregator/echo.rb lib/request_log_analyzer/aggregator/summarizer.rb lib/request_log_analyzer/controller.rb lib/request_log_analyzer/database.rb lib/request_log_analyzer/database/base.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/database/request.rb lib/request_log_analyzer/database/source.rb lib/request_log_analyzer/database/warning.rb lib/request_log_analyzer/file_format.rb lib/request_log_analyzer/file_format/amazon_s3.rb lib/request_log_analyzer/file_format/apache.rb lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/file_format/delayed_job2.rb lib/request_log_analyzer/file_format/delayed_job21.rb lib/request_log_analyzer/file_format/haproxy.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/file_format/mysql.rb lib/request_log_analyzer/file_format/oink.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/file_format/rack.rb lib/request_log_analyzer/file_format/rails.rb lib/request_log_analyzer/file_format/rails3.rb lib/request_log_analyzer/file_format/rails_development.rb lib/request_log_analyzer/file_format/w3c.rb lib/request_log_analyzer/filter.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/filter/timespan.rb lib/request_log_analyzer/line_definition.rb lib/request_log_analyzer/log_processor.rb lib/request_log_analyzer/mailer.rb lib/request_log_analyzer/output.rb lib/request_log_analyzer/output/fixed_width.rb lib/request_log_analyzer/output/html.rb lib/request_log_analyzer/request.rb lib/request_log_analyzer/source.rb lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/tracker.rb lib/request_log_analyzer/tracker/duration.rb lib/request_log_analyzer/tracker/frequency.rb lib/request_log_analyzer/tracker/hourly_spread.rb lib/request_log_analyzer/tracker/numeric_value.rb lib/request_log_analyzer/tracker/timespan.rb lib/request_log_analyzer/tracker/traffic.rb request-log-analyzer.gemspec spec/database.yml spec/fixtures/apache_combined.log spec/fixtures/apache_common.log spec/fixtures/decompression.log spec/fixtures/decompression.log.bz2 spec/fixtures/decompression.log.gz spec/fixtures/decompression.log.zip spec/fixtures/decompression.tar.gz spec/fixtures/decompression.tgz spec/fixtures/header_and_footer.log spec/fixtures/merb.log spec/fixtures/merb_prefixed.log spec/fixtures/multiple_files_1.log spec/fixtures/multiple_files_2.log spec/fixtures/mysql_slow_query.log spec/fixtures/oink_22.log spec/fixtures/oink_22_failure.log spec/fixtures/postgresql.log spec/fixtures/rails.db spec/fixtures/rails_1x.log spec/fixtures/rails_22.log spec/fixtures/rails_22_cached.log spec/fixtures/rails_unordered.log spec/fixtures/sinatra.log spec/fixtures/syslog_1x.log spec/fixtures/test_file_format.log spec/fixtures/test_language_combined.log spec/fixtures/test_order.log spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/lib/helpers.rb spec/lib/macros.rb spec/lib/matchers.rb spec/lib/mocks.rb spec/lib/testing_format.rb spec/spec_helper.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb tasks/github-gem.rake tasks/request_log_analyzer.rake)
42
+ s.files = %w(.gitignore .infinity_test .travis.yml DESIGN.rdoc Gemfile LICENSE README.rdoc Rakefile bin/request-log-analyzer lib/cli/command_line_arguments.rb lib/cli/database_console.rb lib/cli/database_console_init.rb lib/cli/progressbar.rb lib/cli/tools.rb lib/request_log_analyzer.rb lib/request_log_analyzer/aggregator.rb lib/request_log_analyzer/aggregator/database_inserter.rb lib/request_log_analyzer/aggregator/echo.rb lib/request_log_analyzer/aggregator/summarizer.rb lib/request_log_analyzer/controller.rb lib/request_log_analyzer/database.rb lib/request_log_analyzer/database/base.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/database/request.rb lib/request_log_analyzer/database/source.rb lib/request_log_analyzer/database/warning.rb lib/request_log_analyzer/file_format.rb lib/request_log_analyzer/file_format/amazon_s3.rb lib/request_log_analyzer/file_format/apache.rb lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/file_format/delayed_job2.rb lib/request_log_analyzer/file_format/delayed_job21.rb lib/request_log_analyzer/file_format/haproxy.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/file_format/mysql.rb lib/request_log_analyzer/file_format/oink.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/file_format/rack.rb lib/request_log_analyzer/file_format/rails.rb lib/request_log_analyzer/file_format/rails3.rb lib/request_log_analyzer/file_format/rails_development.rb lib/request_log_analyzer/file_format/w3c.rb lib/request_log_analyzer/filter.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/filter/timespan.rb lib/request_log_analyzer/line_definition.rb lib/request_log_analyzer/log_processor.rb lib/request_log_analyzer/mailer.rb lib/request_log_analyzer/output.rb lib/request_log_analyzer/output/fixed_width.rb lib/request_log_analyzer/output/html.rb lib/request_log_analyzer/request.rb lib/request_log_analyzer/source.rb lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/tracker.rb lib/request_log_analyzer/tracker/duration.rb lib/request_log_analyzer/tracker/frequency.rb lib/request_log_analyzer/tracker/hourly_spread.rb lib/request_log_analyzer/tracker/numeric_value.rb lib/request_log_analyzer/tracker/timespan.rb lib/request_log_analyzer/tracker/traffic.rb request-log-analyzer.gemspec spec/database.yml spec/fixtures/apache_combined.log spec/fixtures/apache_common.log spec/fixtures/decompression.log spec/fixtures/decompression.log.bz2 spec/fixtures/decompression.log.gz spec/fixtures/decompression.log.zip spec/fixtures/decompression.tar.gz spec/fixtures/decompression.tgz spec/fixtures/header_and_footer.log spec/fixtures/merb.log spec/fixtures/merb_prefixed.log spec/fixtures/multiple_files_1.log spec/fixtures/multiple_files_2.log spec/fixtures/mysql_slow_query.log spec/fixtures/oink_22.log spec/fixtures/oink_22_failure.log spec/fixtures/postgresql.log spec/fixtures/rails.db spec/fixtures/rails_1x.log spec/fixtures/rails_22.log spec/fixtures/rails_22_cached.log spec/fixtures/rails_unordered.log spec/fixtures/sinatra.log spec/fixtures/syslog_1x.log spec/fixtures/test_file_format.log spec/fixtures/test_language_combined.log spec/fixtures/test_order.log spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/lib/helpers.rb spec/lib/macros.rb spec/lib/matchers.rb spec/lib/mocks.rb spec/lib/testing_format.rb spec/spec_helper.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb tasks/github-gem.rake tasks/request_log_analyzer.rake)
43
43
  s.test_files = %w(spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb)
44
44
  end
@@ -14,7 +14,7 @@ describe RequestLogAnalyzer, 'running from command line' do
14
14
  output = run("#{log_fixture(:rails_1x)}")
15
15
  output.any? { |line| /^Parsed requests\:\s*4\s/ =~ line }.should be_true
16
16
  end
17
-
17
+
18
18
  it "should find 2 requests when parsing a compressed file" do
19
19
  output = run("#{log_fixture(:decompression, :tgz)}")
20
20
  output.any? { |line| /^Parsed requests\:\s*2\s/ =~ line }.should be_true
@@ -58,7 +58,7 @@ describe RequestLogAnalyzer, 'running from command line' do
58
58
  end
59
59
 
60
60
  it "should use no colors in the report with the --boring option" do
61
- output = run("#{log_fixture(:rails_1x)} --boring")
61
+ output = run("#{log_fixture(:rails_1x)} --boring --format rails")
62
62
  output.any? { |line| /\e/ =~ line }.should be_false
63
63
  end
64
64
 
@@ -84,7 +84,7 @@ describe RequestLogAnalyzer, 'running from command line' do
84
84
  end
85
85
 
86
86
  it "should parse 4 requests from the standard input" do
87
- output = run("- < #{log_fixture(:rails_1x)}")
87
+ output = run("--format rails - < #{log_fixture(:rails_1x)}")
88
88
  output.any? { |line| /^Parsed requests\:\s*4\s/ =~ line }.should be_true
89
89
  end
90
90
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'request_log_analyzer/database'
2
3
 
3
4
  describe RequestLogAnalyzer::Database do
4
5
 
@@ -24,18 +24,18 @@ describe RequestLogAnalyzer::FileFormat::Postgresql do
24
24
  end
25
25
  end
26
26
 
27
- describe '#parse_io' do
28
- it "should parse a multiline query entry correctly" do
29
- fixture = <<-EOS
30
- 2010-10-10 15:00:02 GMT [38747]: [1669-1] LOG: 00000: duration: 0.195 ms statement: INSERT INTO "delayed_jobs" ("failed_at", "locked_by", "created_at", "handler", "updated_at", "priority", "run_at", "attempts", "locked_at", "last_error") VALUES(NULL, NULL, '2010-10-10 15:00:02.159884', E'--- !ruby/object:RuntheChooChootrain {}
31
- ', '2010-10-10 15:00:02.159884', 0, '2010-10-10 16:00:00.000000', 0, NULL, NULL) RETURNING "id"
32
- 2010-10-10 15:00:02 GMT [38747]: [1670-1] LOCATION: exec_simple_query, postgres.c:1081
33
- EOS
34
-
35
- log_parser.should_not_receive(:warn)
36
- log_parser.parse_string(fixture) do |request|
37
- request[:query].should == 'INSERT INTO delayed_jobs (failed_at, locked_by, created_at, handler, updated_at, priority, run_at, attempts, locked_at, last_error) VALUES(NULL, NULL, :string, E:string, :string, :int, :string, :int, NULL, NULL) RETURNING id'
38
- end
39
- end
40
- end
27
+ # describe '#parse_io' do
28
+ # it "should parse a multiline query entry correctly" do
29
+ # fixture = <<-EOS
30
+ # 2010-10-10 15:00:02 GMT [38747]: [1669-1] LOG: 00000: duration: 0.195 ms statement: INSERT INTO "delayed_jobs" ("failed_at", "locked_by", "created_at", "handler", "updated_at", "priority", "run_at", "attempts", "locked_at", "last_error") VALUES(NULL, NULL, '2010-10-10 15:00:02.159884', E'--- !ruby/object:RuntheChooChootrain {}
31
+ # ', '2010-10-10 15:00:02.159884', 0, '2010-10-10 16:00:00.000000', 0, NULL, NULL) RETURNING "id"
32
+ # 2010-10-10 15:00:02 GMT [38747]: [1670-1] LOCATION: exec_simple_query, postgres.c:1081
33
+ # EOS
34
+ #
35
+ # log_parser.should_not_receive(:warn)
36
+ # log_parser.parse_string(fixture) do |request|
37
+ # request[:query].should == 'INSERT INTO delayed_jobs (failed_at, locked_by, created_at, handler, updated_at, priority, run_at, attempts, locked_at, last_error) VALUES(NULL, NULL, :string, E:string, :string, :int, :string, :int, NULL, NULL) RETURNING id'
38
+ # end
39
+ # end
40
+ # end
41
41
  end
@@ -1,119 +1,125 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RequestLogAnalyzer::Source::LogParser, :requests do
4
-
5
- before(:each) do
6
- @log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
7
- end
8
-
9
- it "should have multiple line definitions" do
10
- @log_parser.file_format.line_definitions.length.should >= 2
11
- end
12
-
13
- it "should have a valid language" do
14
- @log_parser.file_format.should be_well_formed
15
- end
16
-
17
- it "should set the :source for every parsed line" do
18
- @log_parser.parse_file(log_fixture(:rails_22)) do |request|
19
- request.lines.all? { |line| line[:source] == log_fixture(:rails_22) }.should be_true
3
+ describe RequestLogAnalyzer::Source::LogParser do
4
+ describe 'parsing request' do
5
+ before(:each) do
6
+ @log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
20
7
  end
21
- end
22
8
 
23
- it "should set the :lineno for every parsed line" do
24
- @log_parser.parse_file(log_fixture(:rails_22)) do |request|
25
- request.lines.all? { |line| line.has_key?(:lineno) }.should be_true
9
+ it "should have multiple line definitions" do
10
+ @log_parser.file_format.line_definitions.length.should >= 2
26
11
  end
27
- end
28
12
 
29
- it "should parse more lines than requests" do
30
- @log_parser.should_receive(:handle_request).with(an_instance_of(TestingFormat::Request)).twice
31
- @log_parser.parse_file(log_fixture(:test_language_combined))
32
- @log_parser.parsed_lines.should > 2
33
- end
13
+ it "should have a valid language" do
14
+ @log_parser.file_format.should be_well_formed
15
+ end
34
16
 
35
- it "should parse requests spanned over multiple files" do
36
- @log_parser.should_receive(:handle_request).with(an_instance_of(TestingFormat::Request)).once
37
- @log_parser.parse_files([log_fixture(:multiple_files_1), log_fixture(:multiple_files_2)])
38
- end
17
+ it "should set the :source for every parsed line" do
18
+ @log_parser.parse_file(log_fixture(:rails_22)) do |request|
19
+ request.lines.all? { |line| line[:source] == log_fixture(:rails_22) }.should be_true
20
+ end
21
+ end
39
22
 
40
- it "should parse all request values when spanned over multiple files" do
41
- @log_parser.parse_files([log_fixture(:multiple_files_1), log_fixture(:multiple_files_2)]) do |request|
42
- request.lines.should have(4).items
43
- request[:request_no].should == 1
44
- request[:test_capture].should == "Testing is amazing" # Note the custom converter
23
+ it "should set the :lineno for every parsed line" do
24
+ @log_parser.parse_file(log_fixture(:rails_22)) do |request|
25
+ request.lines.all? { |line| line.has_key?(:lineno) }.should be_true
26
+ end
45
27
  end
46
- end
47
28
 
48
- it "should parse a stream and find valid requests" do
49
- io = File.new(log_fixture(:test_file_format), 'rb')
50
- @log_parser.parse_io(io) do |request|
51
- request.should be_kind_of(RequestLogAnalyzer::Request)
52
- request.should =~ :test
53
- request[:test_capture].should_not be_nil
29
+ it "should parse more lines than requests" do
30
+ @log_parser.should_receive(:handle_request).with(an_instance_of(TestingFormat::Request)).twice
31
+ @log_parser.parse_file(log_fixture(:test_language_combined))
32
+ @log_parser.parsed_lines.should > 2
54
33
  end
55
- io.close
56
- end
57
34
 
58
- it "should parse a request that only consists of one line" do
59
- @log_parser.parse_file(log_fixture(:header_and_footer))
60
- @log_parser.parsed_requests.should == 2
61
- end
62
- end
35
+ it "should parse requests spanned over multiple files" do
36
+ @log_parser.should_receive(:handle_request).with(an_instance_of(TestingFormat::Request)).once
37
+ @log_parser.parse_files([log_fixture(:multiple_files_1), log_fixture(:multiple_files_2)])
38
+ end
63
39
 
64
- describe RequestLogAnalyzer::Source::LogParser, :warnings do
40
+ it "should parse all request values when spanned over multiple files" do
41
+ @log_parser.parse_files([log_fixture(:multiple_files_1), log_fixture(:multiple_files_2)]) do |request|
42
+ request.lines.should have(4).items
43
+ request[:request_no].should == 1
44
+ request[:test_capture].should == "Testing is amazing" # Note the custom converter
45
+ end
46
+ end
65
47
 
66
- before(:each) do
67
- @log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format, :parse_strategy => 'cautious')
68
- end
48
+ it "should parse a stream and find valid requests" do
49
+ io = File.new(log_fixture(:test_file_format), 'rb')
50
+ @log_parser.parse_io(io) do |request|
51
+ request.should be_kind_of(RequestLogAnalyzer::Request)
52
+ request.should =~ :test
53
+ request[:test_capture].should_not be_nil
54
+ end
55
+ io.close
56
+ end
69
57
 
70
- it "should warn about teaser matching problems" do
71
- @log_parser.should_receive(:warn).with(:teaser_check_failed, anything).exactly(5).times
72
- @log_parser.parse_file(log_fixture(:test_file_format))
58
+ it "should parse a request that only consists of one line" do
59
+ @log_parser.parse_file(log_fixture(:header_and_footer))
60
+ @log_parser.parsed_requests.should == 2
61
+ end
73
62
  end
74
63
 
75
- it "should warn about unmatching request headers and footers" do
76
- @log_parser.should_receive(:warn).with(:unclosed_request, anything).at_least(1).times
77
- @log_parser.should_receive(:warn).with(:no_current_request, anything).at_least(1).times
78
- @log_parser.should_not_receive(:handle_request)
79
- @log_parser.parse_file(log_fixture(:test_order))
80
- end
81
- end
64
+ describe 'parse warnings' do
82
65
 
83
- describe RequestLogAnalyzer::Source::LogParser, :decompression do
66
+ before(:each) do
67
+ @log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format, :parse_strategy => 'cautious')
68
+ end
84
69
 
85
- before(:each) do
86
- @log_parser = RequestLogAnalyzer::Source::LogParser.new(RequestLogAnalyzer::FileFormat::Rails.create)
87
- end
70
+ it "should warn about teaser matching problems" do
71
+ @log_parser.should_receive(:warn).with(:teaser_check_failed, anything).exactly(5).times
72
+ @log_parser.parse_file(log_fixture(:test_file_format))
73
+ end
88
74
 
89
- it "should parse a rails gzipped log file" do
90
- @log_parser.should_receive(:handle_request).once
91
- @log_parser.parse_file(log_fixture(:decompression, "log.gz"))
92
- @log_parser.parsed_lines.should > 0
75
+ it "should warn about unmatching request headers and footers" do
76
+ @log_parser.should_receive(:warn).with(:unclosed_request, anything).at_least(1).times
77
+ @log_parser.should_receive(:warn).with(:no_current_request, anything).at_least(1).times
78
+ @log_parser.should_not_receive(:handle_request)
79
+ @log_parser.parse_file(log_fixture(:test_order))
80
+ end
93
81
  end
94
82
 
95
- it "should parse a rails tar gzipped log folder" do
96
- @log_parser.should_receive(:handle_request).twice
97
- @log_parser.parse_file(log_fixture(:decompression, "tar.gz"))
98
- @log_parser.parsed_lines.should > 1
99
- end
83
+ describe 'log file decompression' do
100
84
 
101
- it "should parse a rails tar gzipped log folder" do
102
- @log_parser.should_receive(:handle_request).twice
103
- @log_parser.parse_file(log_fixture(:decompression, "tgz"))
104
- @log_parser.parsed_lines.should > 1
105
- end
85
+ before(:each) do
86
+ @log_parser = RequestLogAnalyzer::Source::LogParser.new(RequestLogAnalyzer::FileFormat::Rails.create)
87
+ end
106
88
 
107
- it "should parse a rails bz2 zipped log file" do
108
- @log_parser.should_receive(:handle_request).once
109
- @log_parser.parse_file(log_fixture(:decompression, "log.bz2"))
110
- @log_parser.parsed_lines.should > 0
111
- end
89
+ if `which gunzip` != ""
90
+ it "should parse a rails gzipped log file" do
91
+ @log_parser.should_receive(:handle_request).once
92
+ @log_parser.parse_file(log_fixture(:decompression, "log.gz"))
93
+ @log_parser.parsed_lines.should > 0
94
+ end
95
+
96
+ it "should parse a rails tar gzipped log folder" do
97
+ @log_parser.should_receive(:handle_request).twice
98
+ @log_parser.parse_file(log_fixture(:decompression, "tar.gz"))
99
+ @log_parser.parsed_lines.should > 1
100
+ end
101
+ end
112
102
 
113
- it "should parse a rails zipped log file" do
114
- @log_parser.should_receive(:handle_request).once
115
- @log_parser.parse_file(log_fixture(:decompression, "log.zip"))
116
- @log_parser.parsed_lines.should > 0
103
+ if `which bunzip2` != ""
104
+ it "should parse a rails tar gzipped log folder" do
105
+ @log_parser.should_receive(:handle_request).twice
106
+ @log_parser.parse_file(log_fixture(:decompression, "tgz"))
107
+ @log_parser.parsed_lines.should > 1
108
+ end
109
+
110
+ it "should parse a rails bz2 zipped log file" do
111
+ @log_parser.should_receive(:handle_request).once
112
+ @log_parser.parse_file(log_fixture(:decompression, "log.bz2"))
113
+ @log_parser.parsed_lines.should > 0
114
+ end
115
+ end
116
+
117
+ if `which unzip` != ""
118
+ it "should parse a rails zipped log file" do
119
+ @log_parser.should_receive(:handle_request).once
120
+ @log_parser.parse_file(log_fixture(:decompression, "log.zip"))
121
+ @log_parser.parsed_lines.should > 0
122
+ end
123
+ end
117
124
  end
118
-
119
125
  end
@@ -13,8 +13,8 @@ module GithubGem
13
13
 
14
14
  # Detects the main include file of this project using heuristics
15
15
  def self.detect_main_include
16
- if detect_gemspec_file =~ /^(\.*)\.gemspec$/ && File.exist?("lib/#{$1}.rb")
17
- "lib/#{$1}.rb"
16
+ if File.exist?(File.expand_path("../lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb", detect_gemspec_file))
17
+ "lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb"
18
18
  elsif FileList['lib/*.rb'].length == 1
19
19
  FileList['lib/*.rb'].first
20
20
  else
@@ -24,6 +24,8 @@ module GithubGem
24
24
 
25
25
  class RakeTasks
26
26
 
27
+ include Rake::DSL if Rake.const_defined?('DSL')
28
+
27
29
  attr_reader :gemspec, :modified_files
28
30
  attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
29
31
 
@@ -342,7 +344,7 @@ module GithubGem
342
344
  require 'net/https'
343
345
  require 'uri'
344
346
 
345
- uri = URI.parse('https://github.com/wvanbergen/github-gem/raw/master/tasks/github-gem.rake')
347
+ uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')
346
348
  http = Net::HTTP.new(uri.host, uri.port)
347
349
  http.use_ssl = true
348
350
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -362,4 +364,4 @@ module GithubGem
362
364
  end
363
365
  end
364
366
  end
365
- end
367
+ end
metadata CHANGED
@@ -1,89 +1,84 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 11
8
- - 0
9
- version: 1.11.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.11.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Willem van Bergen
13
9
  - Bart ten Brinke
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2011-04-27 00:00:00 -04:00
13
+ date: 2011-08-20 00:00:00.000000000 -04:00
19
14
  default_executable: request-log-analyzer
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
22
17
  name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &2153310460 !ruby/object:Gem::Requirement
25
19
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
- version: "0"
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
32
24
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
25
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: *2153310460
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: &2153309700 !ruby/object:Gem::Requirement
38
30
  none: false
39
- requirements:
31
+ requirements:
40
32
  - - ~>
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 2
44
- - 0
45
- version: "2.0"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.0'
46
35
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: activerecord
50
36
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ version_requirements: *2153309700
38
+ - !ruby/object:Gem::Dependency
39
+ name: activerecord
40
+ requirement: &2153309000 !ruby/object:Gem::Requirement
52
41
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
59
46
  type: :development
60
- version_requirements: *id003
61
- - !ruby/object:Gem::Dependency
62
- name: sqlite3-ruby
63
47
  prerelease: false
64
- requirement: &id004 !ruby/object:Gem::Requirement
48
+ version_requirements: *2153309000
49
+ - !ruby/object:Gem::Dependency
50
+ name: sqlite3
51
+ requirement: &2153308320 !ruby/object:Gem::Requirement
65
52
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
- version: "0"
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
72
57
  type: :development
73
- version_requirements: *id004
74
- 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"
75
- email:
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:
76
71
  - willem@railsdoctors.com
77
72
  - bart@railsdoctors.com
78
- executables:
73
+ executables:
79
74
  - request-log-analyzer
80
75
  extensions: []
81
-
82
- extra_rdoc_files:
76
+ extra_rdoc_files:
83
77
  - README.rdoc
84
- files:
78
+ files:
85
79
  - .gitignore
86
80
  - .infinity_test
81
+ - .travis.yml
87
82
  - DESIGN.rdoc
88
83
  - Gemfile
89
84
  - LICENSE
@@ -226,41 +221,38 @@ files:
226
221
  has_rdoc: true
227
222
  homepage: http://railsdoctors.com
228
223
  licenses: []
229
-
230
224
  post_install_message:
231
- rdoc_options:
225
+ rdoc_options:
232
226
  - --title
233
227
  - request-log-analyzer
234
228
  - --main
235
229
  - README.rdoc
236
230
  - --line-numbers
237
231
  - --inline-source
238
- require_paths:
232
+ require_paths:
239
233
  - lib
240
- required_ruby_version: !ruby/object:Gem::Requirement
234
+ required_ruby_version: !ruby/object:Gem::Requirement
241
235
  none: false
242
- requirements:
243
- - - ">="
244
- - !ruby/object:Gem::Version
245
- segments:
246
- - 0
247
- version: "0"
248
- required_rubygems_version: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - ! '>='
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
240
+ required_rubygems_version: !ruby/object:Gem::Requirement
249
241
  none: false
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- segments:
254
- - 0
255
- version: "0"
256
- requirements:
257
- - To use the database inserter, ActiveRecord and an appropriate database adapter are required.
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.
258
249
  rubyforge_project: r-l-a
259
- rubygems_version: 1.3.7
250
+ rubygems_version: 1.6.2
260
251
  signing_key:
261
252
  specification_version: 3
262
- summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
263
- test_files:
253
+ summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL
254
+ and other web application servers
255
+ test_files:
264
256
  - spec/integration/command_line_usage_spec.rb
265
257
  - spec/integration/mailer_spec.rb
266
258
  - spec/integration/munin_plugins_rails_spec.rb