log_analyzer 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +9 -1
- data/README.md +6 -6
- data/lib/log_analyzer/stat.rb +4 -8
- data/lib/log_analyzer/version.rb +1 -1
- data/lib/log_analyzer.rb +2 -0
- data/log_analyzer.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a7d0498d34ec406651952a710ae56890b702554
|
4
|
+
data.tar.gz: 95431b32fd3962ee0e02e81865bc6bdc827bc459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0ec3c9d14dd5c3555fba87638445100bddf5b23fc7c8a1e0146c2efd66cb9df6647ec595db67064ac7094d0621bb973f47725e324d7828b08a9e8f934528851
|
7
|
+
data.tar.gz: 3d2246398ab3fb555fa6f6c941d0d4a78ab8ff9bd46cb0b63b55eae3eb4abaeab1cb8595b8ce2614b1feb59a4a10e340cb0c61b26fae7e71836a59066b90f394
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
log_analyzer (0.1.
|
4
|
+
log_analyzer (0.1.6)
|
5
5
|
colorize
|
6
6
|
rake
|
7
7
|
terminal-table
|
@@ -13,6 +13,8 @@ GEM
|
|
13
13
|
coderay (1.1.2)
|
14
14
|
colorize (0.8.1)
|
15
15
|
diff-lcs (1.3)
|
16
|
+
docile (1.1.5)
|
17
|
+
json (2.0.3)
|
16
18
|
method_source (0.9.0)
|
17
19
|
pry (0.11.3)
|
18
20
|
coderay (~> 1.1.0)
|
@@ -31,6 +33,11 @@ GEM
|
|
31
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
34
|
rspec-support (~> 3.7.0)
|
33
35
|
rspec-support (3.7.1)
|
36
|
+
simplecov (0.13.0)
|
37
|
+
docile (~> 1.1.0)
|
38
|
+
json (>= 1.8, < 3)
|
39
|
+
simplecov-html (~> 0.10.0)
|
40
|
+
simplecov-html (0.10.0)
|
34
41
|
terminal-table (1.8.0)
|
35
42
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
36
43
|
thor (0.20.0)
|
@@ -44,6 +51,7 @@ DEPENDENCIES
|
|
44
51
|
log_analyzer!
|
45
52
|
pry
|
46
53
|
rspec (~> 3.0)
|
54
|
+
simplecov
|
47
55
|
|
48
56
|
BUNDLED WITH
|
49
57
|
1.14.6
|
data/README.md
CHANGED
@@ -11,8 +11,8 @@ You can see columns:
|
|
11
11
|
* View - name of view
|
12
12
|
* Count - number of renders
|
13
13
|
* Avg - average time of rendering (in milliseconds)
|
14
|
-
* Max - maximum
|
15
|
-
* Min - minimum
|
14
|
+
* Max - maximum time of rendering
|
15
|
+
* Min - minimum time of rendering
|
16
16
|
|
17
17
|
|
18
18
|
## Installation
|
@@ -35,7 +35,7 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
## Usage
|
37
37
|
|
38
|
-
After
|
38
|
+
After installation run in console command `log_analyzer -f log/development.log`. You can change the file or sorting (time, count, name).
|
39
39
|
Samples:
|
40
40
|
|
41
41
|
* `log_analyzer log/development.log -s count`
|
@@ -46,13 +46,13 @@ Samples:
|
|
46
46
|
|
47
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
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.
|
49
|
+
Based on the observations I suggest to run this tool for files less than 1Gb. If you have enough RAM - download the log file to local machine and then run the tool.
|
50
50
|
|
51
51
|
## Development
|
52
52
|
|
53
53
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
54
54
|
|
55
|
-
To install this gem
|
55
|
+
To install this gem on your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
56
56
|
|
57
57
|
## Contributing
|
58
58
|
|
@@ -61,7 +61,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/varyfo
|
|
61
61
|
## TODO
|
62
62
|
|
63
63
|
* more analytics
|
64
|
-
* specs
|
64
|
+
* more specs
|
65
65
|
|
66
66
|
## License
|
67
67
|
|
data/lib/log_analyzer/stat.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
module LogAnalyzer
|
2
2
|
class Stat
|
3
|
-
attr_reader :count
|
4
3
|
attr_reader :data
|
5
4
|
|
6
5
|
def initialize
|
7
|
-
@data
|
8
|
-
@count = 0
|
6
|
+
@data = []
|
9
7
|
end
|
10
8
|
|
11
9
|
def push(time)
|
12
|
-
@count += 1
|
13
10
|
@data << time.to_f
|
14
11
|
end
|
15
12
|
|
@@ -17,12 +14,11 @@ module LogAnalyzer
|
|
17
14
|
@avg ||= (sum.to_f / count.to_f).round(2)
|
18
15
|
end
|
19
16
|
|
17
|
+
def count; @count ||= @data.count; end
|
20
18
|
def max; @max ||= @data.max; end
|
21
19
|
def min; @min ||= @data.min; end
|
22
20
|
|
23
21
|
private
|
24
|
-
|
25
|
-
@sum ||= @data.inject(nil) { |total, x| total ? total + x : x }
|
26
|
-
end
|
22
|
+
def sum; @sum ||= @data.reduce(:+); end
|
27
23
|
end
|
28
|
-
end
|
24
|
+
end
|
data/lib/log_analyzer/version.rb
CHANGED
data/lib/log_analyzer.rb
CHANGED
data/log_analyzer.gemspec
CHANGED
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
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: log_analyzer gem is created to get statistics about your views rendering
|
112
126
|
performance.
|
113
127
|
email:
|