kennel 1.108.1 → 1.111.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/Readme.md +1 -0
- data/lib/kennel/models/monitor.rb +8 -0
- data/lib/kennel/models/synthetic_test.rb +4 -1
- data/lib/kennel/syncer.rb +6 -5
- data/lib/kennel/version.rb +1 -1
- data/lib/kennel.rb +9 -7
- data/template/Readme.md +1 -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: ecc8b3b6c87887c18c48a47ef287b7d96a79a12b11f3e76122b95733dfcb53bc
|
4
|
+
data.tar.gz: 335c63f8cb7b01437286a0d5a1e2bfdcc409af5ff98d3743cb485e06c4d63963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8805038348b44ad5a9615642b6862d6a99dea7d630dd4bc2a2d93448d59d394bf23f714ef46a159c0150f34105b4a8553c4ea09d63b0a0fdc811ac6919a6de04
|
7
|
+
data.tar.gz: 93a9924e1c1d575d110e4e90b10124f7157a18f384284fb190af267ca19580d93e33b9816708429804195450b4865918e63a507dc65e1fcb84885c2b94122e23
|
data/Readme.md
CHANGED
@@ -248,6 +248,7 @@ so they can be created in a single update and can be re-created if any of them i
|
|
248
248
|
- rebase on updated `master` to not undo other changes
|
249
249
|
- figure out project name by converting the class name to snake-case
|
250
250
|
- run `PROJECT=foo bundle exec rake kennel:update_datadog` to test changes for a single project (monitors: remove mentions while debugging to avoid alert spam)
|
251
|
+
- use `PROJECT=foo,bar,...` for multiple projects
|
251
252
|
|
252
253
|
### Reuse
|
253
254
|
Add to `parts/<folder>`.
|
@@ -111,6 +111,14 @@ module Kennel
|
|
111
111
|
# Datadog requires only either new_group_delay or new_host_delay, never both
|
112
112
|
options.delete(options[:new_group_delay] ? :new_host_delay : :new_group_delay)
|
113
113
|
|
114
|
+
# Add in statuses where we would re notify on. Possible values: alert, no data, warn
|
115
|
+
if options[:renotify_interval] != 0
|
116
|
+
statuses = ["alert"]
|
117
|
+
statuses << "no data" if options[:notify_no_data]
|
118
|
+
statuses << "warn" if options.dig(:thresholds, :warning)
|
119
|
+
options[:renotify_statuses] = statuses
|
120
|
+
end
|
121
|
+
|
114
122
|
validate_json(data) if validate
|
115
123
|
|
116
124
|
@as_json = data
|
@@ -54,7 +54,10 @@ module Kennel
|
|
54
54
|
|
55
55
|
# tags come in a semi-random order and order is never updated
|
56
56
|
expected[:tags]&.sort!
|
57
|
-
actual[:tags]
|
57
|
+
actual[:tags]&.sort!
|
58
|
+
|
59
|
+
expected[:locations]&.sort!
|
60
|
+
actual[:locations]&.sort!
|
58
61
|
|
59
62
|
ignore_default(expected, actual, DEFAULTS)
|
60
63
|
end
|
data/lib/kennel/syncer.rb
CHANGED
@@ -4,9 +4,9 @@ module Kennel
|
|
4
4
|
DELETE_ORDER = ["dashboard", "slo", "monitor", "synthetics/tests"].freeze # dashboards references monitors + slos, slos reference monitors
|
5
5
|
LINE_UP = "\e[1A\033[K" # go up and clear
|
6
6
|
|
7
|
-
def initialize(api, expected,
|
7
|
+
def initialize(api, expected, project_filter: nil)
|
8
8
|
@api = api
|
9
|
-
@project_filter =
|
9
|
+
@project_filter = project_filter
|
10
10
|
@expected = expected
|
11
11
|
calculate_diff
|
12
12
|
validate_plan
|
@@ -252,7 +252,7 @@ module Kennel
|
|
252
252
|
end
|
253
253
|
|
254
254
|
# override resources that exist with their id
|
255
|
-
|
255
|
+
project_prefixes = @project_filter&.map { |p| "#{p}:" }
|
256
256
|
actual.each do |a|
|
257
257
|
# ignore when not managed by kennel
|
258
258
|
next unless tracking_id = a.fetch(:tracking_id)
|
@@ -262,7 +262,7 @@ module Kennel
|
|
262
262
|
api_resource = a.fetch(:klass).api_resource
|
263
263
|
next if
|
264
264
|
!@id_map.get(api_resource, tracking_id) &&
|
265
|
-
(!
|
265
|
+
(!project_prefixes || tracking_id.start_with?(*project_prefixes))
|
266
266
|
|
267
267
|
@id_map.set(api_resource, tracking_id, a.fetch(:id))
|
268
268
|
if a[:klass].api_resource == "synthetics/tests"
|
@@ -277,9 +277,10 @@ module Kennel
|
|
277
277
|
|
278
278
|
def filter_actual_by_project!(actual)
|
279
279
|
return unless @project_filter
|
280
|
+
project_prefixes = @project_filter&.map { |p| "#{p}:" }
|
280
281
|
actual.select! do |a|
|
281
282
|
tracking_id = a.fetch(:tracking_id)
|
282
|
-
!tracking_id || tracking_id.start_with?(
|
283
|
+
!tracking_id || tracking_id.start_with?(*project_prefixes)
|
283
284
|
end
|
284
285
|
end
|
285
286
|
end
|
data/lib/kennel/version.rb
CHANGED
data/lib/kennel.rb
CHANGED
@@ -63,7 +63,7 @@ module Kennel
|
|
63
63
|
|
64
64
|
def store(parts)
|
65
65
|
Progress.progress "Storing" do
|
66
|
-
old = Dir["generated
|
66
|
+
old = Dir["generated/{#{(project_filter || ["**"]).join(",")}}/*"]
|
67
67
|
used = []
|
68
68
|
|
69
69
|
Utils.parallel(parts, max: 2) do |part|
|
@@ -92,7 +92,7 @@ module Kennel
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def syncer
|
95
|
-
@syncer ||= Syncer.new(api, generated,
|
95
|
+
@syncer ||= Syncer.new(api, generated, project_filter: project_filter)
|
96
96
|
end
|
97
97
|
|
98
98
|
def api
|
@@ -104,18 +104,20 @@ module Kennel
|
|
104
104
|
Progress.progress "Generating" do
|
105
105
|
load_all
|
106
106
|
known = []
|
107
|
+
filter = project_filter
|
108
|
+
|
107
109
|
parts = Models::Project.recursive_subclasses.flat_map do |project_class|
|
108
110
|
project = project_class.new
|
109
111
|
kennel_id = project.kennel_id
|
110
|
-
if
|
112
|
+
if filter
|
111
113
|
known << kennel_id
|
112
|
-
next []
|
114
|
+
next [] unless filter.include?(kennel_id)
|
113
115
|
end
|
114
116
|
project.validated_parts
|
115
117
|
end
|
116
118
|
|
117
|
-
if
|
118
|
-
raise "#{
|
119
|
+
if filter && parts.empty?
|
120
|
+
raise "#{filter.join(", ")} does not match any projects, try any of these:\n#{known.uniq.sort.join("\n")}"
|
119
121
|
end
|
120
122
|
|
121
123
|
parts.group_by(&:tracking_id).each do |tracking_id, same|
|
@@ -131,7 +133,7 @@ module Kennel
|
|
131
133
|
end
|
132
134
|
|
133
135
|
def project_filter
|
134
|
-
ENV["PROJECT"]
|
136
|
+
ENV["PROJECT"]&.split(",")
|
135
137
|
end
|
136
138
|
|
137
139
|
def load_all
|
data/template/Readme.md
CHANGED
@@ -230,6 +230,7 @@ so they can be created in a single update and can be re-created if any of them i
|
|
230
230
|
- rebase on updated `master` to not undo other changes
|
231
231
|
- figure out project name by converting the class name to snake-case
|
232
232
|
- run `PROJECT=foo bundle exec rake kennel:update_datadog` to test changes for a single project (monitors: remove mentions while debugging to avoid alert spam)
|
233
|
+
- use `PROJECT=foo,bar,...` for multiple projects
|
233
234
|
|
234
235
|
### Reuse
|
235
236
|
Add to `parts/<folder>`.
|
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.111.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|