presto-metrics 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/publisher.yml +35 -0
- data/.github/workflows/ruby.yml +10 -3
- data/.gitignore +1 -2
- data/.standard.yml +8 -0
- data/.standard_todo.yml +25 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +92 -0
- data/lib/presto/metrics/client.rb +56 -59
- data/lib/presto/metrics/query.rb +12 -16
- data/lib/presto/metrics/version.rb +1 -1
- data/lib/presto/metrics.rb +3 -3
- data/presto-metrics.gemspec +8 -1
- data/spec/presto/metrics_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- metadata +24 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 475432321a70930290783305021b5d9ae1b7320c37a59e9c4f2c7e1cf7bb2214
|
4
|
+
data.tar.gz: 5bf3a7b83a7002f1cc434ce67e2d12090a3fae7e69b1495a36a3225ea111d263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f9c43913d3eca40a7717607ba4f54bf7caab60271533cec7f1d14d121549bd96ca3eda18fc22c107f67f1ea4da98dc3398fe85c28e80d95666d57e6469b294
|
7
|
+
data.tar.gz: c6610e125b8d26e9f4423f68d0fe0bd6087f870dcf28ebbc6b2dc0253a1dfbfecd24b6bed4095627b5bb86b3f5eb370504346d86ce263162f7f6dcb368a2ec5f
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
name: Publish to RubyGems
|
3
|
+
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
tags:
|
7
|
+
- v*
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
id-token: write
|
11
|
+
contents: write
|
12
|
+
|
13
|
+
# see: https://guides.rubygems.org/trusted-publishing/adding-a-publisher/
|
14
|
+
jobs:
|
15
|
+
push:
|
16
|
+
name: Push gem to RubyGems.org
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
# Set up
|
20
|
+
- uses: actions/checkout@v4
|
21
|
+
with:
|
22
|
+
persist-credentials: false
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
bundler-cache: false
|
27
|
+
ruby-version: 3.2
|
28
|
+
- name: Install gem packages
|
29
|
+
run: |
|
30
|
+
gem install bundler
|
31
|
+
bundle config set frozen true
|
32
|
+
bundle install --jobs 4 --retry 3
|
33
|
+
|
34
|
+
# Release
|
35
|
+
- uses: rubygems/release-gem@v1
|
data/.github/workflows/ruby.yml
CHANGED
@@ -8,12 +8,15 @@ jobs:
|
|
8
8
|
build:
|
9
9
|
runs-on: ubuntu-latest
|
10
10
|
strategy:
|
11
|
-
max-parallel:
|
11
|
+
max-parallel: 3
|
12
12
|
matrix:
|
13
|
-
ruby-version:
|
13
|
+
ruby-version:
|
14
|
+
- "3.2"
|
15
|
+
- "3.3"
|
16
|
+
- "3.4"
|
14
17
|
|
15
18
|
steps:
|
16
|
-
- uses: actions/checkout@
|
19
|
+
- uses: actions/checkout@v4
|
17
20
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
18
21
|
uses: ruby/setup-ruby@v1
|
19
22
|
with:
|
@@ -24,6 +27,10 @@ jobs:
|
|
24
27
|
bundle install --jobs 4 --retry 3
|
25
28
|
bundle exec gem dependency -R
|
26
29
|
|
30
|
+
- name: Check coding style
|
31
|
+
run: |
|
32
|
+
bundle exec standardrb
|
33
|
+
|
27
34
|
- name: test with Rake
|
28
35
|
run: |
|
29
36
|
bundle exec rake spec
|
data/.gitignore
CHANGED
data/.standard.yml
ADDED
data/.standard_todo.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
ignore:
|
3
|
+
- lib/presto/metrics/client.rb:
|
4
|
+
- Naming/VariableName
|
5
|
+
- Performance/RedundantSplitRegexpArgument
|
6
|
+
- Performance/StringReplacement
|
7
|
+
- Performance/UriDefaultParser
|
8
|
+
- Style/ClassCheck
|
9
|
+
- Style/ConditionalAssignment
|
10
|
+
- Style/EmptyLiteral
|
11
|
+
- Style/IfInsideElse
|
12
|
+
- Style/PercentLiteralDelimiters # Keep
|
13
|
+
- Style/RedundantBegin
|
14
|
+
- Style/StringLiterals
|
15
|
+
- Style/TrailingCommaInHashLiteral # Keep
|
16
|
+
- lib/presto/metrics/query.rb:
|
17
|
+
- Layout/ArgumentAlignment
|
18
|
+
- Layout/SpaceInsideArrayPercentLiteral # Keep
|
19
|
+
- Layout/SpaceInsidePercentLiteralDelimiters # Keep
|
20
|
+
- Naming/VariableName
|
21
|
+
- Style/ConditionalAssignment
|
22
|
+
- Style/MixinUsage
|
23
|
+
- Style/PercentLiteralDelimiters # Keep
|
24
|
+
- Style/RedundantBegin
|
25
|
+
- Style/StringLiterals
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
presto-metrics (0.6.0)
|
5
|
+
httparty
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.3)
|
11
|
+
bigdecimal (3.2.2)
|
12
|
+
csv (3.3.5)
|
13
|
+
diff-lcs (1.6.2)
|
14
|
+
faraday (0.17.6)
|
15
|
+
multipart-post (>= 1.2, < 3)
|
16
|
+
httparty (0.23.1)
|
17
|
+
csv
|
18
|
+
mini_mime (>= 1.0.0)
|
19
|
+
multi_xml (>= 0.5.2)
|
20
|
+
httpclient (2.9.0)
|
21
|
+
mutex_m
|
22
|
+
json (2.13.2)
|
23
|
+
mini_mime (1.1.5)
|
24
|
+
msgpack (1.8.0)
|
25
|
+
multi_xml (0.7.2)
|
26
|
+
bigdecimal (~> 3.1)
|
27
|
+
multipart-post (2.4.1)
|
28
|
+
mutex_m (0.3.0)
|
29
|
+
parallel (1.27.0)
|
30
|
+
parser (3.3.9.0)
|
31
|
+
ast (~> 2.4.1)
|
32
|
+
racc
|
33
|
+
presto-client (0.5.14)
|
34
|
+
faraday (~> 0.12)
|
35
|
+
msgpack (>= 0.7.0)
|
36
|
+
prism (1.4.0)
|
37
|
+
racc (1.8.1)
|
38
|
+
rainbow (3.1.1)
|
39
|
+
rake (13.3.0)
|
40
|
+
regexp_parser (2.11.0)
|
41
|
+
rexml (3.4.1)
|
42
|
+
rspec (3.13.1)
|
43
|
+
rspec-core (~> 3.13.0)
|
44
|
+
rspec-expectations (~> 3.13.0)
|
45
|
+
rspec-mocks (~> 3.13.0)
|
46
|
+
rspec-core (3.13.5)
|
47
|
+
rspec-support (~> 3.13.0)
|
48
|
+
rspec-expectations (3.13.5)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.13.0)
|
51
|
+
rspec-mocks (3.13.5)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.13.0)
|
54
|
+
rspec-support (3.13.4)
|
55
|
+
rubocop (1.35.1)
|
56
|
+
json (~> 2.3)
|
57
|
+
parallel (~> 1.10)
|
58
|
+
parser (>= 3.1.2.1)
|
59
|
+
rainbow (>= 2.2.2, < 4.0)
|
60
|
+
regexp_parser (>= 1.8, < 3.0)
|
61
|
+
rexml (>= 3.2.5, < 4.0)
|
62
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
63
|
+
ruby-progressbar (~> 1.7)
|
64
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
65
|
+
rubocop-ast (1.46.0)
|
66
|
+
parser (>= 3.3.7.2)
|
67
|
+
prism (~> 1.4)
|
68
|
+
rubocop-performance (1.14.3)
|
69
|
+
rubocop (>= 1.7.0, < 2.0)
|
70
|
+
rubocop-ast (>= 0.4.0)
|
71
|
+
ruby-progressbar (1.13.0)
|
72
|
+
standard (1.16.1)
|
73
|
+
rubocop (= 1.35.1)
|
74
|
+
rubocop-performance (= 1.14.3)
|
75
|
+
unicode-display_width (2.6.0)
|
76
|
+
|
77
|
+
PLATFORMS
|
78
|
+
x86_64-darwin-21
|
79
|
+
x86_64-darwin-23
|
80
|
+
x86_64-linux
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler (~> 2.0)
|
84
|
+
httpclient
|
85
|
+
presto-client (~> 0.5.6)
|
86
|
+
presto-metrics!
|
87
|
+
rake (~> 13.0)
|
88
|
+
rspec
|
89
|
+
standard (~> 1.16.0)
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
2.6.2
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Presto
|
2
2
|
module Metrics
|
3
|
-
|
4
3
|
class Client
|
5
|
-
def initialize(opts={})
|
4
|
+
def initialize(opts = {})
|
6
5
|
require 'httparty'
|
7
6
|
require 'json'
|
8
7
|
require 'set'
|
@@ -20,22 +19,22 @@ module Presto
|
|
20
19
|
end
|
21
20
|
|
22
21
|
@@MBEAN_ALIAS = {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
22
|
+
'memory' => 'java.lang:type=Memory',
|
23
|
+
'gc_cms' => 'java.lang:type=GarbageCollector,name=ConcurrentMarkSweep',
|
24
|
+
'gc_parnew' => 'java.lang:type=GarbageCollector,name=ParNew',
|
25
|
+
'os' => 'java.lang:type=OperatingSystem',
|
26
|
+
'query_manager' => 'presto.execution:name=QueryManager',
|
27
|
+
'query_execution' => 'presto.execution:name=QueryExecution',
|
28
|
+
'split_scheduler_stats' => 'presto.execution.scheduler:name=SplitSchedulerStats',
|
29
|
+
'task_executor' => 'presto.execution.executor:name=TaskExecutor',
|
30
|
+
'task_manager' => 'presto.execution:name=TaskManager',
|
31
|
+
'memory_pool_general' => 'presto.memory:type=MemoryPool,name=general',
|
32
|
+
'memory_pool_reserved' => 'presto.memory:type=MemoryPool,name=reserved',
|
33
|
+
'cluster_memory_manager' => 'presto.memory:name=ClusterMemoryManager',
|
34
|
+
'cluster_memory_pool_general' => 'presto.memory:type=ClusterMemoryPool,name=general',
|
35
|
+
'cluster_memory_pool_reserved' => 'presto.memory:type=ClusterMemoryPool,name=reserved',
|
36
|
+
'discovery_node_manager' => 'presto.metadata:name=DiscoveryNodeManager',
|
37
|
+
'pause_meter' => 'io.airlift.stats:name=PauseMeter',
|
39
38
|
}
|
40
39
|
|
41
40
|
def path(path)
|
@@ -64,9 +63,9 @@ module Presto
|
|
64
63
|
value = json_obj.find { |e|
|
65
64
|
e.is_a?(Hash) && e['key'] == path[depth]
|
66
65
|
}
|
67
|
-
extract_path(value['value'], path, depth+1)
|
66
|
+
extract_path(value['value'], path, depth + 1)
|
68
67
|
else
|
69
|
-
extract_path(json_obj[path[depth]], path, depth+1)
|
68
|
+
extract_path(json_obj[path[depth]], path, depth + 1)
|
70
69
|
end
|
71
70
|
end
|
72
71
|
end
|
@@ -79,7 +78,7 @@ module Presto
|
|
79
78
|
JSON.parse(get_mbean_json(mbean))
|
80
79
|
end
|
81
80
|
|
82
|
-
def get(path, default='{}')
|
81
|
+
def get(path, default = '{}')
|
83
82
|
parser = URI::Parser.new
|
84
83
|
resp = HTTParty.get(parser.escape("#{@endpoint}#{path}"), headers: @headers)
|
85
84
|
if resp.code == 200
|
@@ -93,7 +92,7 @@ module Presto
|
|
93
92
|
get("#{@mbean_path}/#{mbean}")
|
94
93
|
end
|
95
94
|
|
96
|
-
def get_query_json(path='', default='[]')
|
95
|
+
def get_query_json(path = '', default = '[]')
|
97
96
|
get("#{@query_path}/#{path}", default)
|
98
97
|
end
|
99
98
|
|
@@ -119,21 +118,21 @@ module Presto
|
|
119
118
|
end
|
120
119
|
|
121
120
|
def underscore(str)
|
122
|
-
str.gsub(/::/, '/')
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
str.gsub(/::/, '/')
|
122
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
123
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
124
|
+
.gsub(/ +/, '_')
|
125
|
+
.tr('-', '_')
|
126
|
+
.downcase
|
128
127
|
end
|
129
128
|
|
130
|
-
def get_metrics(mbean, target_attr=[])
|
129
|
+
def get_metrics(mbean, target_attr = [])
|
131
130
|
kv = Hash.new
|
132
131
|
arr = target_attr.kind_of?(Array) ? target_attr : [target_attr]
|
133
132
|
c_target_attr = map_to_canonical_name(arr).to_set
|
134
133
|
get_attributes(mbean)
|
135
|
-
|
136
|
-
|
134
|
+
.reject { |attr| attr['name'].nil? || attr['value'].nil? }
|
135
|
+
.each { |attr|
|
137
136
|
c_name = to_canonical_name(attr['name'])
|
138
137
|
if c_target_attr.empty? || c_target_attr.include?(c_name)
|
139
138
|
key = @caml_case ? attr['name'] : underscore(attr['name'])
|
@@ -150,24 +149,24 @@ module Presto
|
|
150
149
|
def extract_value(v)
|
151
150
|
if v.is_a?(Hash)
|
152
151
|
if v.has_key?('key') && v.has_key?('value')
|
153
|
-
{sanitize_key(v['key']) => extract_value(v['value'])
|
152
|
+
{sanitize_key(v['key']) => extract_value(v['value'])}
|
154
153
|
else
|
155
|
-
v.each_with_object({}) {|(k1, v1), h2|
|
154
|
+
v.each_with_object({}) { |(k1, v1), h2|
|
156
155
|
h2[sanitize_key(k1)] = extract_value(v1)
|
157
156
|
}
|
158
157
|
end
|
159
|
-
elsif v.is_a?(Array) && v.all?{|e| e.is_a?(Hash) }
|
160
|
-
v.each_with_object({}){|e, h| h.merge!(extract_value(e)) }
|
158
|
+
elsif v.is_a?(Array) && v.all? { |e| e.is_a?(Hash) }
|
159
|
+
v.each_with_object({}) { |e, h| h.merge!(extract_value(e)) }
|
161
160
|
else
|
162
161
|
v
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
166
|
-
def get_gc_metrics(mbean, target_attr=[])
|
165
|
+
def get_gc_metrics(mbean, target_attr = [])
|
167
166
|
h = {}
|
168
167
|
get_attributes(mbean)
|
169
|
-
|
170
|
-
|
168
|
+
.reject { |attr| attr['name'].nil? || attr['value'].nil? }
|
169
|
+
.each { |attr|
|
171
170
|
key = sanitize_key(attr['name'])
|
172
171
|
v = attr['value']
|
173
172
|
h[key] = extract_value(v)
|
@@ -175,74 +174,72 @@ module Presto
|
|
175
174
|
h
|
176
175
|
end
|
177
176
|
|
178
|
-
|
179
|
-
def memory_usage_metrics(target_attr=[])
|
177
|
+
def memory_usage_metrics(target_attr = [])
|
180
178
|
get_metrics('java.lang:type=Memory', target_attr)
|
181
179
|
end
|
182
180
|
|
183
|
-
def gc_cms_metrics(target_attr=[])
|
181
|
+
def gc_cms_metrics(target_attr = [])
|
184
182
|
get_gc_metrics('java.lang:type=GarbageCollector,name=ConcurrentMarkSweep', target_attr)
|
185
183
|
end
|
186
184
|
|
187
|
-
def gc_parnew_metrics(target_attr=[])
|
185
|
+
def gc_parnew_metrics(target_attr = [])
|
188
186
|
get_gc_metrics('java.lang:type=GarbageCollector,name=ParNew', target_attr)
|
189
187
|
end
|
190
188
|
|
191
|
-
def gc_g1_metrics(target_attr=[])
|
192
|
-
['G1 Old Generation', 'G1 Young Generation'].each_with_object({}){|gen, h|
|
189
|
+
def gc_g1_metrics(target_attr = [])
|
190
|
+
['G1 Old Generation', 'G1 Young Generation'].each_with_object({}) { |gen, h|
|
193
191
|
h[sanitize_key(gen)] = get_gc_metrics("java.lang:type=GarbageCollector,name=#{gen}", target_attr)
|
194
192
|
}
|
195
193
|
end
|
196
194
|
|
197
|
-
def os_metrics(target_attr=[])
|
195
|
+
def os_metrics(target_attr = [])
|
198
196
|
get_metrics('java.lang:type=OperatingSystem', target_attr)
|
199
197
|
end
|
200
198
|
|
201
|
-
def query_manager_metrics(target_attr=[])
|
199
|
+
def query_manager_metrics(target_attr = [])
|
202
200
|
get_metrics('presto.execution:name=QueryManager', target_attr)
|
203
201
|
end
|
204
202
|
|
205
|
-
def query_execution_metrics(target_attr=[])
|
203
|
+
def query_execution_metrics(target_attr = [])
|
206
204
|
get_metrics('presto.execution:name=QueryExecution', target_attr)
|
207
205
|
end
|
208
206
|
|
209
|
-
def node_scheduler_metrics(target_attr=[])
|
207
|
+
def node_scheduler_metrics(target_attr = [])
|
210
208
|
get_metrics('presto.execution:name=NodeScheduler', target_attr)
|
211
209
|
end
|
212
210
|
|
213
|
-
def task_executor_metrics(target_attr=[])
|
211
|
+
def task_executor_metrics(target_attr = [])
|
214
212
|
get_metrics('presto.execution:name=TaskExecutor', target_attr)
|
215
213
|
end
|
216
214
|
|
217
|
-
def task_manager_metrics(target_attr=[])
|
215
|
+
def task_manager_metrics(target_attr = [])
|
218
216
|
get_metrics('presto.execution:name=TaskManager', target_attr)
|
219
217
|
end
|
220
218
|
|
221
|
-
def memory_pool_metrics(target_attr=[])
|
222
|
-
['general', 'reserved'].each_with_object({}) {|type, hash|
|
219
|
+
def memory_pool_metrics(target_attr = [])
|
220
|
+
['general', 'reserved'].each_with_object({}) { |type, hash|
|
223
221
|
hash[type] = get_metrics("presto.memory:type=MemoryPool,name=#{type}", target_attr)
|
224
222
|
}
|
225
223
|
end
|
226
224
|
|
227
|
-
def cluster_memory_pool_metrics(target_attr=[])
|
228
|
-
['general', 'reserved'].each_with_object({}) {|type, hash|
|
225
|
+
def cluster_memory_pool_metrics(target_attr = [])
|
226
|
+
['general', 'reserved'].each_with_object({}) { |type, hash|
|
229
227
|
hash[type] = get_metrics("presto.memory:type=ClusterMemoryPool,name=#{type}", target_attr)
|
230
228
|
}
|
231
229
|
end
|
232
230
|
|
233
|
-
def cluster_memory_manager_metrics(target_attr=[])
|
231
|
+
def cluster_memory_manager_metrics(target_attr = [])
|
234
232
|
get_metrics("presto.memory:name=ClusterMemoryManager", target_attr)
|
235
233
|
end
|
236
234
|
|
237
|
-
|
238
|
-
def node_metrics(target_attr=[])
|
235
|
+
def node_metrics(target_attr = [])
|
239
236
|
p = URI::Parser.new
|
240
237
|
node_state = JSON.parse(get_node_json)
|
241
|
-
node_state.map{|n|
|
238
|
+
node_state.map { |n|
|
242
239
|
uri = n['uri'] || ''
|
243
240
|
m = {}
|
244
241
|
m['host'] = p.parse(uri).host
|
245
|
-
n.each{|k, v|
|
242
|
+
n.each { |k, v|
|
246
243
|
key = @caml_case ? k : underscore(k)
|
247
244
|
m[key] = v
|
248
245
|
}
|
data/lib/presto/metrics/query.rb
CHANGED
@@ -8,7 +8,6 @@ include Presto::Client::Models
|
|
8
8
|
|
9
9
|
module Presto
|
10
10
|
module Metrics
|
11
|
-
|
12
11
|
class Query
|
13
12
|
def initialize(client)
|
14
13
|
@client = client
|
@@ -38,12 +37,12 @@ module Presto
|
|
38
37
|
str = cell.to_s[0..col[i]]
|
39
38
|
a = align[i] || 'l'
|
40
39
|
case a
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
when 'r'
|
41
|
+
line << str.rjust(col[i])
|
42
|
+
when 'l'
|
43
|
+
line << str.ljust(col[i])
|
44
|
+
else
|
45
|
+
line << str.ljust(col[i])
|
47
46
|
end
|
48
47
|
}
|
49
48
|
puts line.join(sep)
|
@@ -62,8 +61,7 @@ module Presto
|
|
62
61
|
format_table(tbl,
|
63
62
|
%w|query time state r f t user catalog schema source sql|,
|
64
63
|
%w|r r r r r r l l r l l |,
|
65
|
-
' '
|
66
|
-
)
|
64
|
+
' ')
|
67
65
|
end
|
68
66
|
|
69
67
|
def find(queryId)
|
@@ -92,11 +90,10 @@ module Presto
|
|
92
90
|
format_table(stats,
|
93
91
|
%w|task_id host state processed_rows size|,
|
94
92
|
%w|l l l r r|,
|
95
|
-
' '
|
96
|
-
)
|
93
|
+
' ')
|
97
94
|
end
|
98
95
|
|
99
|
-
def query_list(path="")
|
96
|
+
def query_list(path = "")
|
100
97
|
begin
|
101
98
|
JSON.parse(@client.get_query_json(path))
|
102
99
|
rescue
|
@@ -154,9 +151,9 @@ module Presto
|
|
154
151
|
h['elapsed_time'] = stats['elapsedTime'] || '0.0m'
|
155
152
|
h['create_time'] = stats['createTime']
|
156
153
|
h['running_time'] = stats['endTime'] || Time.now.utc.iso8601(3) # end_time ?
|
157
|
-
#if(h['state'] == "FAILED")
|
154
|
+
# if(h['state'] == "FAILED")
|
158
155
|
# h['errorCode'] = find(h['query_id'])['errorCode'] || {}
|
159
|
-
#end
|
156
|
+
# end
|
160
157
|
h
|
161
158
|
}
|
162
159
|
end
|
@@ -169,9 +166,8 @@ module Presto
|
|
169
166
|
task_list << tl if tl
|
170
167
|
task_list << find_tasks(ss['subStages'])
|
171
168
|
}
|
172
|
-
task_list.flatten
|
169
|
+
task_list.flatten
|
173
170
|
end
|
174
|
-
|
175
171
|
end
|
176
172
|
end
|
177
173
|
end
|
data/lib/presto/metrics.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "presto/metrics/version"
|
2
|
+
require "presto/metrics/client"
|
3
|
+
require "presto/metrics/query"
|
data/presto-metrics.gemspec
CHANGED
@@ -18,11 +18,18 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = ">= 3.2.0"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 2.0"
|
22
|
-
spec.add_development_dependency "rake", "~>
|
24
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
23
25
|
spec.add_development_dependency "rspec"
|
24
26
|
spec.add_development_dependency "presto-client", '~> 0.5.6'
|
25
27
|
spec.add_development_dependency "httpclient"
|
28
|
+
spec.add_development_dependency "standard", ["~> 1.16.0"]
|
29
|
+
|
30
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4")
|
31
|
+
spec.add_dependency("base64")
|
32
|
+
end
|
26
33
|
|
27
34
|
spec.add_runtime_dependency "httparty"
|
28
35
|
|
data/spec/presto/metrics_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Presto::Metrics do
|
4
|
-
it
|
4
|
+
it "has a version number" do
|
5
5
|
expect(Presto::Metrics::VERSION).not_to be nil
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
8
|
+
it "does something useful" do
|
9
9
|
expect(true).to eq(true)
|
10
10
|
end
|
11
11
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path(
|
2
|
-
require
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "presto/metrics"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presto-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taro L. Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.16.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.16.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: httparty
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,11 +117,15 @@ extensions: []
|
|
103
117
|
extra_rdoc_files: []
|
104
118
|
files:
|
105
119
|
- ".github/release-drafter.yml"
|
120
|
+
- ".github/workflows/publisher.yml"
|
106
121
|
- ".github/workflows/release-drafter.yml"
|
107
122
|
- ".github/workflows/ruby.yml"
|
108
123
|
- ".gitignore"
|
109
124
|
- ".rspec"
|
125
|
+
- ".standard.yml"
|
126
|
+
- ".standard_todo.yml"
|
110
127
|
- Gemfile
|
128
|
+
- Gemfile.lock
|
111
129
|
- LICENSE.txt
|
112
130
|
- README.md
|
113
131
|
- Rakefile
|
@@ -130,14 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
148
|
requirements:
|
131
149
|
- - ">="
|
132
150
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
151
|
+
version: 3.2.0
|
134
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
153
|
requirements:
|
136
154
|
- - ">="
|
137
155
|
- !ruby/object:Gem::Version
|
138
156
|
version: '0'
|
139
157
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
158
|
+
rubygems_version: 3.4.19
|
141
159
|
signing_key:
|
142
160
|
specification_version: 4
|
143
161
|
summary: A library for collecting metrics of Presto, a distributed SQL engine
|