log_analyzer 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 718fe1122c2e30d99c8ada795cb7e04578f25ad5
4
- data.tar.gz: 1ab59b840e924e242389097e09878441a6787066
3
+ metadata.gz: bbb66a793c6b6c55af9babe00eba4212980858ab
4
+ data.tar.gz: 0fe03b724b5727c1b410a88a0276d456e10af800
5
5
  SHA512:
6
- metadata.gz: 77316ae1baec4496e711343ea67c74f78a1798850f8c4bef73151b407946ea841fc6e853da246f7839fc06bd7ff42435ea55e3e76e42a0e05a0f4d34d865c855
7
- data.tar.gz: 201002bca02ce0d710fb521b4dd2d63561aabe66539dc1645ac0c4f3ffa0604df414c5fd81bcda125e020d4f82f3dece4e854b6d59dba0e41568d62f194e2827
6
+ metadata.gz: 40aedbef25daf98e33b2a3904edf40867c00fd588cd1c73e5d5dc26936e0601fec58afe7c30e202fa128a24aff34639df5e557bbfc2e943b1fad4323a91d67fa
7
+ data.tar.gz: 3022606d6ed63cbd3482b5eb01daaf32ed4e02239d44d6ecfd1f77b7ba9a5c7eef45ec1e9f3140ee7c7c5c2d5c9311f026aefdef24b790ebb2237bd9933d97b2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_analyzer (0.1.4)
4
+ log_analyzer (0.1.5)
5
5
  colorize
6
6
  rake
7
7
  terminal-table
data/README.md CHANGED
@@ -1,9 +1,24 @@
1
1
  # LogAnalyzer
2
2
 
3
- See how fast is rendering in your app. Based on information from logs
3
+ See how fast is rendering in your Ruby on Rails app. Based on information from logs. Provides you a picture of how often renders and how fast renders your views.
4
+
5
+ ## Sample
6
+
7
+ [![Sample](https://raw.githubusercontent.com/igorkasyanchuk/log_analyzer/master/docs/log_analyzer.png)](https://raw.githubusercontent.com/igorkasyanchuk/log_analyzer/master/docs/log_analyzer.png)
8
+
9
+ You can see columns:
10
+
11
+ * View - name of view
12
+ * Count - number of renders
13
+ * Avg - average time of rendering (in milliseconds)
14
+ * Max - maximum number of rendering
15
+ * Min - minimum number of rendering
16
+
4
17
 
5
18
  ## Installation
6
19
 
20
+ Could be installed as standalone (without adding to Gemfile).
21
+
7
22
  Add this line to your application's Gemfile:
8
23
 
9
24
  ```ruby
@@ -20,7 +35,18 @@ Or install it yourself as:
20
35
 
21
36
  ## Usage
22
37
 
23
- TODO: Write usage instructions here
38
+ After instalation run in console command `log_analyzer -f log/development.log`. You can change the file or sorting (time, count, name).
39
+ Samples:
40
+
41
+ * `log_analyzer log/development.log -s count`
42
+ * `log_analyzer log/production.log`
43
+ * `log_analyzer -f log/production.log -s name`
44
+ * `log_analyzer -f log/production.log -s time`
45
+ * `log_analyzer -file log/production.log -sort count`
46
+
47
+ **Based on results you can get an idea what to optimize. For example optimizing most often rendering view could give huge benefit. Now with this tool you can find out what are the numbers.**
48
+
49
+ Based on the observations I suggest to run this tool for files less than 1Gb. If you have enough RAM - download log file to local machine and then run the tool.
24
50
 
25
51
  ## Development
26
52
 
@@ -32,6 +58,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
58
 
33
59
  Bug reports and pull requests are welcome on GitHub at https://github.com/varyform/log_analyzer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
60
 
61
+ ## TODO
62
+
63
+ * more analytics
64
+ * specs
35
65
 
36
66
  ## License
37
67
 
@@ -6,6 +6,7 @@ module LogAnalyzer
6
6
  DANGER_DEFAULT = 800 # ms
7
7
  WARNING_DEFAULT = 400 # ms
8
8
  INFO_DEFAULT = 100 # ms
9
+ HEADER = ['View', 'Count', 'AVG (ms)', 'Max', 'Min'].freeze
9
10
 
10
11
  attr_reader :filename
11
12
  attr_reader :stats
@@ -40,17 +41,19 @@ module LogAnalyzer
40
41
  def visualize(limit: 100)
41
42
  length = (0..DEFAULT_TABLE_WIDTH - 20).freeze
42
43
  table = Terminal::Table.new \
43
- headings: ['Path', 'Count', 'AVG (ms)', 'Max', 'Min'],
44
+ headings: HEADER,
44
45
  width: DEFAULT_TABLE_WIDTH do |t|
45
- stats.each do |path, stat|
46
- t.add_row [
47
- path[length],
48
- stat.count,
49
- avg_label(stat.avg),
50
- stat.max,
51
- stat.min,
52
- ]
53
- end
46
+ stats.each do |path, stat|
47
+ t.add_row [
48
+ path[length],
49
+ stat.count,
50
+ avg_label(stat.avg),
51
+ stat.max,
52
+ stat.min,
53
+ ]
54
+ end
55
+ t.add_separator
56
+ t.add_row(HEADER)
54
57
  end
55
58
  puts table
56
59
  end
@@ -1,3 +1,3 @@
1
1
  module LogAnalyzer
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk