kennel 1.54.0 → 1.55.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff469d7ae1bcb0d5dc6fb5d867c9dad761b5f2d07159ea147d99620544ec2580
4
- data.tar.gz: e3322d92c13faee31f51ef53042cc0c768a0c85cfa0644d4fb2dafcf67f3e03a
3
+ metadata.gz: adc230a06e4f7f969147e0c299ba61c4536d5623de432cfe3e247bece944962a
4
+ data.tar.gz: ae6d3ebe5db8fe7a5f406cda15e0a85d8a19b8d5f991a9787a63376a01572e70
5
5
  SHA512:
6
- metadata.gz: 18d054b93d83f78b98dabdd584fcec0a99759f32734c2808c32bb64d51042e3087ca36722c88aa61c24707999f7dbefc1aebdd16ce996c964ba3ca2595bec7df
7
- data.tar.gz: d1876da783f71a72287ede64c20c9865622f409ec0857a483161cb1f2914c0e40c3a232165697bee8984ea515d34abfc0beb8eede8b42164d0b324c7805e1468
6
+ metadata.gz: 3013cb61dd5c33a7dd1772b54645d62e7cf7e70bb5202f85950ab4f2a102e723d1583725200da513a54d66020af14ca9c57b63bc50e43b1a27a4d765d478c2fb
7
+ data.tar.gz: 28f5812c2795043927ca2161712d6e16f100cf6999e21fc64c3ee8e557d663c526a30dc9eef3069d2f229a699304d5f1029eb61176c3c51f4f825f5a45ac9e56
data/Readme.md CHANGED
@@ -43,7 +43,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
43
43
  - `cp .env.example .env`
44
44
  - open [Datadog API Settings](https://app.datadoghq.com/account/settings#api)
45
45
  - copy any `API Key` and add it to `.env` as `DATADOG_API_KEY`
46
- - find or create your personal "Application Key" and add it to `.env` as `DATADOG_APP_KEY=` (will be on the last page if new)
46
+ - find or create (check last page) your personal "Application Key" and add it to `.env` as `DATADOG_APP_KEY=`
47
47
  - change the `DATADOG_SUBDOMAIN=app` in `.env` to your companies subdomain if you have one
48
48
  -->
49
49
 
@@ -179,6 +179,10 @@ To link to existing monitors via their kennel_id
179
179
 
180
180
  Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a given datadog monitor tag.
181
181
 
182
+ ### Validating mentions work
183
+
184
+ `rake kennel:validate_mentions` should run as part of CI
185
+
182
186
  ## Examples
183
187
 
184
188
  ### Reusable monitors/dashes/etc
@@ -12,6 +12,35 @@ namespace :kennel do
12
12
  abort "Error during diffing" unless $CHILD_STATUS.success?
13
13
  end
14
14
 
15
+ # ideally do this on every run, but it's slow (~1.5s) and brittle (might not find all + might find false-positives)
16
+ # https://help.datadoghq.com/hc/en-us/requests/254114 for automatic validation
17
+ desc "Verify that all used monitor mentions are valid"
18
+ task validate_mentions: :environment do
19
+ known = Kennel.send(:api)
20
+ .send(:request, :get, "/monitor/notifications")
21
+ .fetch(:handles)
22
+ .values
23
+ .flatten(1)
24
+ .map { |v| v.fetch(:value) }
25
+
26
+ known += ENV["KNOWN"].to_s.split(",")
27
+
28
+ bad = []
29
+ Dir["generated/**/*.json"].each do |f|
30
+ next unless message = JSON.parse(File.read(f))["message"]
31
+ used = message.scan(/\s(@[^\s{,'"]+)/).flatten(1)
32
+ .grep(/^@.*@|^@.*-/) # ignore @here etc handles ... datadog uses @foo@bar.com for emails and @foo-bar for integrations
33
+ (used - known).each { |v| bad << [f, v] }
34
+ end
35
+
36
+ if bad.any?
37
+ subdomain = ENV["DATADOG_SUBDOMAIN"]
38
+ url = (subdomain ? "https://zendesk.datadoghq.com" : "") + "/account/settings"
39
+ puts "Invalid mentions found, either ignore them by adding to `KNOWN` env var or add them via #{url}"
40
+ bad.each { |f, v| puts "Invalid mention #{v} in monitor message of #{f}" }
41
+ end
42
+ end
43
+
15
44
  desc "generate local definitions"
16
45
  task generate: :environment do
17
46
  Kennel.generate
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.54.0"
3
+ VERSION = "1.55.0"
4
4
  end
@@ -26,7 +26,7 @@ Keep datadog monitors/dashboards/etc in version control, avoid chaotic managemen
26
26
  - `cp .env.example .env`
27
27
  - open [Datadog API Settings](https://app.datadoghq.com/account/settings#api)
28
28
  - copy any `API Key` and add it to `.env` as `DATADOG_API_KEY`
29
- - find or create your personal "Application Key" and add it to `.env` as `DATADOG_APP_KEY=` (will be on the last page if new)
29
+ - find or create (check last page) your personal "Application Key" and add it to `.env` as `DATADOG_APP_KEY=`
30
30
  - change the `DATADOG_SUBDOMAIN=app` in `.env` to your companies subdomain if you have one
31
31
 
32
32
  ### Adding a team
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.54.0
4
+ version: 1.55.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: 2019-09-13 00:00:00.000000000 Z
11
+ date: 2019-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday