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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6a5eace67508a8f9b304887399b8850934c394e
4
- data.tar.gz: 40b0398eed248d957935748636fb9cbdb1b6b1a9
3
+ metadata.gz: bbbbbacb431cb36ca4af41d23f449c91c9625f16
4
+ data.tar.gz: 42c08499a6f0e4b0a72664dbdf581c9e6d97743d
5
5
  SHA512:
6
- metadata.gz: 1fea3044667c84a0d59691382da0216465d3738480cbd87bb5ab4929e238528e499d8fe378baaea9b4391f29edaa1790e0399a0bac08703249a465ef0c9cc276
7
- data.tar.gz: 66ca2acebdd27e20842e861848dc2da2eb08fe5eb27d795d6a6513d29b9de801e9d57693f2c79cb5a706850fb14d21d8e791fa2a5d74211190e31cdfe250a816
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', 'Attribute to group by')
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.class_from_attribute(options.group_by).detect { |klass| message.is_a?(klass) }
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.class_from_attribute(options.measure).detect { |klass| message.is_a?(klass) }
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(options.group_by) } if options.group_by
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.
@@ -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.class_from_attribute(attr)
5
+ def self.class_from_attributes(attrs)
6
6
  [HerokuRouter, HerokuWeb::Rails].select do |klass|
7
- klass.attributes.include?(attr.to_sym)
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
@@ -1,3 +1,3 @@
1
1
  module LogQuery
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-10-28 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: descriptive_statistics