log_query 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/lq +4 -4
- data/lib/log_query/messages.rb +2 -2
- data/lib/log_query/messages/heroku_router.rb +1 -1
- data/lib/log_query/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbbbbacb431cb36ca4af41d23f449c91c9625f16
|
4
|
+
data.tar.gz: 42c08499a6f0e4b0a72664dbdf581c9e6d97743d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0edc108cf0477232b70372cbf21ac9d6b57939aadd655b2b29e32ad8e9a5e4f2d970e83fa7c8adc2416dd54afc2a39240915a0ad9e83191e87862f96e5fae55b
|
7
|
+
data.tar.gz: 99b03af2d2dbdb06b2d210e8dcd18319e9576f5e33114281828f665f831608ff65fc55fd5de4e7e41904f43bffe119a320a33ad905123df30191a015eb29dee6
|
data/bin/lq
CHANGED
@@ -12,7 +12,7 @@ program :name, 'Log Query'
|
|
12
12
|
program :version, LogQuery::VERSION
|
13
13
|
program :description, 'CLI based analytics for heroku logs'
|
14
14
|
|
15
|
-
global_option('-g', '--group_by ATTRIBUTE', '
|
15
|
+
global_option('-g', '--group_by ATTRIBUTE[,ATTRIBUTE]', Array, 'Attributes to group by')
|
16
16
|
global_option('-m', '--measure ATTRIBUTE', 'Attribute to measure')
|
17
17
|
global_option('-a', '--average', 'Perform average')
|
18
18
|
global_option('-p', '--percentile NUMBER', Integer,'Find nth percentile')
|
@@ -31,21 +31,21 @@ command :run do |c|
|
|
31
31
|
|
32
32
|
# check which type group_by is in
|
33
33
|
if options.group_by
|
34
|
-
unless Messages.
|
34
|
+
unless Messages.class_from_attributes(options.group_by).detect { |klass| message.is_a?(klass) }
|
35
35
|
#screen.line("#{options.group_by} is not in #{message.class} with attributes #{message.class&.attributes}")
|
36
36
|
next
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
# check which type measure is in
|
41
|
-
unless Messages.
|
41
|
+
unless Messages.class_from_attributes([options.measure]).detect { |klass| message.is_a?(klass) }
|
42
42
|
#screen.line("#{options.measure} is not in #{message.class} with attributes #{message.class&.attributes}")
|
43
43
|
next
|
44
44
|
end
|
45
45
|
|
46
46
|
entries << entry
|
47
47
|
|
48
|
-
data = entries.group_by { |e| e.message.send(
|
48
|
+
data = entries.group_by { |e| options.group_by.map {|g| e.message.send(g) }.join(' ') } if options.group_by
|
49
49
|
data ||= { all: entries }
|
50
50
|
|
51
51
|
data.
|
data/lib/log_query/messages.rb
CHANGED
@@ -2,9 +2,9 @@ require_relative './messages/heroku_router'
|
|
2
2
|
require_relative './messages/heroku_web/rails'
|
3
3
|
|
4
4
|
module Messages
|
5
|
-
def self.
|
5
|
+
def self.class_from_attributes(attrs)
|
6
6
|
[HerokuRouter, HerokuWeb::Rails].select do |klass|
|
7
|
-
klass.attributes.include?(
|
7
|
+
attrs.map(&:to_sym).all? { |a| klass.attributes.include?(a) }
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -32,7 +32,7 @@ module Messages
|
|
32
32
|
when :sock, :at, :code, :desc, :method, :host, :request_id, :fwd, :dyno, :status
|
33
33
|
value
|
34
34
|
when :path
|
35
|
-
value.split('?')[0]
|
35
|
+
value.split('?')[0].gsub(/-[a-f0-9]{64}/, '')
|
36
36
|
when :connect, :service
|
37
37
|
Integer(value.match(/([0-9]*)ms/)[1])
|
38
38
|
when :bytes
|
data/lib/log_query/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasper Lyons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: descriptive_statistics
|