request-log-analyzer 1.0.2 → 1.6.3

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 (144) hide show
  1. data/.gitignore +10 -0
  2. data/DESIGN.rdoc +41 -0
  3. data/LICENSE +4 -4
  4. data/README.rdoc +38 -0
  5. data/Rakefile +6 -3
  6. data/bin/request-log-analyzer +70 -72
  7. data/lib/cli/command_line_arguments.rb +53 -53
  8. data/lib/cli/database_console.rb +26 -0
  9. data/lib/cli/database_console_init.rb +43 -0
  10. data/lib/cli/progressbar.rb +166 -189
  11. data/lib/cli/tools.rb +49 -0
  12. data/lib/request_log_analyzer/aggregator/database_inserter.rb +83 -0
  13. data/lib/request_log_analyzer/aggregator/echo.rb +17 -12
  14. data/lib/request_log_analyzer/aggregator/summarizer.rb +101 -63
  15. data/lib/request_log_analyzer/{aggregator/base.rb → aggregator.rb} +17 -13
  16. data/lib/request_log_analyzer/controller.rb +251 -98
  17. data/lib/request_log_analyzer/database/base.rb +114 -0
  18. data/lib/request_log_analyzer/database/connection.rb +38 -0
  19. data/lib/request_log_analyzer/database/request.rb +22 -0
  20. data/lib/request_log_analyzer/database/source.rb +13 -0
  21. data/lib/request_log_analyzer/database/warning.rb +14 -0
  22. data/lib/request_log_analyzer/database.rb +102 -0
  23. data/lib/request_log_analyzer/file_format/amazon_s3.rb +74 -0
  24. data/lib/request_log_analyzer/file_format/apache.rb +147 -0
  25. data/lib/request_log_analyzer/file_format/delayed_job.rb +55 -0
  26. data/lib/request_log_analyzer/file_format/merb.rb +65 -29
  27. data/lib/request_log_analyzer/file_format/mysql.rb +101 -0
  28. data/lib/request_log_analyzer/file_format/postgresql.rb +68 -0
  29. data/lib/request_log_analyzer/file_format/rack.rb +9 -0
  30. data/lib/request_log_analyzer/file_format/rails.rb +164 -78
  31. data/lib/request_log_analyzer/file_format/rails3.rb +86 -0
  32. data/lib/request_log_analyzer/file_format/rails_development.rb +12 -0
  33. data/lib/request_log_analyzer/file_format.rb +252 -58
  34. data/lib/request_log_analyzer/filter/anonymize.rb +39 -0
  35. data/lib/request_log_analyzer/filter/field.rb +19 -13
  36. data/lib/request_log_analyzer/filter/timespan.rb +25 -12
  37. data/lib/request_log_analyzer/filter.rb +30 -0
  38. data/lib/request_log_analyzer/line_definition.rb +69 -96
  39. data/lib/request_log_analyzer/log_processor.rb +31 -53
  40. data/lib/request_log_analyzer/mailer.rb +65 -0
  41. data/lib/request_log_analyzer/output/fancy_html.rb +49 -0
  42. data/lib/request_log_analyzer/output/fixed_width.rb +220 -0
  43. data/lib/request_log_analyzer/output/html.rb +187 -0
  44. data/lib/request_log_analyzer/output.rb +117 -0
  45. data/lib/request_log_analyzer/request.rb +125 -40
  46. data/lib/request_log_analyzer/source/database_loader.rb +87 -0
  47. data/lib/request_log_analyzer/source/log_parser.rb +297 -0
  48. data/lib/request_log_analyzer/source.rb +72 -0
  49. data/lib/request_log_analyzer/tracker/duration.rb +28 -64
  50. data/lib/request_log_analyzer/tracker/frequency.rb +108 -0
  51. data/lib/request_log_analyzer/tracker/hourly_spread.rb +76 -49
  52. data/lib/request_log_analyzer/tracker/numeric_value.rb +223 -0
  53. data/lib/request_log_analyzer/tracker/timespan.rb +54 -27
  54. data/lib/request_log_analyzer/tracker/traffic.rb +40 -0
  55. data/lib/request_log_analyzer/tracker.rb +101 -0
  56. data/lib/request_log_analyzer.rb +43 -13
  57. data/request-log-analyzer.gemspec +41 -0
  58. data/spec/database.yml +23 -0
  59. data/spec/fixtures/apache_combined.log +5 -0
  60. data/spec/fixtures/apache_common.log +10 -0
  61. data/spec/fixtures/decompression.log +12 -0
  62. data/spec/fixtures/decompression.log.bz2 +0 -0
  63. data/spec/fixtures/decompression.log.gz +0 -0
  64. data/spec/fixtures/decompression.log.zip +0 -0
  65. data/spec/fixtures/decompression.tar.gz +0 -0
  66. data/spec/fixtures/decompression.tgz +0 -0
  67. data/spec/fixtures/header_and_footer.log +6 -0
  68. data/spec/fixtures/merb_prefixed.log +9 -0
  69. data/spec/fixtures/mysql_slow_query.log +110 -0
  70. data/spec/fixtures/postgresql.log +2980 -0
  71. data/spec/fixtures/rails.db +0 -0
  72. data/spec/fixtures/rails_22.log +1 -1
  73. data/spec/fixtures/sinatra.log +99 -0
  74. data/spec/integration/command_line_usage_spec.rb +84 -0
  75. data/spec/integration/mailer_spec.rb +179 -0
  76. data/spec/integration/munin_plugins_rails_spec.rb +58 -0
  77. data/spec/integration/scout_spec.rb +152 -0
  78. data/spec/lib/helpers.rb +72 -0
  79. data/spec/lib/macros.rb +18 -0
  80. data/spec/lib/matchers.rb +77 -0
  81. data/spec/lib/mocks.rb +77 -0
  82. data/spec/lib/testing_format.rb +46 -0
  83. data/spec/spec_helper.rb +16 -59
  84. data/spec/unit/aggregator/database_inserter_spec.rb +93 -0
  85. data/spec/unit/aggregator/summarizer_spec.rb +26 -0
  86. data/spec/unit/controller/controller_spec.rb +41 -0
  87. data/spec/unit/controller/log_processor_spec.rb +18 -0
  88. data/spec/unit/database/base_class_spec.rb +183 -0
  89. data/spec/unit/database/connection_spec.rb +34 -0
  90. data/spec/unit/database/database_spec.rb +133 -0
  91. data/spec/unit/file_format/amazon_s3_format_spec.rb +67 -0
  92. data/spec/unit/file_format/apache_format_spec.rb +203 -0
  93. data/spec/unit/file_format/common_regular_expressions_spec.rb +53 -0
  94. data/spec/unit/file_format/delayed_job_format_spec.rb +83 -0
  95. data/spec/unit/file_format/file_format_api_spec.rb +69 -0
  96. data/spec/unit/file_format/format_autodetection_spec.rb +40 -0
  97. data/spec/unit/file_format/line_definition_spec.rb +75 -0
  98. data/spec/unit/file_format/merb_format_spec.rb +52 -0
  99. data/spec/unit/file_format/mysql_format_spec.rb +154 -0
  100. data/spec/unit/file_format/postgresql_format_spec.rb +65 -0
  101. data/spec/unit/file_format/rack_format_spec.rb +50 -0
  102. data/spec/unit/file_format/rails3_format_spec.rb +120 -0
  103. data/spec/unit/file_format/rails_format_spec.rb +180 -0
  104. data/spec/unit/filter/anonymize_filter_spec.rb +21 -0
  105. data/spec/unit/filter/field_filter_spec.rb +66 -0
  106. data/spec/unit/filter/filter_spec.rb +17 -0
  107. data/spec/unit/filter/timespan_filter_spec.rb +58 -0
  108. data/spec/unit/mailer_spec.rb +42 -0
  109. data/spec/unit/request_spec.rb +111 -0
  110. data/spec/unit/source/log_parser_spec.rb +119 -0
  111. data/spec/unit/tracker/duration_tracker_spec.rb +49 -0
  112. data/spec/unit/tracker/frequency_tracker_spec.rb +88 -0
  113. data/spec/unit/tracker/hourly_spread_spec.rb +79 -0
  114. data/spec/unit/tracker/numeric_value_tracker_spec.rb +166 -0
  115. data/spec/unit/tracker/timespan_tracker_spec.rb +73 -0
  116. data/spec/unit/tracker/tracker_api_spec.rb +125 -0
  117. data/spec/unit/tracker/traffic_tracker_spec.rb +28 -0
  118. data/tasks/github-gem.rake +290 -139
  119. data/tasks/request_log_analyzer.rake +23 -7
  120. metadata +221 -94
  121. data/DESIGN +0 -14
  122. data/HACKING +0 -7
  123. data/README.textile +0 -36
  124. data/lib/cli/bashcolorizer.rb +0 -60
  125. data/lib/request_log_analyzer/aggregator/database.rb +0 -148
  126. data/lib/request_log_analyzer/filter/base.rb +0 -29
  127. data/lib/request_log_analyzer/log_parser.rb +0 -173
  128. data/lib/request_log_analyzer/source/base.rb +0 -42
  129. data/lib/request_log_analyzer/source/log_file.rb +0 -170
  130. data/lib/request_log_analyzer/tracker/base.rb +0 -54
  131. data/lib/request_log_analyzer/tracker/category.rb +0 -71
  132. data/spec/controller_spec.rb +0 -40
  133. data/spec/database_inserter_spec.rb +0 -101
  134. data/spec/file_format_spec.rb +0 -78
  135. data/spec/file_formats/spec_format.rb +0 -26
  136. data/spec/filter_spec.rb +0 -137
  137. data/spec/line_definition_spec.rb +0 -124
  138. data/spec/log_parser_spec.rb +0 -68
  139. data/spec/log_processor_spec.rb +0 -57
  140. data/spec/merb_format_spec.rb +0 -38
  141. data/spec/rails_format_spec.rb +0 -76
  142. data/spec/request_spec.rb +0 -72
  143. data/spec/summarizer_spec.rb +0 -9
  144. data/tasks/rspec.rake +0 -6
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 6
8
+ - 3
9
+ version: 1.6.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Willem van Bergen
@@ -10,126 +15,248 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2009-01-13 00:00:00 +01:00
18
+ date: 2010-03-19 00:00:00 -04:00
14
19
  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
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 2
31
+ - 4
32
+ version: 1.2.4
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: git
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 1
45
+ - 0
46
+ version: 1.1.0
47
+ type: :development
48
+ version_requirements: *id002
49
+ 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"
50
+ email:
51
+ - willem@railsdoctors.com
52
+ - bart@railsdoctors.com
19
53
  executables:
20
54
  - request-log-analyzer
21
55
  extensions: []
22
56
 
23
- extra_rdoc_files: []
24
-
57
+ extra_rdoc_files:
58
+ - README.rdoc
25
59
  files:
26
- - DESIGN
27
- - HACKING
28
- - LICENSE
29
- - README.textile
30
- - Rakefile
31
- - bin
32
- - bin/request-log-analyzer
33
- - lib
34
- - lib/cli
35
- - lib/cli/bashcolorizer.rb
60
+ - spec/unit/tracker/hourly_spread_spec.rb
61
+ - lib/request_log_analyzer/output/html.rb
62
+ - DESIGN.rdoc
63
+ - spec/fixtures/rails_unordered.log
64
+ - spec/fixtures/multiple_files_1.log
65
+ - lib/request_log_analyzer/database/source.rb
66
+ - README.rdoc
67
+ - spec/unit/file_format/amazon_s3_format_spec.rb
68
+ - lib/request_log_analyzer/file_format/rails_development.rb
69
+ - spec/fixtures/rails_22.log
70
+ - spec/fixtures/test_order.log
71
+ - spec/unit/database/base_class_spec.rb
72
+ - lib/request_log_analyzer/database/connection.rb
73
+ - lib/request_log_analyzer/aggregator.rb
74
+ - spec/fixtures/decompression.log
75
+ - lib/request_log_analyzer/file_format/apache.rb
76
+ - spec/unit/file_format/rack_format_spec.rb
77
+ - spec/fixtures/decompression.log.gz
78
+ - lib/request_log_analyzer/tracker/frequency.rb
79
+ - lib/request_log_analyzer/tracker/duration.rb
80
+ - tasks/github-gem.rake
81
+ - spec/unit/filter/filter_spec.rb
82
+ - .gitignore
83
+ - spec/lib/macros.rb
84
+ - spec/spec_helper.rb
85
+ - spec/fixtures/decompression.log.bz2
86
+ - spec/unit/database/connection_spec.rb
87
+ - lib/request_log_analyzer/filter.rb
88
+ - spec/integration/scout_spec.rb
89
+ - spec/fixtures/test_file_format.log
90
+ - spec/unit/filter/timespan_filter_spec.rb
91
+ - lib/request_log_analyzer/tracker/traffic.rb
92
+ - spec/unit/file_format/merb_format_spec.rb
93
+ - spec/unit/file_format/format_autodetection_spec.rb
94
+ - spec/unit/file_format/file_format_api_spec.rb
95
+ - lib/request_log_analyzer/filter/field.rb
96
+ - lib/request_log_analyzer/file_format/merb.rb
97
+ - lib/request_log_analyzer/filter/anonymize.rb
98
+ - lib/request_log_analyzer/file_format/amazon_s3.rb
99
+ - lib/cli/database_console.rb
100
+ - spec/integration/mailer_spec.rb
101
+ - lib/request_log_analyzer/line_definition.rb
102
+ - spec/unit/tracker/frequency_tracker_spec.rb
103
+ - spec/fixtures/postgresql.log
104
+ - spec/fixtures/multiple_files_2.log
105
+ - spec/lib/mocks.rb
106
+ - spec/unit/file_format/apache_format_spec.rb
107
+ - spec/fixtures/syslog_1x.log
108
+ - spec/unit/file_format/rails3_format_spec.rb
109
+ - spec/integration/munin_plugins_rails_spec.rb
110
+ - lib/request_log_analyzer/file_format/rails3.rb
111
+ - spec/lib/helpers.rb
112
+ - spec/unit/file_format/delayed_job_format_spec.rb
113
+ - spec/fixtures/rails.db
114
+ - spec/unit/source/log_parser_spec.rb
115
+ - lib/request_log_analyzer/aggregator/database_inserter.rb
116
+ - spec/fixtures/header_and_footer.log
117
+ - spec/lib/testing_format.rb
118
+ - lib/request_log_analyzer/database.rb
119
+ - spec/unit/file_format/rails_format_spec.rb
120
+ - lib/request_log_analyzer/request.rb
121
+ - lib/request_log_analyzer/output/fixed_width.rb
122
+ - spec/integration/command_line_usage_spec.rb
123
+ - lib/request_log_analyzer/file_format/rack.rb
124
+ - lib/request_log_analyzer/tracker/numeric_value.rb
125
+ - spec/fixtures/test_language_combined.log
126
+ - spec/unit/request_spec.rb
36
127
  - lib/cli/command_line_arguments.rb
37
- - lib/cli/progressbar.rb
38
- - lib/request_log_analyzer
39
128
  - lib/request_log_analyzer.rb
40
- - lib/request_log_analyzer/aggregator
41
- - lib/request_log_analyzer/aggregator/base.rb
42
- - lib/request_log_analyzer/aggregator/database.rb
43
- - lib/request_log_analyzer/aggregator/echo.rb
129
+ - spec/database.yml
130
+ - lib/request_log_analyzer/database/base.rb
131
+ - spec/unit/aggregator/database_inserter_spec.rb
132
+ - lib/request_log_analyzer/database/request.rb
133
+ - lib/request_log_analyzer/output/fancy_html.rb
134
+ - lib/cli/database_console_init.rb
135
+ - lib/cli/progressbar.rb
136
+ - lib/request_log_analyzer/database/warning.rb
137
+ - spec/unit/filter/anonymize_filter_spec.rb
138
+ - spec/fixtures/apache_combined.log
139
+ - spec/unit/tracker/duration_tracker_spec.rb
140
+ - spec/fixtures/rails_22_cached.log
44
141
  - lib/request_log_analyzer/aggregator/summarizer.rb
45
- - lib/request_log_analyzer/controller.rb
46
- - lib/request_log_analyzer/file_format
47
- - lib/request_log_analyzer/file_format.rb
48
- - lib/request_log_analyzer/file_format/merb.rb
142
+ - spec/unit/file_format/postgresql_format_spec.rb
143
+ - spec/unit/file_format/common_regular_expressions_spec.rb
144
+ - spec/fixtures/rails_1x.log
145
+ - lib/request_log_analyzer/file_format/delayed_job.rb
146
+ - lib/request_log_analyzer/output.rb
147
+ - spec/unit/file_format/line_definition_spec.rb
148
+ - lib/request_log_analyzer/file_format/mysql.rb
149
+ - spec/unit/file_format/mysql_format_spec.rb
150
+ - request-log-analyzer.gemspec
151
+ - spec/fixtures/apache_common.log
152
+ - spec/unit/mailer_spec.rb
49
153
  - lib/request_log_analyzer/file_format/rails.rb
50
- - lib/request_log_analyzer/filter
51
- - lib/request_log_analyzer/filter/base.rb
52
- - lib/request_log_analyzer/filter/field.rb
53
- - lib/request_log_analyzer/filter/timespan.rb
54
- - lib/request_log_analyzer/line_definition.rb
55
- - lib/request_log_analyzer/log_parser.rb
56
- - lib/request_log_analyzer/log_processor.rb
57
- - lib/request_log_analyzer/request.rb
58
- - lib/request_log_analyzer/source
59
- - lib/request_log_analyzer/source/base.rb
60
- - lib/request_log_analyzer/source/log_file.rb
61
- - lib/request_log_analyzer/tracker
62
- - lib/request_log_analyzer/tracker/base.rb
63
- - lib/request_log_analyzer/tracker/category.rb
64
- - lib/request_log_analyzer/tracker/duration.rb
154
+ - Rakefile
65
155
  - lib/request_log_analyzer/tracker/hourly_spread.rb
156
+ - spec/unit/aggregator/summarizer_spec.rb
157
+ - spec/unit/tracker/traffic_tracker_spec.rb
158
+ - spec/unit/tracker/numeric_value_tracker_spec.rb
159
+ - lib/request_log_analyzer/file_format/postgresql.rb
66
160
  - lib/request_log_analyzer/tracker/timespan.rb
67
- - spec
68
- - spec/controller_spec.rb
69
- - spec/database_inserter_spec.rb
70
- - spec/file_format_spec.rb
71
- - spec/file_formats
72
- - spec/file_formats/spec_format.rb
73
- - spec/filter_spec.rb
74
- - spec/fixtures
161
+ - spec/unit/controller/log_processor_spec.rb
162
+ - spec/unit/filter/field_filter_spec.rb
163
+ - spec/fixtures/sinatra.log
164
+ - spec/fixtures/merb_prefixed.log
165
+ - lib/request_log_analyzer/log_processor.rb
166
+ - lib/request_log_analyzer/filter/timespan.rb
167
+ - spec/unit/controller/controller_spec.rb
168
+ - lib/request_log_analyzer/mailer.rb
169
+ - lib/cli/tools.rb
170
+ - spec/fixtures/decompression.tar.gz
171
+ - spec/unit/tracker/timespan_tracker_spec.rb
172
+ - spec/lib/matchers.rb
173
+ - lib/request_log_analyzer/controller.rb
174
+ - spec/unit/tracker/tracker_api_spec.rb
175
+ - lib/request_log_analyzer/source/database_loader.rb
75
176
  - spec/fixtures/merb.log
76
- - spec/fixtures/multiple_files_1.log
77
- - spec/fixtures/multiple_files_2.log
78
- - spec/fixtures/rails_1x.log
79
- - spec/fixtures/rails_22.log
80
- - spec/fixtures/rails_22_cached.log
81
- - spec/fixtures/rails_unordered.log
82
- - spec/fixtures/syslog_1x.log
83
- - spec/fixtures/test_file_format.log
84
- - spec/fixtures/test_language_combined.log
85
- - spec/fixtures/test_order.log
86
- - spec/line_definition_spec.rb
87
- - spec/log_parser_spec.rb
88
- - spec/log_processor_spec.rb
89
- - spec/merb_format_spec.rb
90
- - spec/rails_format_spec.rb
91
- - spec/request_spec.rb
92
- - spec/spec_helper.rb
93
- - spec/summarizer_spec.rb
94
- - tasks
95
- - tasks/github-gem.rake
177
+ - LICENSE
178
+ - lib/request_log_analyzer/file_format.rb
96
179
  - tasks/request_log_analyzer.rake
97
- - tasks/rspec.rake
98
- has_rdoc: false
99
- homepage: http://github.com/wvanbergen/request-log-analyzer/wikis
100
- post_install_message:
101
- rdoc_options: []
180
+ - spec/unit/database/database_spec.rb
181
+ - spec/fixtures/decompression.log.zip
182
+ - spec/fixtures/decompression.tgz
183
+ - bin/request-log-analyzer
184
+ - lib/request_log_analyzer/tracker.rb
185
+ - lib/request_log_analyzer/source.rb
186
+ - spec/fixtures/mysql_slow_query.log
187
+ - lib/request_log_analyzer/source/log_parser.rb
188
+ - lib/request_log_analyzer/aggregator/echo.rb
189
+ has_rdoc: true
190
+ homepage: http://railsdoctors.com
191
+ licenses: []
102
192
 
193
+ post_install_message:
194
+ rdoc_options:
195
+ - --title
196
+ - request-log-analyzer
197
+ - --main
198
+ - README.rdoc
199
+ - --line-numbers
200
+ - --inline-source
103
201
  require_paths:
104
202
  - lib
105
203
  required_ruby_version: !ruby/object:Gem::Requirement
106
204
  requirements:
107
205
  - - ">="
108
206
  - !ruby/object:Gem::Version
207
+ segments:
208
+ - 0
109
209
  version: "0"
110
- version:
111
210
  required_rubygems_version: !ruby/object:Gem::Requirement
112
211
  requirements:
113
212
  - - ">="
114
213
  - !ruby/object:Gem::Version
214
+ segments:
215
+ - 0
115
216
  version: "0"
116
- version:
117
- requirements: []
118
-
217
+ requirements:
218
+ - To use the database inserter, ActiveRecord and an appropriate database adapter are required.
119
219
  rubyforge_project: r-l-a
120
- rubygems_version: 1.2.0
220
+ rubygems_version: 1.3.6
121
221
  signing_key:
122
- specification_version: 2
123
- summary: A command line tool to analyze Rails logs
222
+ specification_version: 3
223
+ summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
124
224
  test_files:
125
- - spec/controller_spec.rb
126
- - spec/database_inserter_spec.rb
127
- - spec/file_format_spec.rb
128
- - spec/filter_spec.rb
129
- - spec/line_definition_spec.rb
130
- - spec/log_parser_spec.rb
131
- - spec/log_processor_spec.rb
132
- - spec/merb_format_spec.rb
133
- - spec/rails_format_spec.rb
134
- - spec/request_spec.rb
135
- - spec/summarizer_spec.rb
225
+ - spec/unit/tracker/hourly_spread_spec.rb
226
+ - spec/unit/file_format/amazon_s3_format_spec.rb
227
+ - spec/unit/database/base_class_spec.rb
228
+ - spec/unit/file_format/rack_format_spec.rb
229
+ - spec/unit/filter/filter_spec.rb
230
+ - spec/unit/database/connection_spec.rb
231
+ - spec/integration/scout_spec.rb
232
+ - spec/unit/filter/timespan_filter_spec.rb
233
+ - spec/unit/file_format/merb_format_spec.rb
234
+ - spec/unit/file_format/format_autodetection_spec.rb
235
+ - spec/unit/file_format/file_format_api_spec.rb
236
+ - spec/integration/mailer_spec.rb
237
+ - spec/unit/tracker/frequency_tracker_spec.rb
238
+ - spec/unit/file_format/apache_format_spec.rb
239
+ - spec/unit/file_format/rails3_format_spec.rb
240
+ - spec/integration/munin_plugins_rails_spec.rb
241
+ - spec/unit/file_format/delayed_job_format_spec.rb
242
+ - spec/unit/source/log_parser_spec.rb
243
+ - spec/unit/file_format/rails_format_spec.rb
244
+ - spec/integration/command_line_usage_spec.rb
245
+ - spec/unit/request_spec.rb
246
+ - spec/unit/aggregator/database_inserter_spec.rb
247
+ - spec/unit/filter/anonymize_filter_spec.rb
248
+ - spec/unit/tracker/duration_tracker_spec.rb
249
+ - spec/unit/file_format/postgresql_format_spec.rb
250
+ - spec/unit/file_format/common_regular_expressions_spec.rb
251
+ - spec/unit/file_format/line_definition_spec.rb
252
+ - spec/unit/file_format/mysql_format_spec.rb
253
+ - spec/unit/mailer_spec.rb
254
+ - spec/unit/aggregator/summarizer_spec.rb
255
+ - spec/unit/tracker/traffic_tracker_spec.rb
256
+ - spec/unit/tracker/numeric_value_tracker_spec.rb
257
+ - spec/unit/controller/log_processor_spec.rb
258
+ - spec/unit/filter/field_filter_spec.rb
259
+ - spec/unit/controller/controller_spec.rb
260
+ - spec/unit/tracker/timespan_tracker_spec.rb
261
+ - spec/unit/tracker/tracker_api_spec.rb
262
+ - spec/unit/database/database_spec.rb
data/DESIGN DELETED
@@ -1,14 +0,0 @@
1
- Request-log-analyzer is set up like a simple pipe and filter system.
2
-
3
- This allows you to easily add extra reports, filters and outputs.
4
-
5
- 1) Build pipeline.
6
- -> Aggregator (database)
7
- Source -> Filter -> Filter -> Aggregator (summary report)
8
- -> Aggregator (...)
9
-
10
- 2) Start chunk producer and push chunks through pipeline.
11
- Controller.start
12
-
13
- 3) Gather output from pipeline.
14
- Controller.report
data/HACKING DELETED
@@ -1,7 +0,0 @@
1
- HACKING on r-l-a
2
- ----------------
3
-
4
- - See DESIGN for the basic internal design of r-l-a
5
- - See http://wiki.github.com/wvanbergen/request-log-analyzer/development for
6
- more information about developing
7
- - Contact willem AT vanbergen DOT org for any questions
data/README.textile DELETED
@@ -1,36 +0,0 @@
1
- h1. Request-log-analyzer
2
-
3
- This is a simple command line tool to analyze request log files of both Rails and
4
- Merb to produce a performance report. Its purpose is to find what actions are best candidates for optimization.
5
-
6
- * Analyzes Rails log files (all versions)
7
- * Can combine multiple files (handy if you are using logrotate)
8
- * Uses several metrics, including cumulative request time, average request time, process blockers, database and rendering time, HTTP methods and states, Rails action cache statistics, etc.) ("Sample output":http://wiki.github.com/wvanbergen/request-log-analyzer/sample-output)
9
- * Low memory footprint (server-safe)
10
- * Fast
11
- * MIT licensed
12
-
13
- h2. Installation
14
-
15
- <pre>
16
- $ sudo gem install wvanbergen-request-log-analyzer --source http://gems.github.com
17
- </pre>
18
-
19
- To get the best results out of request-log-analyzer, make sure to
20
- "set up logging correctly":http://wiki.github.com/wvanbergen/request-log-analyzer/configure-logging
21
- for your application.
22
-
23
- h2. Usage
24
-
25
- To analyze a log file and produce a performance report, run request-log-analyzer like this:
26
-
27
- <pre>
28
- $ request-log-analyzer log/production.log
29
- </pre>
30
-
31
- For more details and available command line options, see the "project's wiki":http://wiki.github.com/wvanbergen/request-log-analyzer/basic-usage
32
-
33
- h2. Additional information
34
-
35
- * "Project wiki at GitHub":http://wiki.github.com/wvanbergen/request-log-analyzer
36
- * "wvanbergen's blog posts":http://techblog.floorplanner.com/tag/request-log-analyzer/
@@ -1,60 +0,0 @@
1
- # Colorize a text output with the given color if.
2
- # <tt>text</tt> The text to colorize.
3
- # <tt>color_code</tt> The color code string to set
4
- # <tt>color</tt> Does not color if false. Defaults to false
5
- def colorize(text, color_code, color = false)
6
- color ? "#{color_code}#{text}\e[0m" : text
7
- end
8
-
9
- # Draw a red line of text
10
- def red(text, color = false)
11
- colorize(text, "\e[31m", color)
12
- end
13
-
14
- # Draw a Green line of text
15
- def green(text, color = false)
16
- colorize(text, "\e[32m", color)
17
- end
18
-
19
- # Draw a Yellow line of text
20
- def yellow(text, color = false)
21
- colorize(text, "\e[33m", color)
22
- end
23
-
24
- # Draw a Yellow line of text
25
- def blue(text, color = false)
26
- colorize(text, "\e[34m", color)
27
- end
28
-
29
- def white(text, color = false)
30
- colorize(text, "\e[37m", color)
31
- end
32
-
33
-
34
- #STYLE = {
35
- # :default => “33[0m”,
36
- # # styles
37
- # :bold => “33[1m”,
38
- # :underline => “33[4m”,
39
- # :blink => “33[5m”,
40
- # :reverse => “33[7m”,
41
- # :concealed => “33[8m”,
42
- # # font colors
43
- # :black => “33[30m”,
44
- # :red => “33[31m”,
45
- # :green => “33[32m”,
46
- # :yellow => “33[33m”,
47
- # :blue => “33[34m”,
48
- # :magenta => “33[35m”,
49
- # :cyan => “33[36m”,
50
- # :white => “33[37m”,
51
- # # background colors
52
- # :on_black => “33[40m”,
53
- # :on_red => “33[41m”,
54
- # :on_green => “33[42m”,
55
- # :on_yellow => “33[43m”,
56
- # :on_blue => “33[44m”,
57
- # :on_magenta => “33[45m”,
58
- # :on_cyan => “33[46m”,
59
- # :on_white => “33[47m” }
60
- #
@@ -1,148 +0,0 @@
1
- require 'rubygems'
2
- require 'activerecord'
3
-
4
- module RequestLogAnalyzer::Aggregator
5
-
6
- # The database aggregator will create an SQLite3 database with all parsed request information.
7
- #
8
- # The prepare method will create a database schema according to the file format definitions.
9
- # It will also create ActiveRecord::Base subclasses to interact with the created tables.
10
- # Then, the aggregate method will be called for every parsed request. The information of
11
- # these requests is inserted into the tables using the ActiveRecord classes.
12
- #
13
- # A requests table will be created, in which a record is inserted for every parsed request.
14
- # For every line type, a separate table will be created with a request_id field to point to
15
- # the request record, and a field for every parsed value. Finally, a warnings table will be
16
- # created to log all parse warnings.
17
- class Database < Base
18
-
19
- # Establishes a connection to the database and creates the necessary database schema for the
20
- # current file format
21
- def prepare
22
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => options[:database])
23
- File.unlink(options[:database]) if File.exist?(options[:database]) # TODO: keep old database?
24
- create_database_schema!
25
- end
26
-
27
- # Aggregates a request into the database
28
- # This will create a record in the requests table and create a record for every line that has been parsed,
29
- # in which the captured values will be stored.
30
- def aggregate(request)
31
- @request_object = @request_class.new(:first_lineno => request.first_lineno, :last_lineno => request.last_lineno)
32
- request.lines.each do |line|
33
- attributes = line.reject { |k, v| [:line_type].include?(k) }
34
- @request_object.send("#{line[:line_type]}_lines").build(attributes)
35
- end
36
- @request_object.save!
37
- rescue SQLite3::SQLException => e
38
- raise Interrupt, e.message
39
- end
40
-
41
- # Finalizes the aggregator by closing the connection to the database
42
- def finalize
43
- @request_count = @orm_module::Request.count
44
- ActiveRecord::Base.remove_connection
45
- end
46
-
47
- # Records w warining in the warnings table.
48
- def warning(type, message, lineno)
49
- @orm_module::Warning.create!(:warning_type => type.to_s, :message => message, :lineno => lineno)
50
- end
51
-
52
- # Prints a short report of what has been inserted into the database
53
- def report(output = STDOUT, report_width = 80, color = false)
54
- output << "\n"
55
- output << green("━" * report_width, color) + "\n"
56
- output << "A database file has been created with all parsed request information.\n"
57
- output << "#{@request_count} requests have been added to the database.\n"
58
- output << "To execute queries on this database, run the following command:\n"
59
- output << " $ sqlite3 #{options[:database]}\n"
60
- output << "\n"
61
- end
62
-
63
- protected
64
-
65
- # This function creates a database table for a given line definition.
66
- # It will create a field for every capture in the line, and adds a lineno field to indicate at
67
- # what line in the original file the line was found, and a request_id to link lines related
68
- # to the same request. It will also create an index in the request_id field to speed up queries.
69
- def create_database_table(name, definition)
70
- ActiveRecord::Migration.verbose = options[:debug]
71
- ActiveRecord::Migration.create_table("#{name}_lines") do |t|
72
- t.column(:request_id, :integer)
73
- t.column(:lineno, :integer)
74
- definition.captures.each do |capture|
75
- t.column(capture[:name], column_type(capture))
76
- end
77
- end
78
- ActiveRecord::Migration.add_index("#{name}_lines", [:request_id])
79
- end
80
-
81
- # Creates an ActiveRecord class for a given line definition.
82
- # A subclass of ActiveRecord::Base is created and an association with the Request class is
83
- # created using belongs_to / has_many. This association will later be used to create records
84
- # in the corresponding table. This table should already be created before this method is called.
85
- def create_activerecord_class(name, definition)
86
- class_name = "#{name}_line".camelize
87
- klass = Class.new(ActiveRecord::Base)
88
- klass.send(:belongs_to, :request)
89
- @orm_module.const_set(class_name, klass) unless @orm_module.const_defined?(class_name)
90
- @request_class.send(:has_many, "#{name}_lines".to_sym)
91
- end
92
-
93
- # Creates a requests table, in which a record is created for every request. It also creates an
94
- # ActiveRecord::Base class to communicate with this table.
95
- def create_request_table_and_class
96
- ActiveRecord::Migration.verbose = options[:debug]
97
- ActiveRecord::Migration.create_table("requests") do |t|
98
- t.integer :first_lineno
99
- t.integer :last_lineno
100
- end
101
-
102
- @orm_module.const_set('Request', Class.new(ActiveRecord::Base)) unless @orm_module.const_defined?('Request')
103
- @request_class = @orm_module.const_get('Request')
104
- end
105
-
106
- # Creates a warnings table and a corresponding Warning class to communicate with this table using ActiveRecord.
107
- def create_warning_table_and_class
108
- ActiveRecord::Migration.verbose = options[:debug]
109
- ActiveRecord::Migration.create_table("warnings") do |t|
110
- t.string :warning_type, :limit => 30, :null => false
111
- t.string :message
112
- t.integer :lineno
113
- end
114
-
115
- @orm_module.const_set('Warning', Class.new(ActiveRecord::Base)) unless @orm_module.const_defined?('Warning')
116
- end
117
-
118
- # Creates the database schema and related ActiveRecord::Base subclasses that correspond to the
119
- # file format definition. These ORM classes will later be used to create records in the database.
120
- def create_database_schema!
121
-
122
- if file_format.class.const_defined?('Database')
123
- @orm_module = file_format.class.const_get('Database')
124
- else
125
- @orm_module = file_format.class.const_set('Database', Module.new)
126
- end
127
-
128
- create_request_table_and_class
129
- create_warning_table_and_class
130
-
131
- file_format.line_definitions.each do |name, definition|
132
- create_database_table(name, definition)
133
- create_activerecord_class(name, definition)
134
- end
135
- end
136
-
137
- # Function to determine the column type for a field
138
- # TODO: make more robust / include in file-format definition
139
- def column_type(capture)
140
- case capture[:type]
141
- when :sec; :double
142
- when :msec; :double
143
- when :float; :double
144
- else capture[:type]
145
- end
146
- end
147
- end
148
- end
@@ -1,29 +0,0 @@
1
- module RequestLogAnalyzer
2
- module Filter
3
- # Base filter class used to filter input requests.
4
- # All filters should interit from this base.
5
- class Base
6
-
7
- include RequestLogAnalyzer::FileFormat::Awareness
8
-
9
- attr_reader :log_parser
10
- attr_reader :options
11
-
12
- # Initializer
13
- # <tt>format</tt> The file format
14
- # <tt>options</tt> Are passed to the filters.
15
- def initialize(format, options = {})
16
- @options = options
17
- register_file_format(format)
18
- end
19
-
20
- def prepare
21
- end
22
-
23
- def filter(request)
24
- return nil unless request
25
- return request
26
- end
27
- end
28
- end
29
- end