wavefront-cli 8.0.0 → 8.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +17 -0
- data/lib/wavefront-cli/commands/proxy.rb +1 -0
- data/lib/wavefront-cli/controller.rb +9 -0
- data/lib/wavefront-cli/display/base.rb +3 -1
- data/lib/wavefront-cli/display/printer/long.rb +4 -1
- data/lib/wavefront-cli/display/proxy.rb +4 -0
- data/lib/wavefront-cli/display/query.rb +40 -0
- data/lib/wavefront-cli/opt_handler.rb +3 -1
- data/lib/wavefront-cli/proxy.rb +4 -0
- data/lib/wavefront-cli/version.rb +1 -1
- data/spec/wavefront-cli/display/printer/long_spec.rb +2 -0
- data/spec/wavefront-cli/proxy_spec.rb +13 -0
- data/wavefront-cli.gemspec +3 -3
- metadata +8 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ba5b0aba22a6accce6dd6a358475e3448ef622427f214988b5d4c429e8c9cd
|
4
|
+
data.tar.gz: 79d5f15ad335b51d5fee272e2d2fcc33fb39be82e137c1ca61aaa192a60e8dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196d004fce9ac78d43f18613d465f49055fb9203a24149e5c6a4a78e8c4b9c3af10be2b1aca51addc7c758a15f6475f2adf0aad510013a27cd59d9525972a295
|
7
|
+
data.tar.gz: 576541375e557c8787bf85a3ecd672291c2ec5c20e8be5ab3f5a3295a6be3bede4158ae0cb1698660d6f7dac58d03af4af911dd55e8e99ac8a6875a19b222693
|
data/HISTORY.md
CHANGED
@@ -1,7 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 8.3.1 (2020-11-17)
|
4
|
+
* Catch ctrl-c properly.
|
5
|
+
|
6
|
+
## 8.3.0 (2020-10-31)
|
7
|
+
* Add `wf proxy shutdown` command.
|
8
|
+
|
9
|
+
## 8.2.0 (2020-10-06)
|
10
|
+
* Display spans in human-readable query output.
|
11
|
+
|
12
|
+
## 8.1.0 (2020-10-04)
|
13
|
+
* Display traces in human-readable query output.
|
14
|
+
|
15
|
+
## 8.0.1 (2020-09-28)
|
16
|
+
* If the user specifies a config stanza and it is not found, exit with an
|
17
|
+
error rather than silently falling back to env vars.
|
18
|
+
|
3
19
|
## 8.0.0 (2020-09-20
|
4
20
|
* Drop Ruby 2.4.0 support. (Breaking change.)
|
21
|
+
>>>>>>> master
|
5
22
|
|
6
23
|
## 7.2.0 (2020-08-12)
|
7
24
|
* Add `cloudintegration awsid generate` command.
|
@@ -39,6 +39,15 @@ class WavefrontCliController
|
|
39
39
|
@opts = parse_opts(opts)
|
40
40
|
cli_class_obj = cli_class(cmd, @opts)
|
41
41
|
run_command(cli_class_obj)
|
42
|
+
rescue Interrupt
|
43
|
+
handle_interrupt!
|
44
|
+
end
|
45
|
+
|
46
|
+
def handle_interrupt!
|
47
|
+
raise if opts[:debug]
|
48
|
+
|
49
|
+
puts "\nCancelled at user's request."
|
50
|
+
exit 0
|
42
51
|
end
|
43
52
|
|
44
53
|
# What you see when you do 'wf --help'
|
@@ -33,6 +33,7 @@ module WavefrontDisplay
|
|
33
33
|
|
34
34
|
@data = prioritize_keys(data, priority_keys)
|
35
35
|
@options = options
|
36
|
+
@printer_opts = {}
|
36
37
|
end
|
37
38
|
|
38
39
|
# find the correct method to deal with the output of the user's
|
@@ -152,7 +153,8 @@ module WavefrontDisplay
|
|
152
153
|
puts 'No data.'
|
153
154
|
else
|
154
155
|
require_relative 'printer/long'
|
155
|
-
puts WavefrontDisplayPrinter::Long.new(data, fields, modified_data
|
156
|
+
puts WavefrontDisplayPrinter::Long.new(data, fields, modified_data,
|
157
|
+
@printer_opts)
|
156
158
|
pagination_line
|
157
159
|
end
|
158
160
|
end
|
@@ -29,11 +29,13 @@ module WavefrontDisplayPrinter
|
|
29
29
|
|
30
30
|
# Default options. Can all be overridden by passing them in the
|
31
31
|
# initializer options hash.
|
32
|
+
# After sep_depth indentations we do not print separator lines
|
32
33
|
#
|
33
34
|
def default_opts
|
34
35
|
{ indent: 2,
|
35
36
|
padding: 2,
|
36
37
|
separator: true,
|
38
|
+
sep_depth: 3,
|
37
39
|
none: true }
|
38
40
|
end
|
39
41
|
|
@@ -179,7 +181,8 @@ module WavefrontDisplayPrinter
|
|
179
181
|
data.each.with_index(1) do |element, i|
|
180
182
|
aggr = make_list(element, aggr, depth, last_key)
|
181
183
|
|
182
|
-
if opts[:separator] && element.is_a?(Hash) && i < data.size
|
184
|
+
if opts[:separator] && element.is_a?(Hash) && i < data.size &&
|
185
|
+
depth < opts[:sep_depth]
|
183
186
|
aggr.<< ['', :separator, depth]
|
184
187
|
end
|
185
188
|
end
|
@@ -16,14 +16,18 @@ module WavefrontDisplay
|
|
16
16
|
data[:errorMessage].split("\n").first)
|
17
17
|
end
|
18
18
|
|
19
|
+
# rubocop:disable Metrics/AbcSize
|
19
20
|
def default_data_object
|
20
21
|
{ name: data.name,
|
21
22
|
query: data.query,
|
22
23
|
timeseries: mk_timeseries(data),
|
24
|
+
traces: mk_traces(data),
|
25
|
+
spans: mk_spans(data),
|
23
26
|
events: mk_events(data) }.tap do |d|
|
24
27
|
d[:warnings] = data[:warnings] if show_warnings?
|
25
28
|
end
|
26
29
|
end
|
30
|
+
# rubocop:enable Metrics/AbcSize
|
27
31
|
|
28
32
|
def show_warnings?
|
29
33
|
data.key?(:warnings) && !options[:nowarn]
|
@@ -54,6 +58,18 @@ module WavefrontDisplay
|
|
54
58
|
data[:events].map { |s| humanize_event(s) }
|
55
59
|
end
|
56
60
|
|
61
|
+
def mk_traces(data)
|
62
|
+
return [] unless data.key?(:traces)
|
63
|
+
|
64
|
+
data[:traces].map { |t| humanize_trace(t) }
|
65
|
+
end
|
66
|
+
|
67
|
+
def mk_spans(data)
|
68
|
+
return [] unless data.key?(:spans)
|
69
|
+
|
70
|
+
data[:spans].map { |t| humanize_span(t) }
|
71
|
+
end
|
72
|
+
|
57
73
|
def do_run
|
58
74
|
do_default
|
59
75
|
end
|
@@ -99,6 +115,30 @@ module WavefrontDisplay
|
|
99
115
|
end
|
100
116
|
end
|
101
117
|
|
118
|
+
def humanize_trace(data)
|
119
|
+
@printer_opts[:sep_depth] = 3
|
120
|
+
|
121
|
+
data.tap do |t|
|
122
|
+
t[:start] = human_time(t[:start_ms])
|
123
|
+
t[:end] = human_time(t[:end_ms])
|
124
|
+
t.delete(:start_ms)
|
125
|
+
t.delete(:end_ms)
|
126
|
+
t.delete(:startMs)
|
127
|
+
t.spans = t.spans.map { |s| humanize_trace_span(s) }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def humanize_span(data)
|
132
|
+
@printer_opts[:sep_depth] = 2
|
133
|
+
data
|
134
|
+
end
|
135
|
+
|
136
|
+
def humanize_trace_span(span)
|
137
|
+
span.tap do |s|
|
138
|
+
s[:startMs] = human_time(s[:startMs])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
102
142
|
def row_time_and_val(row)
|
103
143
|
if row.is_a?(Hash)
|
104
144
|
[human_time(row[:timestamp]), row[:value]]
|
@@ -35,6 +35,8 @@ module WavefrontCli
|
|
35
35
|
abort "Configuration file '#{e}' not found."
|
36
36
|
rescue Wavefront::Exception::InvalidConfigFile => e
|
37
37
|
abort "Could not load configuration file '#{e.message}'."
|
38
|
+
rescue Wavefront::Exception::MissingConfigProfile => e
|
39
|
+
abort "Cannot find profile '#{e}'."
|
38
40
|
end
|
39
41
|
|
40
42
|
# Create an options hash to pass to the Wavefront::Credentials
|
@@ -45,7 +47,7 @@ module WavefrontCli
|
|
45
47
|
# :profile
|
46
48
|
#
|
47
49
|
def setup_cred_opts(cli_opts)
|
48
|
-
cred_opts = {}
|
50
|
+
cred_opts = { raise_on_no_profile: true }
|
49
51
|
|
50
52
|
if cli_opts[:config]
|
51
53
|
cred_opts[:file] = Pathname.new(cli_opts[:config])
|
data/lib/wavefront-cli/proxy.rb
CHANGED
@@ -32,6 +32,10 @@ module WavefrontCli
|
|
32
32
|
version_info(raw).sort_by { |p| Gem::Version.new(p[:version]) }.reverse
|
33
33
|
end
|
34
34
|
|
35
|
+
def do_shutdown
|
36
|
+
wf.shutdown(options[:'<id>'])
|
37
|
+
end
|
38
|
+
|
35
39
|
def version_info(raw)
|
36
40
|
raw.response.items.map do |i|
|
37
41
|
{ id: i.id, version: i.version, name: i.name }
|
@@ -52,12 +52,14 @@ class TestWavefrontDisplayPrinterLong < MiniTest::Test
|
|
52
52
|
assert_equal({ indent: 4,
|
53
53
|
padding: 3,
|
54
54
|
separator: true,
|
55
|
+
sep_depth: 3,
|
55
56
|
none: true }, pr.opts)
|
56
57
|
|
57
58
|
pr = WavefrontDisplayPrinter::Long.new({}, nil, nil, none: false)
|
58
59
|
assert_equal({ indent: 2,
|
59
60
|
padding: 2,
|
60
61
|
separator: true,
|
62
|
+
sep_depth: 3,
|
61
63
|
none: false }, pr.opts)
|
62
64
|
end
|
63
65
|
|
@@ -36,6 +36,19 @@ class ProxyEndToEndTest < EndToEndTest
|
|
36
36
|
assert_abort_on_missing_creds("rename #{id} newname")
|
37
37
|
end
|
38
38
|
|
39
|
+
def test_shutdown
|
40
|
+
assert_output("Requested shutdown of proxy '#{id}'.\n") do
|
41
|
+
assert_cmd_puts("shutdown #{id}", "/api/v2/proxy/#{id}",
|
42
|
+
{ shutdown: true }.to_json)
|
43
|
+
end
|
44
|
+
|
45
|
+
assert_noop("shutdown #{id}",
|
46
|
+
"uri: PUT https://default.wavefront.com/api/v2/proxy/#{id}",
|
47
|
+
'body: {"shutdown":true}')
|
48
|
+
assert_invalid_id("shutdown #{invalid_id}")
|
49
|
+
assert_abort_on_missing_creds("shutdown #{id}")
|
50
|
+
end
|
51
|
+
|
39
52
|
private
|
40
53
|
|
41
54
|
def id
|
data/wavefront-cli.gemspec
CHANGED
@@ -26,13 +26,13 @@ Gem::Specification.new do |gem|
|
|
26
26
|
|
27
27
|
gem.add_runtime_dependency 'docopt', '~> 0.6.0'
|
28
28
|
gem.add_runtime_dependency 'inifile', '~> 3.0'
|
29
|
-
gem.add_runtime_dependency 'wavefront-sdk', '~> 5.
|
29
|
+
gem.add_runtime_dependency 'wavefront-sdk', '~> 5.3'
|
30
30
|
|
31
|
-
gem.add_development_dependency 'minitest', '~> 5.
|
31
|
+
gem.add_development_dependency 'minitest', '~> 5.14'
|
32
32
|
gem.add_development_dependency 'rake', '~> 13.0'
|
33
33
|
gem.add_development_dependency 'rubocop', '0.91.0'
|
34
34
|
gem.add_development_dependency 'spy', '~> 1.0.0'
|
35
|
-
gem.add_development_dependency 'webmock', '~> 3.
|
35
|
+
gem.add_development_dependency 'webmock', '~> 3.8'
|
36
36
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
37
37
|
|
38
38
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -44,34 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 5.11.0
|
62
59
|
- - "~>"
|
63
60
|
- !ruby/object:Gem::Version
|
64
|
-
version: '5.
|
61
|
+
version: '5.14'
|
65
62
|
type: :development
|
66
63
|
prerelease: false
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
68
65
|
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 5.11.0
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '5.
|
68
|
+
version: '5.14'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
70
|
name: rake
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +114,14 @@ dependencies:
|
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version: '3.
|
117
|
+
version: '3.8'
|
124
118
|
type: :development
|
125
119
|
prerelease: false
|
126
120
|
version_requirements: !ruby/object:Gem::Requirement
|
127
121
|
requirements:
|
128
122
|
- - "~>"
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
version: '3.
|
124
|
+
version: '3.8'
|
131
125
|
- !ruby/object:Gem::Dependency
|
132
126
|
name: yard
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|