wavefront-cli 4.6.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/HISTORY.md +7 -0
- data/README.md +3 -1
- data/lib/wavefront-cli/base.rb +11 -3
- data/lib/wavefront-cli/commands/cluster.rb +43 -0
- data/lib/wavefront-cli/commands/metric.rb +10 -1
- data/lib/wavefront-cli/commands/spy.rb +42 -0
- data/lib/wavefront-cli/controller.rb +4 -0
- data/lib/wavefront-cli/display/metric.rb +8 -0
- data/lib/wavefront-cli/display/monitoredcluster.rb +14 -0
- data/lib/wavefront-cli/display/spy.rb +19 -0
- data/lib/wavefront-cli/metric.rb +17 -1
- data/lib/wavefront-cli/monitoredcluster.rb +50 -0
- data/lib/wavefront-cli/spy.rb +70 -0
- data/lib/wavefront-cli/version.rb +1 -1
- data/spec/wavefront-cli/monitoredcluster_spec.rb +85 -0
- data/spec/wavefront-cli/spy_spec.rb +82 -0
- data/wavefront-cli.gemspec +2 -2
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b9b30b77aba2b30466497242b0d6158a9d151a061d4be80066e5d2eaa47832d
|
4
|
+
data.tar.gz: 9bace696eed2533b302f5677034e3d32f5f9a82566a63ccf1b2eee0cf5ab2c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 355cf87d1399ee0e9e2f12034cc099f73388007ca59fe233aff4ab2e152f3ee1d617f7211008d39e650bf6bd572e7ddd347034d2732999f4b9dbd97faf494e36
|
7
|
+
data.tar.gz: 63583fe1ad4384bcef66e4f3aff00682fc414c60ee1e4ef6175f4d37df939ac05d6c6773ee0b493cc27b30440968f984429e06bcec412184065d3ffaa4d520fd
|
data/.travis.yml
CHANGED
data/HISTORY.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.0.0 (2020-02-17)
|
4
|
+
* Remove support for Ruby 2.3. (Potentially breaking change.)
|
5
|
+
* Add `cluster` command to manage monitored clusters.
|
6
|
+
* Add `spy` command to speak to (unstable) `spy` API.
|
7
|
+
* Add `metric list` sub-commands to speak to (unstable) `metric` API.
|
8
|
+
* Require 4.0.0 of [the SDK](https://github.com/snltd/wavefront-sdk).
|
9
|
+
|
3
10
|
## 4.6.1 (2020-02-09)
|
4
11
|
* Fix bug which broke reporting of points sent via a proxy.
|
5
12
|
* Require 3.7.1 of [the SDK](https://github.com/snltd/wavefront-sdk).
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ $ gem install wavefront-cli
|
|
15
15
|
|
16
16
|
It is built on [our Wavefront Ruby
|
17
17
|
SDK](https://github.com/snltd/wavefront-sdk) and requires Ruby >=
|
18
|
-
2.
|
18
|
+
2.4. It has no "native extension" dependencies.
|
19
19
|
|
20
20
|
For a far more comprehensive overview/tutorial, please read [this
|
21
21
|
article](https://sysdef.xyz/article/wavefront-cli).
|
@@ -33,6 +33,7 @@ Commands:
|
|
33
33
|
alert view and manage alerts
|
34
34
|
apitoken view and your own API tokens
|
35
35
|
cloudintegration view and manage cloud integrations
|
36
|
+
cluster view and manage monitored clusters
|
36
37
|
config create and manage local configuration
|
37
38
|
dashboard view and manage dashboards
|
38
39
|
derivedmetric view and manage derived metrics
|
@@ -49,6 +50,7 @@ Commands:
|
|
49
50
|
serviceaccount view and manage service accounts
|
50
51
|
settings view and manage system preferences
|
51
52
|
source view and manage source tags and descriptions
|
53
|
+
spy monitor traffic going into Wavefront
|
52
54
|
usage view and manage usage reports
|
53
55
|
user view and manage Wavefront users
|
54
56
|
usergroup view and manage Wavefront user groups
|
data/lib/wavefront-cli/base.rb
CHANGED
@@ -35,12 +35,16 @@ module WavefrontCli
|
|
35
35
|
|
36
36
|
options_and_exit if options[:help]
|
37
37
|
|
38
|
-
|
38
|
+
require_sdk_class
|
39
39
|
@klass = Object.const_get(sdk_class)
|
40
40
|
|
41
41
|
send(:post_initialize, options) if respond_to?(:post_initialize)
|
42
42
|
end
|
43
43
|
|
44
|
+
def require_sdk_class
|
45
|
+
require File.join('wavefront-sdk', @klass_word)
|
46
|
+
end
|
47
|
+
|
44
48
|
# Normally we map the class name to a similar one in the SDK.
|
45
49
|
# Overriding his method lets you map to something else.
|
46
50
|
#
|
@@ -266,7 +270,7 @@ module WavefrontCli
|
|
266
270
|
end
|
267
271
|
|
268
272
|
def warning_message(status)
|
269
|
-
return unless status.
|
273
|
+
return unless status.code.between?(201, 299)
|
270
274
|
|
271
275
|
puts format("API WARNING: '%<message>s'.", message: status.message)
|
272
276
|
end
|
@@ -322,7 +326,11 @@ module WavefrontCli
|
|
322
326
|
|
323
327
|
def load_display_class
|
324
328
|
require_relative File.join('display', klass_word)
|
325
|
-
Object.const_get(
|
329
|
+
Object.const_get(display_class)
|
330
|
+
end
|
331
|
+
|
332
|
+
def display_class
|
333
|
+
klass.name.sub('Wavefront', 'WavefrontDisplay')
|
326
334
|
end
|
327
335
|
|
328
336
|
# There are things we need to have. If we don't have them, stop
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
# Define the monitored cluster command.
|
6
|
+
#
|
7
|
+
class WavefrontCommandCluster < WavefrontCommandBase
|
8
|
+
def thing
|
9
|
+
'monitored cluster'
|
10
|
+
end
|
11
|
+
|
12
|
+
def sdk_file
|
13
|
+
'monitoredcluster'
|
14
|
+
end
|
15
|
+
|
16
|
+
def sdk_class
|
17
|
+
'MonitoredCluster'
|
18
|
+
end
|
19
|
+
|
20
|
+
def _commands
|
21
|
+
["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
|
22
|
+
"describe #{CMN} <id>",
|
23
|
+
"delete #{CMN} <id>",
|
24
|
+
"create #{CMN} [-v version] <platform> <name> <id>",
|
25
|
+
"dump #{CMN}",
|
26
|
+
"import #{CMN} [-u] <file>",
|
27
|
+
"set #{CMN} <key=value> <id>",
|
28
|
+
tag_commands,
|
29
|
+
"search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>...",
|
30
|
+
"merge #{CMN} <id_to> <id_from>"]
|
31
|
+
end
|
32
|
+
|
33
|
+
def _options
|
34
|
+
[common_options,
|
35
|
+
"-l, --long list #{things} in detail",
|
36
|
+
"-a, --all list all #{things}",
|
37
|
+
"-o, --offset=n start from nth #{thing}",
|
38
|
+
'-O, --fields=F1,F2,... only show given fields',
|
39
|
+
"-L, --limit=COUNT number of #{things} to list",
|
40
|
+
"-u, --update update an existing #{thing}",
|
41
|
+
"-v, --version=VERSION version of #{thing}"]
|
42
|
+
end
|
43
|
+
end
|
@@ -10,7 +10,9 @@ class WavefrontCommandMetric < WavefrontCommandBase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def _commands
|
13
|
-
["describe #{CMN} [-o offset] [-g glob...] <metric>"
|
13
|
+
["describe #{CMN} [-o offset] [-g glob...] <metric>",
|
14
|
+
"list under #{CMN} <metric>",
|
15
|
+
"list all #{CMN}"]
|
14
16
|
end
|
15
17
|
|
16
18
|
def _options
|
@@ -18,4 +20,11 @@ class WavefrontCommandMetric < WavefrontCommandBase
|
|
18
20
|
'-o, --offset=STRING value to start from if results > 1000',
|
19
21
|
'-g, --glob=STRING return sources matching this pattern']
|
20
22
|
end
|
23
|
+
|
24
|
+
def postscript
|
25
|
+
"\nNOTE: the 'list under' and 'list all' sub-commands use the unoffical " \
|
26
|
+
"'chart' endpoint, which is not guaranteed to remain stable.\n\n" \
|
27
|
+
'Both commands have to make a lot of API calls, and may take a ' \
|
28
|
+
'very long time to run.'.cmd_fold(TW, 0)
|
29
|
+
end
|
21
30
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
# Define the spy command.
|
6
|
+
#
|
7
|
+
class WavefrontCommandSpy < WavefrontCommandBase
|
8
|
+
def description
|
9
|
+
'monitor traffic going into Wavefront'
|
10
|
+
end
|
11
|
+
|
12
|
+
def _common_opts
|
13
|
+
"#{CMN} [-e timeout] [-p prefix] [-r rate] [-m]"
|
14
|
+
end
|
15
|
+
|
16
|
+
def _commands
|
17
|
+
["points #{_common_opts} [-T tag_key...] [-H host]",
|
18
|
+
"histograms #{_common_opts} [-T tag_key...] [-H host]",
|
19
|
+
"spans #{_common_opts} [-T tag_key...] [-H host]",
|
20
|
+
"ids #{_common_opts} [-y type]"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def _options
|
24
|
+
[common_options,
|
25
|
+
'-e, --end-after=SECONDS stop spying after (approximately) the given ' \
|
26
|
+
'number of seconds',
|
27
|
+
'-m, --timestamp prefix each block of output with the current ' \
|
28
|
+
'time',
|
29
|
+
'-r, --rate=NUMBER sampling rate to use, from 0.01 to 0.5 ' \
|
30
|
+
'(default 0.01)',
|
31
|
+
'-p, --prefix=STRING only show metric names beginning with given ' \
|
32
|
+
'string',
|
33
|
+
'-H, --host=STRING only show metrics from given host',
|
34
|
+
'-T, --tag-key=TAG only show metrics with the given point tag key',
|
35
|
+
'-y, --type=STRING one of METRIC, SPAN, HOST, or STRING']
|
36
|
+
end
|
37
|
+
|
38
|
+
def postscript
|
39
|
+
"\nNOTE: This command uses the unofficial 'spy' API endpoint, which " \
|
40
|
+
'is not guaranteed to remain stable.'.cmd_fold(TW, 0)
|
41
|
+
end
|
42
|
+
end
|
@@ -133,6 +133,8 @@ class WavefrontCliController
|
|
133
133
|
handle_missing_credentials(e)
|
134
134
|
rescue WavefrontCli::Exception::MandatoryValue
|
135
135
|
abort 'A value must be supplied.'
|
136
|
+
rescue Wavefront::Exception::NetworkTimeout
|
137
|
+
abort 'Connection timed out.'
|
136
138
|
rescue Wavefront::Exception::InvalidPermission => e
|
137
139
|
abort "'#{e}' is not a valid privilege."
|
138
140
|
rescue Wavefront::Exception::InvalidUserGroupId => e
|
@@ -171,6 +173,8 @@ class WavefrontCliController
|
|
171
173
|
abort "User error: #{e.message}."
|
172
174
|
rescue WavefrontCli::Exception::ImpossibleSearch
|
173
175
|
abort 'Search on non-existent key. Please use a top-level field.'
|
176
|
+
rescue Wavefront::Exception::InvalidSamplingValue
|
177
|
+
abort 'Sampling rates must be between 0 and 0.05.'
|
174
178
|
rescue StandardError => e
|
175
179
|
warn "general error: #{e}"
|
176
180
|
backtrace_message(e)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module WavefrontDisplay
|
6
|
+
#
|
7
|
+
# Format human-readable output for monitored clusters.
|
8
|
+
#
|
9
|
+
class MonitoredCluster < Base
|
10
|
+
def do_list_brief
|
11
|
+
multicolumn(:id, :platform, :name)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module WavefrontDisplay
|
6
|
+
#
|
7
|
+
# The spy commands stream directly to stdout, so nothing needs to be done
|
8
|
+
# here. The methods have to be stubbed to avoid errors.
|
9
|
+
#
|
10
|
+
class Spy < Base
|
11
|
+
def do_points; end
|
12
|
+
|
13
|
+
def do_histograms; end
|
14
|
+
|
15
|
+
def do_spans; end
|
16
|
+
|
17
|
+
def do_ids; end
|
18
|
+
end
|
19
|
+
end
|
data/lib/wavefront-cli/metric.rb
CHANGED
@@ -4,7 +4,8 @@ require_relative 'base'
|
|
4
4
|
|
5
5
|
module WavefrontCli
|
6
6
|
#
|
7
|
-
# CLI coverage for the v2 'metric' API.
|
7
|
+
# CLI coverage for the v2 'metric' API. Also includes commands which call
|
8
|
+
# the currently unstable 'chart' API.
|
8
9
|
#
|
9
10
|
class Metric < WavefrontCli::Base
|
10
11
|
#
|
@@ -14,6 +15,14 @@ module WavefrontCli
|
|
14
15
|
wf.detail(options[:'<metric>'], options[:glob] || [], options[:offset])
|
15
16
|
end
|
16
17
|
|
18
|
+
def do_list_under
|
19
|
+
wf_chart_api_object.metrics_under(options[:'<metric>'])
|
20
|
+
end
|
21
|
+
|
22
|
+
def do_list_all
|
23
|
+
wf_chart_api_object.metrics_under('')
|
24
|
+
end
|
25
|
+
|
17
26
|
def extra_validation
|
18
27
|
return unless options[:'<metric>']
|
19
28
|
|
@@ -23,5 +32,12 @@ module WavefrontCli
|
|
23
32
|
abort "'#{options[:'<metric>']}' is not a valid metric ID."
|
24
33
|
end
|
25
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def wf_chart_api_object
|
39
|
+
require 'wavefront-sdk/unstable/chart'
|
40
|
+
Wavefront::Unstable::Chart.new(mk_creds, mk_opts)
|
41
|
+
end
|
26
42
|
end
|
27
43
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'command_mixins/tag'
|
5
|
+
|
6
|
+
module WavefrontCli
|
7
|
+
#
|
8
|
+
# CLI coverage for the v2 'maintenancewindow' API.
|
9
|
+
#
|
10
|
+
class MonitoredCluster < WavefrontCli::Base
|
11
|
+
include WavefrontCli::Mixin::Tag
|
12
|
+
|
13
|
+
def do_create
|
14
|
+
body = { version: options[:version],
|
15
|
+
name: options[:'<name>'],
|
16
|
+
platform: options[:'<platform>'],
|
17
|
+
id: options[:'<id>'],
|
18
|
+
additionalTags: {},
|
19
|
+
tags: [] }
|
20
|
+
wf.create(body)
|
21
|
+
end
|
22
|
+
|
23
|
+
def do_merge
|
24
|
+
wf.merge(options[:'<id_to>'], options[:'<id_from>'])
|
25
|
+
end
|
26
|
+
|
27
|
+
def validator_exception
|
28
|
+
Wavefront::Exception::InvalidMonitoredClusterId
|
29
|
+
end
|
30
|
+
|
31
|
+
def descriptive_name
|
32
|
+
'monitored cluster'
|
33
|
+
end
|
34
|
+
|
35
|
+
def extra_validation
|
36
|
+
return unless options[:merge]
|
37
|
+
|
38
|
+
validate_merge_id(options[:'<id_to>'])
|
39
|
+
validate_merge_id(options[:'<id_from>'])
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def validate_merge_id(id)
|
45
|
+
wf_monitoredcluster_id?(id)
|
46
|
+
rescue Wavefront::Exception::InvalidMonitoredClusterId
|
47
|
+
abort "'#{id}' is not a valid cluster ID."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module WavefrontCli
|
6
|
+
#
|
7
|
+
# Spy on metrics being ingested into Wavefront
|
8
|
+
#
|
9
|
+
class Spy < Base
|
10
|
+
def no_api_response
|
11
|
+
%w[do_points do_histograms do_spans do_ids]
|
12
|
+
end
|
13
|
+
|
14
|
+
def do_points
|
15
|
+
wf.points(rate, fn_args, fn_opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
def do_histograms
|
19
|
+
wf.histograms(rate, fn_args, fn_opts)
|
20
|
+
end
|
21
|
+
|
22
|
+
def do_spans
|
23
|
+
wf.spans(rate, fn_args, fn_opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def do_ids
|
27
|
+
wf.ids(rate,
|
28
|
+
{ prefix: options[:prefix], type: options[:type] },
|
29
|
+
fn_opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Passing an empty array to the Spy methods sets up a filter for things
|
33
|
+
# with an empty tag key. So we won't.
|
34
|
+
#
|
35
|
+
def key_opts
|
36
|
+
options[:tagkey].empty? ? nil : options[:tagkey]
|
37
|
+
end
|
38
|
+
|
39
|
+
def display_class
|
40
|
+
'WavefrontDisplay::Spy'
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def require_sdk_class
|
46
|
+
require 'wavefront-sdk/unstable/spy'
|
47
|
+
end
|
48
|
+
|
49
|
+
def _sdk_class
|
50
|
+
'Wavefront::Unstable::Spy'
|
51
|
+
end
|
52
|
+
|
53
|
+
def rate
|
54
|
+
return 0.01 unless options[:rate]
|
55
|
+
|
56
|
+
options[:rate].to_f
|
57
|
+
end
|
58
|
+
|
59
|
+
def fn_args
|
60
|
+
{ prefix: options[:prefix],
|
61
|
+
host: options[:host],
|
62
|
+
tag_key: key_opts }
|
63
|
+
end
|
64
|
+
|
65
|
+
def fn_opts
|
66
|
+
{ timestamp_chunks: options[:timestamp],
|
67
|
+
timeout: options[:endafter].to_i }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative '../support/command_base'
|
5
|
+
require_relative '../test_mixins/tag'
|
6
|
+
require_relative '../../lib/wavefront-cli/monitoredcluster'
|
7
|
+
|
8
|
+
# Ensure 'cluster' commands produce the correct API calls.
|
9
|
+
#
|
10
|
+
class MonitoredClusterEndToEndTest < EndToEndTest
|
11
|
+
include WavefrontCliTest::Delete
|
12
|
+
include WavefrontCliTest::Describe
|
13
|
+
include WavefrontCliTest::List
|
14
|
+
include WavefrontCliTest::Search
|
15
|
+
include WavefrontCliTest::Tag
|
16
|
+
|
17
|
+
def test_create
|
18
|
+
quietly do
|
19
|
+
assert_cmd_posts("create EKS cluster #{id}",
|
20
|
+
'/api/v2/monitoredcluster',
|
21
|
+
version: nil,
|
22
|
+
name: 'cluster',
|
23
|
+
platform: 'EKS',
|
24
|
+
id: 'test-cluster',
|
25
|
+
additionalTags: {},
|
26
|
+
tags: [])
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_abort_on_missing_creds("create EKS cluster #{id}")
|
30
|
+
assert_noop("create EKS -v 1.2 cluster #{id}",
|
31
|
+
'uri: POST https://default.wavefront.com/api/v2/monitoredcluster',
|
32
|
+
"body: #{ { version: '1.2',
|
33
|
+
name: 'cluster',
|
34
|
+
platform: 'EKS',
|
35
|
+
id: 'test-cluster',
|
36
|
+
additionalTags: {},
|
37
|
+
tags: [] }.to_json}")
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_merge
|
41
|
+
quietly do
|
42
|
+
assert_cmd_puts(
|
43
|
+
"merge #{id} #{id2}", "/api/v2/monitoredcluster/merge/#{id}/#{id2}",
|
44
|
+
{}
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
assert_noop("merge #{id} #{id2}",
|
49
|
+
'uri: PUT https://default.wavefront.com/api/v2/' \
|
50
|
+
"monitoredcluster/merge/#{id}/#{id2}",
|
51
|
+
'body: null')
|
52
|
+
assert_invalid_id("merge #{invalid_id} #{id2} -D")
|
53
|
+
assert_abort_on_missing_creds("merge #{id} #{id2}")
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def id
|
59
|
+
'test-cluster'
|
60
|
+
end
|
61
|
+
|
62
|
+
def id2
|
63
|
+
'other-cluster'
|
64
|
+
end
|
65
|
+
|
66
|
+
def invalid_id
|
67
|
+
'!__BAD__!'
|
68
|
+
end
|
69
|
+
|
70
|
+
def cmd_word
|
71
|
+
'cluster'
|
72
|
+
end
|
73
|
+
|
74
|
+
def api_path
|
75
|
+
'monitoredcluster'
|
76
|
+
end
|
77
|
+
|
78
|
+
def sdk_class_name
|
79
|
+
'MonitoredCluster'
|
80
|
+
end
|
81
|
+
|
82
|
+
def friendly_name
|
83
|
+
'monitored cluster'
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative '../support/command_base'
|
5
|
+
require_relative '../../lib/wavefront-cli/spy'
|
6
|
+
|
7
|
+
# Ensure 'spy' commands produce the correct API calls.
|
8
|
+
#
|
9
|
+
class SpyEndToEndTest < EndToEndTest
|
10
|
+
def test_points
|
11
|
+
capture_io do
|
12
|
+
assert_cmd_gets('points', '/api/spy/points?sampling=0.01')
|
13
|
+
assert_cmd_gets('points -r 0.02', '/api/spy/points?sampling=0.02')
|
14
|
+
assert_cmd_gets('points -p mtc1',
|
15
|
+
'/api/spy/points?sampling=0.01&metric=mtc1')
|
16
|
+
assert_cmd_gets('points -T tag1 -T tag2',
|
17
|
+
'/api/spy/points?sampling=0.01&pointTagKey=tag1' \
|
18
|
+
'&pointTagKey=tag2')
|
19
|
+
assert_cmd_gets('points -p mtc1 -H host1',
|
20
|
+
'/api/spy/points?sampling=0.01&metric=mtc1&host=host1')
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_exits_with('Sampling rates must be between 0 and 0.05.',
|
24
|
+
'points -r 0.7')
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_histograms
|
28
|
+
capture_io do
|
29
|
+
assert_cmd_gets('histograms', '/api/spy/histograms?sampling=0.01')
|
30
|
+
assert_cmd_gets('histograms -r 0.02', '/api/spy/histograms?sampling=0.02')
|
31
|
+
assert_cmd_gets('histograms -p hst1',
|
32
|
+
'/api/spy/histograms?sampling=0.01&histogram=hst1')
|
33
|
+
assert_cmd_gets('histograms -T tag1 -T tag2',
|
34
|
+
'/api/spy/histograms?sampling=0.01' \
|
35
|
+
'&histogramTagKey=tag1&histogramTagKey=tag2')
|
36
|
+
assert_cmd_gets('histograms -p hst1 -H host1',
|
37
|
+
'/api/spy/histograms?sampling=0.01&histogram=hst1' \
|
38
|
+
'&host=host1')
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_exits_with('Sampling rates must be between 0 and 0.05.',
|
42
|
+
'histograms -r 4')
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_spans
|
46
|
+
capture_io do
|
47
|
+
assert_cmd_gets('spans', '/api/spy/spans?sampling=0.01')
|
48
|
+
assert_cmd_gets('spans -r 0.02', '/api/spy/spans?sampling=0.02')
|
49
|
+
assert_cmd_gets('spans -p span1',
|
50
|
+
'/api/spy/spans?sampling=0.01&name=span1')
|
51
|
+
assert_cmd_gets('spans -T tag1 -T tag2',
|
52
|
+
'/api/spy/spans?sampling=0.01' \
|
53
|
+
'&spanTagKey=tag1&spanTagKey=tag2')
|
54
|
+
assert_cmd_gets('spans -p span1 -H host1',
|
55
|
+
'/api/spy/spans?sampling=0.01&name=span1' \
|
56
|
+
'&host=host1')
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_exits_with('Sampling rates must be between 0 and 0.05.',
|
60
|
+
'spans -r 7')
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_ids
|
64
|
+
capture_io do
|
65
|
+
assert_cmd_gets('ids', '/api/spy/ids?sampling=0.01')
|
66
|
+
assert_cmd_gets('ids -r 0.02', '/api/spy/ids?sampling=0.02')
|
67
|
+
assert_cmd_gets('ids -p id1', '/api/spy/ids?sampling=0.01&name=id1')
|
68
|
+
assert_cmd_gets('ids -y METRIC -p id1',
|
69
|
+
'/api/spy/ids?sampling=0.01' \
|
70
|
+
'&type=METRIC&name=id1')
|
71
|
+
end
|
72
|
+
|
73
|
+
assert_exits_with('Sampling rates must be between 0 and 0.05.',
|
74
|
+
'ids -r 7')
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def cmd_word
|
80
|
+
'spy'
|
81
|
+
end
|
82
|
+
end
|
data/wavefront-cli.gemspec
CHANGED
@@ -26,7 +26,7 @@ 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', '~>
|
29
|
+
gem.add_runtime_dependency 'wavefront-sdk', '~> 4.0', '>= 4.0.0'
|
30
30
|
|
31
31
|
gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.0'
|
32
32
|
gem.add_development_dependency 'rake', '~> 12.0'
|
@@ -35,5 +35,5 @@ Gem::Specification.new do |gem|
|
|
35
35
|
gem.add_development_dependency 'webmock', '~> 3.7'
|
36
36
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
37
37
|
|
38
|
-
gem.required_ruby_version = Gem::Requirement.new('>= 2.
|
38
|
+
gem.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
39
39
|
end
|
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:
|
4
|
+
version: 5.0.0
|
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-02-
|
11
|
+
date: 2020-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -44,20 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.0'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: 4.0.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
57
|
+
version: '4.0'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 4.0.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: minitest
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/wavefront-cli/commands/apitoken.rb
|
177
177
|
- lib/wavefront-cli/commands/base.rb
|
178
178
|
- lib/wavefront-cli/commands/cloudintegration.rb
|
179
|
+
- lib/wavefront-cli/commands/cluster.rb
|
179
180
|
- lib/wavefront-cli/commands/config.rb
|
180
181
|
- lib/wavefront-cli/commands/dashboard.rb
|
181
182
|
- lib/wavefront-cli/commands/derivedmetric.rb
|
@@ -192,6 +193,7 @@ files:
|
|
192
193
|
- lib/wavefront-cli/commands/serviceaccount.rb
|
193
194
|
- lib/wavefront-cli/commands/settings.rb
|
194
195
|
- lib/wavefront-cli/commands/source.rb
|
196
|
+
- lib/wavefront-cli/commands/spy.rb
|
195
197
|
- lib/wavefront-cli/commands/usage.rb
|
196
198
|
- lib/wavefront-cli/commands/user.rb
|
197
199
|
- lib/wavefront-cli/commands/usergroup.rb
|
@@ -217,6 +219,7 @@ files:
|
|
217
219
|
- lib/wavefront-cli/display/maintenancewindow.rb
|
218
220
|
- lib/wavefront-cli/display/message.rb
|
219
221
|
- lib/wavefront-cli/display/metric.rb
|
222
|
+
- lib/wavefront-cli/display/monitoredcluster.rb
|
220
223
|
- lib/wavefront-cli/display/notificant.rb
|
221
224
|
- lib/wavefront-cli/display/printer/long.rb
|
222
225
|
- lib/wavefront-cli/display/printer/sparkline.rb
|
@@ -227,6 +230,7 @@ files:
|
|
227
230
|
- lib/wavefront-cli/display/serviceaccount.rb
|
228
231
|
- lib/wavefront-cli/display/settings.rb
|
229
232
|
- lib/wavefront-cli/display/source.rb
|
233
|
+
- lib/wavefront-cli/display/spy.rb
|
230
234
|
- lib/wavefront-cli/display/usage.rb
|
231
235
|
- lib/wavefront-cli/display/user.rb
|
232
236
|
- lib/wavefront-cli/display/usergroup.rb
|
@@ -240,6 +244,7 @@ files:
|
|
240
244
|
- lib/wavefront-cli/maintenancewindow.rb
|
241
245
|
- lib/wavefront-cli/message.rb
|
242
246
|
- lib/wavefront-cli/metric.rb
|
247
|
+
- lib/wavefront-cli/monitoredcluster.rb
|
243
248
|
- lib/wavefront-cli/notificant.rb
|
244
249
|
- lib/wavefront-cli/opt_handler.rb
|
245
250
|
- lib/wavefront-cli/output/base.rb
|
@@ -264,6 +269,7 @@ files:
|
|
264
269
|
- lib/wavefront-cli/serviceaccount.rb
|
265
270
|
- lib/wavefront-cli/settings.rb
|
266
271
|
- lib/wavefront-cli/source.rb
|
272
|
+
- lib/wavefront-cli/spy.rb
|
267
273
|
- lib/wavefront-cli/stdlib/array.rb
|
268
274
|
- lib/wavefront-cli/stdlib/string.rb
|
269
275
|
- lib/wavefront-cli/usage.rb
|
@@ -323,6 +329,7 @@ files:
|
|
323
329
|
- spec/wavefront-cli/maintenancewindow_spec.rb
|
324
330
|
- spec/wavefront-cli/message_spec.rb
|
325
331
|
- spec/wavefront-cli/metric_spec.rb
|
332
|
+
- spec/wavefront-cli/monitoredcluster_spec.rb
|
326
333
|
- spec/wavefront-cli/notificant_spec.rb
|
327
334
|
- spec/wavefront-cli/opt_handler_spec.rb
|
328
335
|
- spec/wavefront-cli/output/csv/query_spec.rb
|
@@ -378,6 +385,7 @@ files:
|
|
378
385
|
- spec/wavefront-cli/serviceaccount_spec.rb
|
379
386
|
- spec/wavefront-cli/settings_spec.rb
|
380
387
|
- spec/wavefront-cli/source_spec.rb
|
388
|
+
- spec/wavefront-cli/spy_spec.rb
|
381
389
|
- spec/wavefront-cli/stdlib/array_spec.rb
|
382
390
|
- spec/wavefront-cli/stdlib/string_spec.rb
|
383
391
|
- spec/wavefront-cli/usage_spec.rb
|
@@ -398,7 +406,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
398
406
|
requirements:
|
399
407
|
- - ">="
|
400
408
|
- !ruby/object:Gem::Version
|
401
|
-
version: 2.
|
409
|
+
version: 2.4.0
|
402
410
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
403
411
|
requirements:
|
404
412
|
- - ">="
|
@@ -462,6 +470,7 @@ test_files:
|
|
462
470
|
- spec/wavefront-cli/maintenancewindow_spec.rb
|
463
471
|
- spec/wavefront-cli/message_spec.rb
|
464
472
|
- spec/wavefront-cli/metric_spec.rb
|
473
|
+
- spec/wavefront-cli/monitoredcluster_spec.rb
|
465
474
|
- spec/wavefront-cli/notificant_spec.rb
|
466
475
|
- spec/wavefront-cli/opt_handler_spec.rb
|
467
476
|
- spec/wavefront-cli/output/csv/query_spec.rb
|
@@ -517,6 +526,7 @@ test_files:
|
|
517
526
|
- spec/wavefront-cli/serviceaccount_spec.rb
|
518
527
|
- spec/wavefront-cli/settings_spec.rb
|
519
528
|
- spec/wavefront-cli/source_spec.rb
|
529
|
+
- spec/wavefront-cli/spy_spec.rb
|
520
530
|
- spec/wavefront-cli/stdlib/array_spec.rb
|
521
531
|
- spec/wavefront-cli/stdlib/string_spec.rb
|
522
532
|
- spec/wavefront-cli/usage_spec.rb
|