wavefront-cli 8.1.0 → 8.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +3 -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/query.rb +18 -2
- data/lib/wavefront-cli/version.rb +1 -1
- data/spec/wavefront-cli/display/printer/long_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afeb72ce32ce32e70e1f405234608ce5109d039aa6045b89e73e8351d95e459f
|
4
|
+
data.tar.gz: 06b2ab6daedba6a696b9c63208bfe9465695f224f6fab58c49c9408051f81e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b2159704ea25f5f1dea58b16e9e968b9b3ba17668a6f014a0ff75ce63be91179601a5cc917ab526b281a36d3c4e254ec8dbe0af9ac57f21274a4fbeeb5faab
|
7
|
+
data.tar.gz: 672954a741cf305255820402b0a62bf9ac8facafb9e5fbf63c633a3355117516253cc50e68247fb019e7b1797f6117062acf32b3e30d012e995a55e37c0bb53f
|
data/HISTORY.md
CHANGED
@@ -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,15 +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),
|
23
24
|
traces: mk_traces(data),
|
25
|
+
spans: mk_spans(data),
|
24
26
|
events: mk_events(data) }.tap do |d|
|
25
27
|
d[:warnings] = data[:warnings] if show_warnings?
|
26
28
|
end
|
27
29
|
end
|
30
|
+
# rubocop:enable Metrics/AbcSize
|
28
31
|
|
29
32
|
def show_warnings?
|
30
33
|
data.key?(:warnings) && !options[:nowarn]
|
@@ -61,6 +64,12 @@ module WavefrontDisplay
|
|
61
64
|
data[:traces].map { |t| humanize_trace(t) }
|
62
65
|
end
|
63
66
|
|
67
|
+
def mk_spans(data)
|
68
|
+
return [] unless data.key?(:spans)
|
69
|
+
|
70
|
+
data[:spans].map { |t| humanize_span(t) }
|
71
|
+
end
|
72
|
+
|
64
73
|
def do_run
|
65
74
|
do_default
|
66
75
|
end
|
@@ -107,17 +116,24 @@ module WavefrontDisplay
|
|
107
116
|
end
|
108
117
|
|
109
118
|
def humanize_trace(data)
|
119
|
+
@printer_opts[:sep_depth] = 3
|
120
|
+
|
110
121
|
data.tap do |t|
|
111
122
|
t[:start] = human_time(t[:start_ms])
|
112
123
|
t[:end] = human_time(t[:end_ms])
|
113
124
|
t.delete(:start_ms)
|
114
125
|
t.delete(:end_ms)
|
115
126
|
t.delete(:startMs)
|
116
|
-
t.spans = t.spans.map { |s|
|
127
|
+
t.spans = t.spans.map { |s| humanize_trace_span(s) }
|
117
128
|
end
|
118
129
|
end
|
119
130
|
|
120
|
-
def humanize_span(
|
131
|
+
def humanize_span(data)
|
132
|
+
@printer_opts[:sep_depth] = 2
|
133
|
+
data
|
134
|
+
end
|
135
|
+
|
136
|
+
def humanize_trace_span(span)
|
121
137
|
span.tap do |s|
|
122
138
|
s[:startMs] = human_time(s[:startMs])
|
123
139
|
end
|
@@ -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
|
|
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.2.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-10-
|
11
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|