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 +4 -4
- data/lib/presto/metrics/version.rb +1 -1
- data/lib/presto/metrics.rb +19 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8e484d67a52b36a5a044eb52ebdcdeba4c30ca6
|
4
|
+
data.tar.gz: c525e4c9a6fa494b786aac4d917af62ad3bb2ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9436d3e9e34d5016f8fdf129a4176792509b34731e54bcef4d7dfff0e9547e86674a8885b7a9a5b7707060a0b7d7c8739b4b8b5cf5b7beed4c28e29fa78ee35
|
7
|
+
data.tar.gz: a91b72cf149f578b668689a4c17fceed21f596516c6278f360a3b54acffac62a374c6c4984f51e894050917bbc10e7e67132decdacf9e0a5fe3409cd71d3950f
|
data/lib/presto/metrics.rb
CHANGED
@@ -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)
|