kennel 1.97.0 → 1.98.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +18 -16
- data/lib/kennel/models/monitor.rb +4 -2
- data/lib/kennel/models/project.rb +1 -1
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +18 -12
- 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: 94cb1a40566de5e275526cfb3c28b8c36394ca22edab465493ace5107037f728
|
4
|
+
data.tar.gz: d1adb172f9d04b610e76538eb1ce1fc68bc7a4615554819eb98bb5def0d9cc8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d0f7967089bbc6bc7e9fdd8321ce6264c40d637f1e5e3bfd8be46ea3a69aad1e8894818b4f2af814d290456248dcd7d646a141fc27011eca472638cfed73f6
|
7
|
+
data.tar.gz: b48cc148859210b9af80e6ecfcfc8d3fbbbe3895bd28ae071cc3459eee353b5e0976df0e9ea0927ed196cb52be83f68e9e0d02b21503e8523101101a263fb61d
|
data/Readme.md
CHANGED
@@ -16,7 +16,6 @@ Manage Datadog Monitors / Dashboards / Slos as code
|
|
16
16
|
![](template/github/screen.png?raw=true)
|
17
17
|
|
18
18
|
### Example code
|
19
|
-
|
20
19
|
```Ruby
|
21
20
|
# teams/foo.rb
|
22
21
|
module Teams
|
@@ -52,9 +51,7 @@ end
|
|
52
51
|
```
|
53
52
|
|
54
53
|
<!-- NOT IN template/Readme.md -->
|
55
|
-
|
56
54
|
## Installation
|
57
|
-
|
58
55
|
- create a new private `kennel` repo for your organization (do not fork this repo)
|
59
56
|
- use the template folder as starting point:
|
60
57
|
```Bash
|
@@ -70,14 +67,12 @@ end
|
|
70
67
|
<!-- NOT IN -->
|
71
68
|
|
72
69
|
## Structure
|
73
|
-
|
74
70
|
- `projects/` monitors/dashboards/etc scoped by project
|
75
71
|
- `teams/` team definitions
|
76
72
|
- `parts/` monitors/dashboards/etc that are used by multiple projects
|
77
73
|
- `generated/` projects as json, to show current state and proposed changes in PRs
|
78
74
|
|
79
75
|
## Workflows
|
80
|
-
|
81
76
|
<!-- ONLY IN template/Readme.md
|
82
77
|
### Setup
|
83
78
|
- clone the repo
|
@@ -91,7 +86,6 @@ end
|
|
91
86
|
-->
|
92
87
|
|
93
88
|
### Adding a team
|
94
|
-
|
95
89
|
- `mention` is used for all team monitors via `super()`
|
96
90
|
- `renotify_interval` is used for all team monitors (defaults to `0` / off)
|
97
91
|
- `tags` is used for all team monitors/dashboards (defaults to `team:<team-name>`)
|
@@ -208,14 +202,30 @@ When manually creating to import, it is best to remove the `id` and delete the m
|
|
208
202
|
When an `id` is set and the original resource is deleted, kennel will fail to update,
|
209
203
|
removing the `id` will cause kennel to create a new resource in datadog.
|
210
204
|
|
205
|
+
### Organizing many projects
|
206
|
+
Having many projects (and their sub-resources) can quickly get out of hand.
|
211
207
|
|
212
|
-
|
208
|
+
Use this class structure to keep things organized:
|
209
|
+
```ruby
|
210
|
+
# projects/project_a/base.rb
|
211
|
+
module ProjectA
|
212
|
+
class Base < Kennel::Models::Project
|
213
|
+
defaults(
|
214
|
+
kennel_id: -> { "project_a" },
|
215
|
+
...
|
216
|
+
|
217
|
+
# projects/project_a/monitors/foo_alert.rb
|
218
|
+
module ProjectA
|
219
|
+
module Monitors
|
220
|
+
class FooAlert < Kennel::Modesl::Monitor
|
221
|
+
...
|
222
|
+
```
|
213
223
|
|
224
|
+
### Skipping validations
|
214
225
|
Some validations might be too strict for your usecase or just wrong, please [open an issue](https://github.com/grosser/kennel/issues) and
|
215
226
|
to unblock use the `validate: -> { false }` option.
|
216
227
|
|
217
228
|
### Linking resources with kennel_id
|
218
|
-
|
219
229
|
Link resources with their kennel_id in the format `project kennel_id` + `:` + `resource kennel_id`,
|
220
230
|
this should be used to create dependent resources like monitor + slos,
|
221
231
|
so they can be created in a single update and can be re-created if any of them is deleted.
|
@@ -230,13 +240,11 @@ so they can be created in a single update and can be re-created if any of them i
|
|
230
240
|
|Slo|monitor|`monitor_ids: -> ["foo:bar"]`|
|
231
241
|
|
232
242
|
### Debugging changes locally
|
233
|
-
|
234
243
|
- rebase on updated `master` to not undo other changes
|
235
244
|
- figure out project name by converting the class name to snake-case
|
236
245
|
- 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)
|
237
246
|
|
238
247
|
### Reuse
|
239
|
-
|
240
248
|
Add to `parts/<folder>`.
|
241
249
|
|
242
250
|
```Ruby
|
@@ -266,15 +274,12 @@ end
|
|
266
274
|
## Helpers
|
267
275
|
|
268
276
|
### Listing un-muted alerts
|
269
|
-
|
270
277
|
Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a given datadog monitor tag.
|
271
278
|
|
272
279
|
### Validating mentions work
|
273
|
-
|
274
280
|
`rake kennel:validate_mentions` should run as part of CI
|
275
281
|
|
276
282
|
### Grepping through all of datadog
|
277
|
-
|
278
283
|
```Bash
|
279
284
|
rake kennel:dump > tmp/dump
|
280
285
|
cat tmp/dump | grep foo
|
@@ -289,7 +294,6 @@ https://foo.datadog.com/monitor/123
|
|
289
294
|
```
|
290
295
|
|
291
296
|
### Find all monitors with No-Data
|
292
|
-
|
293
297
|
`rake kennel:nodata TAG=team:foo`
|
294
298
|
|
295
299
|
<!-- NOT IN template/Readme.md -->
|
@@ -297,11 +301,9 @@ https://foo.datadog.com/monitor/123
|
|
297
301
|
## Development
|
298
302
|
|
299
303
|
### Benchmarking
|
300
|
-
|
301
304
|
Setting `FORCE_GET_CACHE=true` will cache all get requests, which makes benchmarking improvements more reliable.
|
302
305
|
|
303
306
|
### Integration testing
|
304
|
-
|
305
307
|
```Bash
|
306
308
|
rake play
|
307
309
|
cd template
|
@@ -19,7 +19,6 @@ module Kennel
|
|
19
19
|
MONITOR_OPTION_DEFAULTS = {
|
20
20
|
evaluation_delay: nil,
|
21
21
|
new_host_delay: 300,
|
22
|
-
new_group_delay: 60,
|
23
22
|
timeout_h: 0,
|
24
23
|
renotify_interval: 0,
|
25
24
|
notify_audit: false,
|
@@ -46,7 +45,7 @@ module Kennel
|
|
46
45
|
no_data_timeframe: -> { 60 },
|
47
46
|
notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
|
48
47
|
new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
|
49
|
-
new_group_delay: -> {
|
48
|
+
new_group_delay: -> { nil },
|
50
49
|
tags: -> { @project.tags },
|
51
50
|
timeout_h: -> { MONITOR_OPTION_DEFAULTS.fetch(:timeout_h) },
|
52
51
|
evaluation_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:evaluation_delay) },
|
@@ -109,6 +108,9 @@ module Kennel
|
|
109
108
|
options[:threshold_windows] = windows
|
110
109
|
end
|
111
110
|
|
111
|
+
# Datadog requires only either new_group_delay or new_host_delay, never both
|
112
|
+
options.delete(options[:new_group_delay] ? :new_host_delay : :new_group_delay)
|
113
|
+
|
112
114
|
validate_json(data) if validate
|
113
115
|
|
114
116
|
@as_json = data
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -16,7 +16,6 @@ Manage Datadog Monitors / Dashboards / Slos as code
|
|
16
16
|
![](github/screen.png?raw=true)
|
17
17
|
|
18
18
|
### Example code
|
19
|
-
|
20
19
|
```Ruby
|
21
20
|
# teams/foo.rb
|
22
21
|
module Teams
|
@@ -53,14 +52,12 @@ end
|
|
53
52
|
|
54
53
|
|
55
54
|
## Structure
|
56
|
-
|
57
55
|
- `projects/` monitors/dashboards/etc scoped by project
|
58
56
|
- `teams/` team definitions
|
59
57
|
- `parts/` monitors/dashboards/etc that are used by multiple projects
|
60
58
|
- `generated/` projects as json, to show current state and proposed changes in PRs
|
61
59
|
|
62
60
|
## Workflows
|
63
|
-
|
64
61
|
### Setup
|
65
62
|
- clone the repo
|
66
63
|
- `gem install bundler && bundle install`
|
@@ -72,7 +69,6 @@ end
|
|
72
69
|
- verify it works by running `rake plan`, it might show some diff, but should not crash
|
73
70
|
|
74
71
|
### Adding a team
|
75
|
-
|
76
72
|
- `mention` is used for all team monitors via `super()`
|
77
73
|
- `renotify_interval` is used for all team monitors (defaults to `0` / off)
|
78
74
|
- `tags` is used for all team monitors/dashboards (defaults to `team:<team-name>`)
|
@@ -189,14 +185,30 @@ When manually creating to import, it is best to remove the `id` and delete the m
|
|
189
185
|
When an `id` is set and the original resource is deleted, kennel will fail to update,
|
190
186
|
removing the `id` will cause kennel to create a new resource in datadog.
|
191
187
|
|
188
|
+
### Organizing many projects
|
189
|
+
Having many projects (and their sub-resources) can quickly get out of hand.
|
192
190
|
|
193
|
-
|
191
|
+
Use this class structure to keep things organized:
|
192
|
+
```ruby
|
193
|
+
# projects/project_a/base.rb
|
194
|
+
module ProjectA
|
195
|
+
class Base < Kennel::Models::Project
|
196
|
+
defaults(
|
197
|
+
kennel_id: -> { "project_a" },
|
198
|
+
...
|
199
|
+
|
200
|
+
# projects/project_a/monitors/foo_alert.rb
|
201
|
+
module ProjectA
|
202
|
+
module Monitors
|
203
|
+
class FooAlert < Kennel::Modesl::Monitor
|
204
|
+
...
|
205
|
+
```
|
194
206
|
|
207
|
+
### Skipping validations
|
195
208
|
Some validations might be too strict for your usecase or just wrong, please [open an issue](https://github.com/grosser/kennel/issues) and
|
196
209
|
to unblock use the `validate: -> { false }` option.
|
197
210
|
|
198
211
|
### Linking resources with kennel_id
|
199
|
-
|
200
212
|
Link resources with their kennel_id in the format `project kennel_id` + `:` + `resource kennel_id`,
|
201
213
|
this should be used to create dependent resources like monitor + slos,
|
202
214
|
so they can be created in a single update and can be re-created if any of them is deleted.
|
@@ -211,13 +223,11 @@ so they can be created in a single update and can be re-created if any of them i
|
|
211
223
|
|Slo|monitor|`monitor_ids: -> ["foo:bar"]`|
|
212
224
|
|
213
225
|
### Debugging changes locally
|
214
|
-
|
215
226
|
- rebase on updated `master` to not undo other changes
|
216
227
|
- figure out project name by converting the class name to snake-case
|
217
228
|
- 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)
|
218
229
|
|
219
230
|
### Reuse
|
220
|
-
|
221
231
|
Add to `parts/<folder>`.
|
222
232
|
|
223
233
|
```Ruby
|
@@ -247,15 +257,12 @@ end
|
|
247
257
|
## Helpers
|
248
258
|
|
249
259
|
### Listing un-muted alerts
|
250
|
-
|
251
260
|
Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a given datadog monitor tag.
|
252
261
|
|
253
262
|
### Validating mentions work
|
254
|
-
|
255
263
|
`rake kennel:validate_mentions` should run as part of CI
|
256
264
|
|
257
265
|
### Grepping through all of datadog
|
258
|
-
|
259
266
|
```Bash
|
260
267
|
rake kennel:dump > tmp/dump
|
261
268
|
cat tmp/dump | grep foo
|
@@ -270,6 +277,5 @@ https://foo.datadog.com/monitor/123
|
|
270
277
|
```
|
271
278
|
|
272
279
|
### Find all monitors with No-Data
|
273
|
-
|
274
280
|
`rake kennel:nodata TAG=team:foo`
|
275
281
|
|
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.98.2
|
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-10-
|
11
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|