kennel 2.20.0 → 2.21.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/lib/kennel/importer.rb +8 -1
- data/lib/kennel/models/project.rb +11 -7
- data/lib/kennel/models/slo.rb +14 -9
- data/lib/kennel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f604eb100e46e40ba76333717c9ddb99e06cd85be98f7eb19217b7be1b193b2
|
|
4
|
+
data.tar.gz: 352ead0a6c2ce295f14113d03f9ab956278851d55457340dffa9d6fdf042856e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d0e3477bcef3043433fca52d3e3c3940f7cd315c7c89ecebb7a07eb7a50d56adcb46522a51492ef47c72346b10bec7446c495c8d368c5ff741a510e2c8885b9
|
|
7
|
+
data.tar.gz: 0e71a447829ac1dcc996b08858e7dcd720b3e3f6f9e5b2e008bc0e187e952e1cafaa561b62152a37e547053d033ef0c2e37746419205eb1788d859c536f5d77a
|
data/lib/kennel/importer.rb
CHANGED
|
@@ -86,7 +86,14 @@ module Kennel
|
|
|
86
86
|
end
|
|
87
87
|
when "synthetics/tests"
|
|
88
88
|
data[:locations] = :all if data[:locations].sort == Kennel::Models::SyntheticTest::LOCATIONS.sort
|
|
89
|
-
|
|
89
|
+
when "slo"
|
|
90
|
+
# sli_specification it is only used by datadog if the user switched to "Bad Events"
|
|
91
|
+
# otherwise user would be trying to set sli_specification but the slo does not change since query is used
|
|
92
|
+
if data.key?(:query) && data.key?(:sli_specification)
|
|
93
|
+
delete = (data.dig(:sli_specification, :count, :bad_events_formula) ? :query : :sli_specification)
|
|
94
|
+
data.delete delete
|
|
95
|
+
end
|
|
96
|
+
else # uncovered
|
|
90
97
|
# noop
|
|
91
98
|
end
|
|
92
99
|
|
|
@@ -10,10 +10,16 @@ module Kennel
|
|
|
10
10
|
|
|
11
11
|
def self.file_location
|
|
12
12
|
return @file_location if defined?(@file_location)
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
methods = instance_methods(false)
|
|
14
|
+
if methods.any?
|
|
15
|
+
@file_location = methods.detect do |method|
|
|
16
|
+
location = instance_method(method).source_location.first
|
|
17
|
+
if (path = find_relative_path(location))
|
|
18
|
+
break path
|
|
19
|
+
end
|
|
20
|
+
end || raise("Unable to find file_location for #{name}")
|
|
15
21
|
else
|
|
16
|
-
@file_location = nil
|
|
22
|
+
@file_location = nil # not sure if this is actually needed
|
|
17
23
|
end
|
|
18
24
|
end
|
|
19
25
|
|
|
@@ -29,11 +35,9 @@ module Kennel
|
|
|
29
35
|
|
|
30
36
|
private
|
|
31
37
|
|
|
32
|
-
private_class_method def self.
|
|
38
|
+
private_class_method def self.find_relative_path(path)
|
|
33
39
|
return path unless File.absolute_path?(path)
|
|
34
|
-
path.dup.sub!("#{Bundler.root}/", "") ||
|
|
35
|
-
path.dup.sub!("#{Dir.pwd}/", "") ||
|
|
36
|
-
raise("Unable to make path #{path} relative with bundler root #{Bundler.root} or pwd #{Dir.pwd}")
|
|
40
|
+
path.dup.sub!("#{Bundler.root}/", "") || path.dup.sub!("#{Dir.pwd}/", "")
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
# hook for users to add custom filtering via `prepend`
|
data/lib/kennel/models/slo.rb
CHANGED
|
@@ -15,7 +15,8 @@ module Kennel
|
|
|
15
15
|
groups: nil,
|
|
16
16
|
monitor_ids: [],
|
|
17
17
|
thresholds: [],
|
|
18
|
-
primary: nil
|
|
18
|
+
primary: nil,
|
|
19
|
+
sli_specification: nil
|
|
19
20
|
}.freeze
|
|
20
21
|
|
|
21
22
|
settings :type, :description, :thresholds, :query, :tags, :monitor_ids, :monitor_tags, :name, :groups, :sli_specification, :primary
|
|
@@ -27,7 +28,8 @@ module Kennel
|
|
|
27
28
|
monitor_ids: -> { DEFAULTS.fetch(:monitor_ids) },
|
|
28
29
|
thresholds: -> { DEFAULTS.fetch(:thresholds) },
|
|
29
30
|
groups: -> { DEFAULTS.fetch(:groups) },
|
|
30
|
-
primary: -> { DEFAULTS.fetch(:primary) }
|
|
31
|
+
primary: -> { DEFAULTS.fetch(:primary) },
|
|
32
|
+
sli_specification: -> { DEFAULTS.fetch(:sli_specification) }
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
def build_json
|
|
@@ -50,9 +52,8 @@ module Kennel
|
|
|
50
52
|
data[:target_threshold] = threshold[:target]
|
|
51
53
|
end
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
data[:sli_specification] = sli_specification
|
|
55
|
+
if (v = sli_specification)
|
|
56
|
+
data[:sli_specification] = v
|
|
56
57
|
elsif (v = query)
|
|
57
58
|
data[:query] = v
|
|
58
59
|
end
|
|
@@ -102,10 +103,14 @@ module Kennel
|
|
|
102
103
|
[:timeframe, :warning_threshold, :target_threshold].each { |k| actual.delete k }
|
|
103
104
|
end
|
|
104
105
|
|
|
105
|
-
#
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
# discard deprecated query which stays in datadog forever when we are trying to set sli_specification
|
|
107
|
+
# (downgrading to query by setting sli_specification=nil is not supported in the api)
|
|
108
|
+
actual.delete :query if expected[:sli_specification]
|
|
109
|
+
|
|
110
|
+
# user set query so let's not worry about sli_specification even if this might be hiding bugs
|
|
111
|
+
# ideally we'd validate and tell the user that this will have no effect (see importer logic)
|
|
112
|
+
# but I'm not confident this will always be right
|
|
113
|
+
actual.delete :sli_specification if expected[:query]
|
|
109
114
|
|
|
110
115
|
ignore_default(expected, actual, DEFAULTS)
|
|
111
116
|
end
|
data/lib/kennel/version.rb
CHANGED