kennel 1.86.1 → 1.87.1
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/lib/kennel/importer.rb +4 -1
- data/lib/kennel/models/dashboard.rb +72 -34
- data/lib/kennel/version.rb +1 -1
- 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: 42e4d1fd80bfa23ccbed32dcc6cfeb05fda2a2748bc29b302e6f982273302551
|
|
4
|
+
data.tar.gz: 6ffc6ddafa5518868cc913fd05add8f11eb49729ba4ca498b357241ab80111f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76f2b875dd8e918db62b0ee13a6ad01acd6a187f11127824176cdee2f8665ec0ffa4d5ad3a0f8fbfd97fbf980faae8039cdbca8f2b078ef81e091a9a34c3ed0e
|
|
7
|
+
data.tar.gz: a612a2d02f684f847ef6c167d2a3ef9fc815f80c1fd618106c8824017cede188c77dec3700d1a7afd46c481cd3c8fa7c37358af6a9737c1703a68491d159a5b1
|
data/lib/kennel/importer.rb
CHANGED
|
@@ -66,7 +66,10 @@ module Kennel
|
|
|
66
66
|
data[:type] = "query alert" if data[:type] == "metric alert"
|
|
67
67
|
when "dashboard"
|
|
68
68
|
widgets = data[:widgets]&.flat_map { |widget| widget.dig(:definition, :widgets) || [widget] }
|
|
69
|
-
widgets&.each
|
|
69
|
+
widgets&.each do |widget|
|
|
70
|
+
dry_up_query!(widget)
|
|
71
|
+
(widget.dig(:definition, :markers) || []).each { |m| m[:label]&.delete! " " }
|
|
72
|
+
end
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
data.delete(:tags) if data[:tags] == [] # do not create super + [] call
|
|
@@ -12,8 +12,56 @@ module Kennel
|
|
|
12
12
|
style: { line_width: "normal", palette: "dog_classic", line_type: "solid" }
|
|
13
13
|
}.freeze
|
|
14
14
|
WIDGET_DEFAULTS = {
|
|
15
|
-
"timeseries" => {
|
|
16
|
-
|
|
15
|
+
"timeseries" => {
|
|
16
|
+
legend_size: "0",
|
|
17
|
+
markers: [],
|
|
18
|
+
legend_columns: [
|
|
19
|
+
"avg",
|
|
20
|
+
"min",
|
|
21
|
+
"max",
|
|
22
|
+
"value",
|
|
23
|
+
"sum"
|
|
24
|
+
],
|
|
25
|
+
legend_layout: "auto",
|
|
26
|
+
yaxis: {
|
|
27
|
+
include_zero: true,
|
|
28
|
+
label: "",
|
|
29
|
+
scale: "linear",
|
|
30
|
+
min: "auto",
|
|
31
|
+
max: "auto"
|
|
32
|
+
},
|
|
33
|
+
show_legend: true,
|
|
34
|
+
time: {},
|
|
35
|
+
title_align: "left",
|
|
36
|
+
title_size: "16"
|
|
37
|
+
},
|
|
38
|
+
"note" => {
|
|
39
|
+
show_tick: false,
|
|
40
|
+
tick_edge: "left",
|
|
41
|
+
tick_pos: "50%",
|
|
42
|
+
text_align: "left",
|
|
43
|
+
has_padding: true,
|
|
44
|
+
background_color: "white",
|
|
45
|
+
font_size: "14"
|
|
46
|
+
},
|
|
47
|
+
"query_value" => {
|
|
48
|
+
autoscale: true,
|
|
49
|
+
time: {},
|
|
50
|
+
title_align: "left",
|
|
51
|
+
title_size: "16"
|
|
52
|
+
},
|
|
53
|
+
"free_text" => {
|
|
54
|
+
font_size: "auto"
|
|
55
|
+
},
|
|
56
|
+
"check_status" => {
|
|
57
|
+
title_align: "left",
|
|
58
|
+
title_size: "16"
|
|
59
|
+
},
|
|
60
|
+
"slo" => {
|
|
61
|
+
global_time_target: "0",
|
|
62
|
+
title_align: "left",
|
|
63
|
+
title_size: "16"
|
|
64
|
+
}
|
|
17
65
|
}.freeze
|
|
18
66
|
SUPPORTED_DEFINITION_OPTIONS = [:events, :markers, :precision].freeze
|
|
19
67
|
|
|
@@ -40,53 +88,43 @@ module Kennel
|
|
|
40
88
|
def normalize(expected, actual)
|
|
41
89
|
super
|
|
42
90
|
|
|
43
|
-
ignore_default
|
|
44
|
-
ignore_default
|
|
91
|
+
ignore_default expected, actual, DEFAULTS
|
|
92
|
+
ignore_default expected, actual, reflow_type: "auto" if expected[:layout_type] == "ordered"
|
|
45
93
|
|
|
46
94
|
widgets_pairs(expected, actual).each do |pair|
|
|
47
|
-
|
|
48
|
-
pair
|
|
49
|
-
widgets.each do |widget|
|
|
50
|
-
if formats = widget.dig(:definition, :conditional_formats)
|
|
51
|
-
widget[:definition][:conditional_formats] = formats.sort_by(&:hash)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
ignore_widget_defaults pair
|
|
57
|
-
|
|
95
|
+
pair.each { |w| sort_conditional_formats w }
|
|
96
|
+
ignore_widget_defaults(*pair)
|
|
58
97
|
ignore_request_defaults(*pair)
|
|
59
|
-
|
|
60
|
-
# ids are kinda random so we always discard them
|
|
61
|
-
pair.each { |widgets| widgets.each { |w| w.delete(:id) } }
|
|
98
|
+
pair.each { |widget| widget&.delete(:id) } # ids are kinda random so we always discard them
|
|
62
99
|
end
|
|
63
100
|
end
|
|
64
101
|
|
|
65
102
|
private
|
|
66
103
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
next unless defaults = WIDGET_DEFAULTS[types.first]
|
|
72
|
-
ignore_defaults(pair[0], pair[1], defaults, nesting: :definition)
|
|
104
|
+
# conditional_formats ordering is randomly changed by datadog, compare a stable ordering
|
|
105
|
+
def sort_conditional_formats(widget)
|
|
106
|
+
if formats = widget&.dig(:definition, :conditional_formats)
|
|
107
|
+
widget[:definition][:conditional_formats] = formats.sort_by(&:hash)
|
|
73
108
|
end
|
|
74
109
|
end
|
|
75
110
|
|
|
111
|
+
def ignore_widget_defaults(expected, actual)
|
|
112
|
+
types = [expected&.dig(:definition, :type), actual&.dig(:definition, :type)].uniq.compact
|
|
113
|
+
return unless types.size == 1
|
|
114
|
+
return unless defaults = WIDGET_DEFAULTS[types.first]
|
|
115
|
+
ignore_default expected&.[](:definition) || {}, actual&.[](:definition) || {}, defaults
|
|
116
|
+
end
|
|
117
|
+
|
|
76
118
|
# discard styles/conditional_formats/aggregator if nothing would change when we applied (both are default or nil)
|
|
77
119
|
def ignore_request_defaults(expected, actual)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
ignore_defaults e_r, a_r, REQUEST_DEFAULTS
|
|
82
|
-
end
|
|
120
|
+
a_r = actual&.dig(:definition, :requests) || []
|
|
121
|
+
e_r = expected&.dig(:definition, :requests) || []
|
|
122
|
+
ignore_defaults e_r, a_r, REQUEST_DEFAULTS
|
|
83
123
|
end
|
|
84
124
|
|
|
85
|
-
def ignore_defaults(expected, actual, defaults
|
|
125
|
+
def ignore_defaults(expected, actual, defaults)
|
|
86
126
|
[expected.size, actual.size].max.times do |i|
|
|
87
|
-
|
|
88
|
-
a = actual.dig(i, *nesting) || {}
|
|
89
|
-
ignore_default(e, a, defaults)
|
|
127
|
+
ignore_default expected[i] || {}, actual[i] || {}, defaults
|
|
90
128
|
end
|
|
91
129
|
end
|
|
92
130
|
|
|
@@ -99,7 +137,7 @@ module Kennel
|
|
|
99
137
|
nested = pair.map { |d| d.dig(:widgets, i, :definition, :widgets) || [] }
|
|
100
138
|
result << nested if nested.any?(&:any?)
|
|
101
139
|
end
|
|
102
|
-
result
|
|
140
|
+
result.flat_map { |a, e| [a.size, e.size].max.times.map { |i| [a[i], e[i]] } }
|
|
103
141
|
end
|
|
104
142
|
end
|
|
105
143
|
|
data/lib/kennel/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kennel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.87.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Grosser
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|