presto-metrics 0.2.1 → 0.2.2

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: b37f209496ac2f07cccb2f2adf2b0e3b354d6b33
4
- data.tar.gz: 7e63a099a4071f200a3c303e76137c43dcae5408
3
+ metadata.gz: d8e484d67a52b36a5a044eb52ebdcdeba4c30ca6
4
+ data.tar.gz: c525e4c9a6fa494b786aac4d917af62ad3bb2ac0
5
5
  SHA512:
6
- metadata.gz: f9c06f040f5a9e39638cb8473e941351f0cd09399adc1551b870a9fb6a5e72e8fc3fdd434b42687d15f9de70a283947c211974c6971df6fc55f9bcd67b5e9c64
7
- data.tar.gz: 04f3a17bcfef4a0ce479ac452efebc6f6b8b90dbf2e80c42477193cbe69e145d8c2d7b4a271da4a9e91940d0db5d6a612bf914088f8bd5c2af40a2e6185a26c4
6
+ metadata.gz: f9436d3e9e34d5016f8fdf129a4176792509b34731e54bcef4d7dfff0e9547e86674a8885b7a9a5b7707060a0b7d7c8739b4b8b5cf5b7beed4c28e29fa78ee35
7
+ data.tar.gz: a91b72cf149f578b668689a4c17fceed21f596516c6278f360a3b54acffac62a374c6c4984f51e894050917bbc10e7e67132decdacf9e0a5fe3409cd71d3950f
@@ -1,5 +1,5 @@
1
1
  module Presto
2
2
  module Metrics
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -29,6 +29,22 @@ module Presto
29
29
  JSON.parse(@client.get_query_json(path))
30
30
  end
31
31
 
32
+ def metrics
33
+ query_list.map{|qi|
34
+ h = {}
35
+ h['query_id'] = qi['queryId'] || ""
36
+ h['state'] = qi['state'] || ""
37
+ session = qi['session'] || {}
38
+ h['source'] = session['source'] || ""
39
+ h['running_drivers'] = qi['runningDrivers'] || 0
40
+ h['queued_drivers'] = qi['queuedDrivers'] || 0
41
+ h['completed_drivers'] = qi['completedDrivers'] || 0
42
+ h['total_drivers'] = qi['totalDrivers'] || 0
43
+ h['elapsed_time'] = qi['elapsedTime'] || "0.0m"
44
+ h
45
+ }
46
+ end
47
+
32
48
  end
33
49
 
34
50
  class Client
@@ -96,12 +112,12 @@ module Presto
96
112
  JSON.parse(get_mbean_json(mbean))
97
113
  end
98
114
 
99
- def get(path)
115
+ def get(path, default="{}")
100
116
  resp = HTTParty.get("#{@endpoint}#{path}")
101
117
  if resp.code == 200
102
118
  resp.body
103
119
  else
104
- "{}"
120
+ default
105
121
  end
106
122
  end
107
123
 
@@ -110,7 +126,7 @@ module Presto
110
126
  end
111
127
 
112
128
  def get_query_json(path="")
113
- get("#{@query_path}/#{path}")
129
+ get("#{@query_path}/#{path}","[]")
114
130
  end
115
131
 
116
132
  def get_attributes(mbean)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presto-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taro L. Saito