kennel 1.61.0 → 1.61.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +3 -4
- data/lib/kennel/models/dashboard.rb +7 -6
- data/lib/kennel/models/monitor.rb +1 -1
- data/lib/kennel/models/record.rb +5 -4
- data/lib/kennel/models/slo.rb +1 -1
- data/lib/kennel/syncer.rb +2 -1
- data/lib/kennel/template_variables.rb +1 -1
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +2 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c170afd5f8bc8223b9b7d37bf48a1de593d643fa7de785ec8fc26e631bcdf81c
|
4
|
+
data.tar.gz: 89ec3660c0b7a1022a104a6d6b51eda9ec3291a1bb9cf46d2ae303597e66c30b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a68a43cf73743f9f098259dd5c614cdc6ced148d08cf629907f090689804148e01e857a4434f9410607fec338e3cca50f883e4dfe31200e48b80dffbbb7ff379
|
7
|
+
data.tar.gz: d5c5bf8a43c526611162267d6c4babb64a57aab4d0eddbb0cbf9e1fb507f0066528c6e82f7651911fdfd86d74c6ae520b634c7b0de1b799d8d55a1c695f0e457
|
data/Readme.md
CHANGED
@@ -6,8 +6,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
|
|
6
6
|
|
7
7
|
- Documented, reusable, automated, and searchable configuration
|
8
8
|
- Changes are PR reviewed and auditable
|
9
|
-
-
|
10
|
-
- Reliable cleanup with automated deletion
|
9
|
+
- Automated deletion when removed from code
|
11
10
|
|
12
11
|
![](template/github/screen.png?raw=true)
|
13
12
|
<!-- NOT IN template/Readme.md -->
|
@@ -18,7 +17,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
|
|
18
17
|
```Bash
|
19
18
|
git clone git@github.com:your-org/kennel.git
|
20
19
|
git clone git@github.com:grosser/kennel.git seed
|
21
|
-
mv seed/
|
20
|
+
mv seed/template/* kennel/
|
22
21
|
cd kennel && git add . && git commit -m 'initial'
|
23
22
|
```
|
24
23
|
- add a basic projects and teams so others can copy-paste to get started
|
@@ -31,7 +30,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
|
|
31
30
|
|
32
31
|
- `projects/` monitors/dashboards/etc scoped by project
|
33
32
|
- `teams/` team definitions
|
34
|
-
- `parts/` monitors/
|
33
|
+
- `parts/` monitors/dashboards/etc that are used by multiple projects
|
35
34
|
- `generated/` projects as json, to show current state and proposed changes in PRs
|
36
35
|
|
37
36
|
## Workflows
|
@@ -91,7 +91,7 @@ module Kennel
|
|
91
91
|
# [a, e] -> [[a-w, e-w], [a-w1-w1, e-w1-w1], ...]
|
92
92
|
def widgets_pairs(*pair)
|
93
93
|
result = [pair.map { |d| d[:widgets] || [] }]
|
94
|
-
slots = result.
|
94
|
+
slots = result[0].map(&:size).max
|
95
95
|
slots.times do |i|
|
96
96
|
nested = pair.map { |d| d.dig(:widgets, i, :definition, :widgets) || [] }
|
97
97
|
result << nested if nested.any?(&:any?)
|
@@ -125,22 +125,23 @@ module Kennel
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def resolve_linked_tracking_ids(id_map)
|
128
|
-
as_json[:widgets].
|
128
|
+
widgets = as_json[:widgets].flat_map { |w| [w, *w.dig(:definition, :widgets) || []] }
|
129
|
+
widgets.each do |widget|
|
129
130
|
next unless definition = widget[:definition]
|
130
131
|
case definition[:type]
|
131
132
|
when "uptime"
|
132
133
|
if ids = definition[:monitor_ids]
|
133
134
|
definition[:monitor_ids] = ids.map do |id|
|
134
|
-
tracking_id?(id) ? resolve_link(id, id_map) : id
|
135
|
+
tracking_id?(id) ? resolve_link(id, :monitor, id_map) : id
|
135
136
|
end
|
136
137
|
end
|
137
138
|
when "alert_graph"
|
138
139
|
if (id = definition[:alert_id]) && tracking_id?(id)
|
139
|
-
definition[:alert_id] = resolve_link(id, id_map).to_s
|
140
|
+
definition[:alert_id] = resolve_link(id, :monitor, id_map).to_s
|
140
141
|
end
|
141
142
|
when "slo"
|
142
143
|
if (id = definition[:slo_id]) && tracking_id?(id)
|
143
|
-
definition[:slo_id] = resolve_link(id, id_map).to_s
|
144
|
+
definition[:slo_id] = resolve_link(id, :slo, id_map).to_s
|
144
145
|
end
|
145
146
|
end
|
146
147
|
end
|
@@ -149,7 +150,7 @@ module Kennel
|
|
149
150
|
private
|
150
151
|
|
151
152
|
def tracking_id?(id)
|
152
|
-
id.is_a?(String) &&
|
153
|
+
id.is_a?(String) && id.include?(":")
|
153
154
|
end
|
154
155
|
|
155
156
|
# creates queries from metadata to avoid having to keep q and expression in sync
|
@@ -106,7 +106,7 @@ module Kennel
|
|
106
106
|
if as_json[:type] == "composite"
|
107
107
|
as_json[:query] = as_json[:query].gsub(/%\{(.*?)\}/) do
|
108
108
|
# need force here since it validates the id exists
|
109
|
-
resolve_link($1, id_map, force: true)
|
109
|
+
resolve_link($1, :monitor, id_map, force: true)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
data/lib/kennel/models/record.rb
CHANGED
@@ -54,19 +54,20 @@ module Kennel
|
|
54
54
|
|
55
55
|
private
|
56
56
|
|
57
|
-
def resolve_link(id, id_map, force: false)
|
57
|
+
def resolve_link(id, type, id_map, force: false)
|
58
58
|
found = id_map[id]
|
59
59
|
return found if found && found != :new
|
60
|
+
api_resource = self.class.api_resource
|
60
61
|
|
61
62
|
if found == :new
|
62
63
|
if force
|
63
|
-
invalid! "
|
64
|
+
invalid! "#{api_resource.capitalize} #{id} will be created in the current run and can only be used after that"
|
64
65
|
else
|
65
|
-
Kennel.err.puts "
|
66
|
+
Kennel.err.puts "#{api_resource.capitalize} #{id} will be created in the current run, the next run will link it properly"
|
66
67
|
Kennel::MISSING_ID
|
67
68
|
end
|
68
69
|
else
|
69
|
-
invalid! "Unable to find
|
70
|
+
invalid! "Unable to find #{type} #{id} (does not exist and is not being created by the current run)"
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
data/lib/kennel/models/slo.rb
CHANGED
data/lib/kennel/syncer.rb
CHANGED
@@ -147,7 +147,8 @@ module Kennel
|
|
147
147
|
def print_plan(step, list, color)
|
148
148
|
return if list.empty?
|
149
149
|
list.each do |_, e, a, diff|
|
150
|
-
|
150
|
+
api_resource = (e ? e.class.api_resource : a.fetch(:api_resource))
|
151
|
+
Kennel.out.puts Utils.color(color, "#{step} #{api_resource} #{tracking_id(e&.as_json || a)}")
|
151
152
|
print_diff(diff) if diff # only for update
|
152
153
|
end
|
153
154
|
end
|
@@ -25,7 +25,7 @@ module Kennel
|
|
25
25
|
if bad.any?
|
26
26
|
invalid!(
|
27
27
|
"queries #{bad.join(", ")} must use the template variables #{variables.join(", ")}\n" \
|
28
|
-
"If that is not possible, add `
|
28
|
+
"If that is not possible, add `validate: -> { false } # query foo in bar does not have baz tag`"
|
29
29
|
)
|
30
30
|
end
|
31
31
|
end
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -6,8 +6,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
|
|
6
6
|
|
7
7
|
- Documented, reusable, automated, and searchable configuration
|
8
8
|
- Changes are PR reviewed and auditable
|
9
|
-
-
|
10
|
-
- Reliable cleanup with automated deletion
|
9
|
+
- Automated deletion when removed from code
|
11
10
|
|
12
11
|
![](github/screen.png?raw=true)
|
13
12
|
|
@@ -15,7 +14,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
|
|
15
14
|
|
16
15
|
- `projects/` monitors/dashboards/etc scoped by project
|
17
16
|
- `teams/` team definitions
|
18
|
-
- `parts/` monitors/
|
17
|
+
- `parts/` monitors/dashboards/etc that are used by multiple projects
|
19
18
|
- `generated/` projects as json, to show current state and proposed changes in PRs
|
20
19
|
|
21
20
|
## Workflows
|
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.61.
|
4
|
+
version: 1.61.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.7.6
|
105
|
+
rubygems_version: 2.7.6.2
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Keep datadog monitors/dashboards/etc in version control, avoid chaotic management
|