kennel 2.2.1 → 2.22.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.
data/template/Readme.md CHANGED
@@ -188,6 +188,7 @@ end
188
188
  class MyProject < Kennel::Models::Project
189
189
  defaults(
190
190
  team: -> { Teams::MyTeam.new }, # use existing team or create new one in teams/
191
+ # kennel_id: -> { "my_project" } # Custom kennel_id (default is snake_cased class name)
191
192
  parts: -> {
192
193
  [
193
194
  Kennel::Models::Monitor.new(
@@ -231,6 +232,7 @@ Remove the code that created the resource. The next update will delete it (see a
231
232
  - go to [datadog dashboard UI](https://app.datadoghq.com/dashboard/lists) and click on _New Dashboard_ to find a dashboard
232
233
  - run `URL='https://app.datadoghq.com/dashboard/bet-foo-bar' bundle exec rake kennel:import` and copy the output
233
234
  - find or create a project in `projects/`
235
+ - tags: only `team:` tags are submitted to datadog since nothing else is supported
234
236
  - add a dashboard to `parts: [` list, for example:
235
237
  ```Ruby
236
238
  class MyProject < Kennel::Models::Project
@@ -246,8 +248,9 @@ Remove the code that created the resource. The next update will delete it (see a
246
248
  template_variables: -> { ["environment"] }, # see https://docs.datadoghq.com/api/?lang=ruby#timeboards
247
249
  kennel_id: -> { "overview-dashboard" }, # make up a unique name
248
250
  layout_type: -> { "ordered" },
251
+ widgets: -> { "... raw widget definitions, most flexible ..." },
249
252
  definitions: -> {
250
- [ # An array or arrays, each one is a graph in the dashboard, alternatively a hash for finer control
253
+ [ # each element is a graph in the dashboard, alternatively a hash for complete control just like in `widgets`
251
254
  [
252
255
  # title, viz, type, query, edit an existing graph and see the json definition
253
256
  "Graph name", "timeseries", "area", "sum:mystats.foobar{$environment}"
@@ -256,7 +259,7 @@ Remove the code that created the resource. The next update will delete it (see a
256
259
  # queries can be an Array as well, this will generate multiple requests
257
260
  # for a single graph
258
261
  "Graph name", "timeseries", "area", ["sum:mystats.foobar{$environment}", "sum:mystats.success{$environment}"],
259
- # add events too ...
262
+ # add events too ... (also supports `:markers` and `:precision`)
260
263
  events: [{q: "tags:foobar,deploy", tags_execution: "and"}]
261
264
  ]
262
265
  ]
@@ -268,6 +271,55 @@ Remove the code that created the resource. The next update will delete it (see a
268
271
  end
269
272
  ```
270
273
 
274
+ ### Adding a new synthetic test
275
+ - go to [datadog synthetic tests UI](https://app.datadoghq.com/synthetics/tests) and click on _New_ to create a test
276
+ - see below
277
+
278
+ ### Updating an existing synthetic test
279
+ - go to [datadog synthetic tests UI](https://app.datadoghq.com/synthetics/tests) to find a test
280
+ - run `URL='https://app.datadoghq.com/synthetics/details/abc-def-ghi' bundle exec rake kennel:import` and copy the output
281
+ - find or create a project in `projects/`
282
+ - add a synthetic test to `parts: [` list, for example:
283
+ ```Ruby
284
+ class MyProject < Kennel::Models::Project
285
+ defaults(
286
+ team: -> { Teams::MyTeam.new },
287
+ parts: -> {
288
+ [
289
+ Kennel::Models::SyntheticTest.new(
290
+ self,
291
+ id: -> { "abc-def-ghi" }, # id from datadog url, not needed when creating a new test
292
+ kennel_id: -> { "my-api-test" },
293
+ name: -> { "My API Test" },
294
+ type: -> { "api" },
295
+ subtype: -> { "http" },
296
+ locations: -> { :all }, # use all locations, or specify: ["aws:us-east-1", "aws:eu-west-1"]
297
+ message: -> {
298
+ <<~TEXT
299
+ API check failed!
300
+ #{super()}
301
+ TEXT
302
+ },
303
+ options: -> {
304
+ {
305
+ tick_every: 60,
306
+ min_failure_duration: 0,
307
+ min_location_failed: 1
308
+ }
309
+ },
310
+ config: -> {
311
+ {
312
+ assertions: [{ type: "statusCode", operator: "is", target: 200 }],
313
+ request: { method: "GET", url: "https://example.com/health" }
314
+ }
315
+ }
316
+ )
317
+ ]
318
+ }
319
+ )
320
+ end
321
+ ```
322
+
271
323
  ### Updating existing resources with id
272
324
  Setting `id` makes kennel take over a manually created datadog resource.
273
325
  When manually creating to import, it is best to remove the `id` and delete the manually created resource.
@@ -309,10 +361,11 @@ module ProjectA
309
361
  - Use `TRACKING_ID=<project-kennel_id>:<resource-kennel_id>` for single resource:
310
362
 
311
363
  Use the project kennel_id and the resources kennel_id, for example `class ProjectA` and `FooAlert` would give `project_a:foo_alert`.
364
+ Alternatively use the path of the generated file `TRACKING_ID=generated/project_a/foo_alert.json`
312
365
 
313
366
  ### Skipping validations
314
367
  Some validations might be too strict for your usecase or just wrong, please [open an issue](https://github.com/grosser/kennel/issues) and
315
- to unblock use the `validate: -> { false }` option.
368
+ to unblock use `ignored_errors: [:name_of_the_error]`.
316
369
 
317
370
  ### Linking resources with kennel_id
318
371
  Link resources with their kennel_id in the format `project kennel_id` + `:` + `resource kennel_id`,
@@ -321,7 +374,7 @@ so they can be created in a single update and can be re-created if any of them i
321
374
 
322
375
  |Resource|Type|Syntax|
323
376
  |---|---|---|
324
- |Dashboard|uptime|`monitor: {id: "foo:bar"}`|
377
+ |Dashboard|uptime|`monitor_ids: ["foo:bar", "foo:baz"]`|
325
378
  |Dashboard|alert_graph|`alert_id: "foo:bar"`|
326
379
  |Dashboard|slo|`slo_id: "foo:bar"`|
327
380
  |Dashboard|timeseries|`queries: [{ data_source: "slo", slo_id: "foo:bar" }]`|
@@ -370,6 +423,12 @@ Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a
370
423
  ### Validating mentions work
371
424
  `rake kennel:validate_mentions` should run as part of CI
372
425
 
426
+ Use `KNOWN=foo@bar.com,baz@bar.com` to exempt mentions that are not returned by the API.
427
+ Use `KNOWN_RANDOM=@sns-foo,@sns-bar` to ignore for example SNS handles that are randomly invalid in the API.
428
+
429
+ ### Validating planned changes
430
+ `rake kennel:validate_plan` validates planned monitor and dashboard changes against the Datadog API.
431
+
373
432
  ### Grepping through all of datadog
374
433
  ```Bash
375
434
  rake kennel:dump > tmp/dump
@@ -387,6 +446,9 @@ https://foo.datadog.com/monitor/123
387
446
  ### Find all monitors with No-Data
388
447
  `rake kennel:nodata TAG=team:foo`
389
448
 
449
+ - `FORMAT=json` to output as JSON with tracking IDs
450
+ - `THRESHOLD_DAYS=N` to filter to monitors with N+ days in no-data
451
+
390
452
  ### Finding the tracking id of a resource
391
453
 
392
454
  When trying to link resources together, this avoids having to go through datadog UI.
metadata CHANGED
@@ -1,71 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: diff-lcs
13
+ name: benchmark
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.5'
18
+ version: '0.5'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '1.5'
25
+ version: '0.5'
27
26
  - !ruby/object:Gem::Dependency
28
- name: faraday
27
+ name: diff-lcs
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '1.8'
32
+ version: '1.5'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '1.8'
39
+ version: '1.5'
41
40
  - !ruby/object:Gem::Dependency
42
- name: hashdiff
41
+ name: faraday
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '1.0'
46
+ version: '2.0'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '1.0'
53
+ version: '2.0'
55
54
  - !ruby/object:Gem::Dependency
56
- name: net-http-persistent
55
+ name: hashdiff
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '4.0'
60
+ version: '1.0'
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '4.0'
67
+ version: '1.0'
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: zeitwerk
71
70
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +79,6 @@ dependencies:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
81
  version: '2.4'
83
- description:
84
82
  email: michael@grosser.it
85
83
  executables: []
86
84
  extensions: []
@@ -119,6 +117,12 @@ files:
119
117
  - lib/kennel/syncer/types.rb
120
118
  - lib/kennel/tags_validation.rb
121
119
  - lib/kennel/tasks.rb
120
+ - lib/kennel/tasks/dump.rb
121
+ - lib/kennel/tasks/import.rb
122
+ - lib/kennel/tasks/nodata.rb
123
+ - lib/kennel/tasks/tracking_id.rb
124
+ - lib/kennel/tasks/validate_mentions.rb
125
+ - lib/kennel/tasks/validate_plan.rb
122
126
  - lib/kennel/template_variables.rb
123
127
  - lib/kennel/unmuted_alerts.rb
124
128
  - lib/kennel/utils.rb
@@ -128,7 +132,6 @@ homepage: https://github.com/grosser/kennel
128
132
  licenses:
129
133
  - MIT
130
134
  metadata: {}
131
- post_install_message:
132
135
  rdoc_options: []
133
136
  require_paths:
134
137
  - lib
@@ -136,15 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
139
  requirements:
137
140
  - - ">="
138
141
  - !ruby/object:Gem::Version
139
- version: 3.3.0
142
+ version: 4.0.0
140
143
  required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  requirements:
142
145
  - - ">="
143
146
  - !ruby/object:Gem::Version
144
147
  version: '0'
145
148
  requirements: []
146
- rubygems_version: 3.5.22
147
- signing_key:
149
+ rubygems_version: 4.0.3
148
150
  specification_version: 4
149
151
  summary: Keep datadog monitors/dashboards/etc in version control, avoid chaotic management
150
152
  via UI