kennel 1.82.0 → 1.83.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +11 -1
- data/lib/kennel/models/dashboard.rb +1 -1
- data/lib/kennel/models/monitor.rb +1 -1
- data/lib/kennel/models/record.rb +4 -0
- data/lib/kennel/models/slo.rb +1 -1
- data/lib/kennel/syncer.rb +2 -2
- data/lib/kennel/tasks.rb +20 -1
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3c766383bf7f533e74b935a6faf2272e552bb7c974fa15261c70aa9d31e800
|
4
|
+
data.tar.gz: 339c1dcad92fc215d2a26b7091bbe57dc98d3f6ed5a01666e1ee683162bf20e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97abfc77652ab1afb6192c97f038dc6caa33a2f8aa505c62c6782fef1359b431d93cf293c737d9f2ed03c9bb4d22d0474ac916586aa7ed15863900dc8eb1791d
|
7
|
+
data.tar.gz: 13e247e4ab000410155b9f4835686168a2017c1ee2fd8b4e0f6619c54f0b055581b1acc855d12ac06b0ed3920782722fbffa1d303ea7aa04ed92104ab1ec6908
|
data/Readme.md
CHANGED
@@ -273,9 +273,19 @@ Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a
|
|
273
273
|
|
274
274
|
### Grepping through all of datadog
|
275
275
|
|
276
|
-
|
276
|
+
```Bash
|
277
|
+
rake kennel:dump > tmp/dump
|
278
|
+
cat tmp/dump | grep foo
|
279
|
+
```
|
277
280
|
focus on a single type: `TYPE=monitors`
|
278
281
|
|
282
|
+
Show full resources or just their urls by pattern:
|
283
|
+
```Bash
|
284
|
+
rake kennel:dump_grep DUMP=tmp/dump PATTERN=foo URLS=true
|
285
|
+
https://foo.datadog.com/dasboard/123
|
286
|
+
https://foo.datadog.com/monitor/123
|
287
|
+
```
|
288
|
+
|
279
289
|
### Find all monitors with No-Data
|
280
290
|
|
281
291
|
`rake kennel:nodata TAG=team:foo`
|
data/lib/kennel/models/record.rb
CHANGED
data/lib/kennel/models/slo.rb
CHANGED
data/lib/kennel/syncer.rb
CHANGED
@@ -41,12 +41,12 @@ module Kennel
|
|
41
41
|
reply = @api.create e.class.api_resource, e.as_json
|
42
42
|
id = reply.fetch(:id)
|
43
43
|
populate_id_map [reply] # allow resolving ids we could previously no resolve
|
44
|
-
Kennel.out.puts "Created #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(id)}"
|
44
|
+
Kennel.out.puts "Created #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.class.url(id)}"
|
45
45
|
end
|
46
46
|
|
47
47
|
each_resolved @update do |id, e|
|
48
48
|
@api.update e.class.api_resource, id, e.as_json
|
49
|
-
Kennel.out.puts "Updated #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(id)}"
|
49
|
+
Kennel.out.puts "Updated #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.class.url(id)}"
|
50
50
|
end
|
51
51
|
|
52
52
|
@delete.each do |id, _, a|
|
data/lib/kennel/tasks.rb
CHANGED
@@ -130,7 +130,7 @@ namespace :kennel do
|
|
130
130
|
if type = ENV["TYPE"]
|
131
131
|
[type]
|
132
132
|
else
|
133
|
-
Kennel::Models::Record.
|
133
|
+
Kennel::Models::Record.api_resource_map.keys
|
134
134
|
end
|
135
135
|
api = Kennel.send(:api)
|
136
136
|
list = nil
|
@@ -141,11 +141,30 @@ namespace :kennel do
|
|
141
141
|
api.fill_details!(resource, list)
|
142
142
|
end
|
143
143
|
list.each do |r|
|
144
|
+
r[:api_resource] = resource
|
144
145
|
Kennel.out.puts JSON.pretty_generate(r)
|
145
146
|
end
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
150
|
+
desc "Find items from dump by pattern DUMP= PATTERN= [URLS=true]"
|
151
|
+
task dump_grep: :environment do
|
152
|
+
file = ENV.fetch("DUMP")
|
153
|
+
pattern = Regexp.new ENV.fetch("PATTERN")
|
154
|
+
items = File.read(file).gsub("}\n{", "}--SPLIT--{").split("--SPLIT--")
|
155
|
+
models = Kennel::Models::Record.api_resource_map
|
156
|
+
found = items.grep(pattern)
|
157
|
+
exit 1 if found.empty?
|
158
|
+
found.each do |resource|
|
159
|
+
if ENV["URLS"]
|
160
|
+
parsed = JSON.parse(resource)
|
161
|
+
Kennel.out.puts models[parsed.fetch("api_resource")].url(parsed.fetch("id"))
|
162
|
+
else
|
163
|
+
Kennel.out.puts resource
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
149
168
|
task :environment do
|
150
169
|
require "kennel"
|
151
170
|
gem "dotenv"
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -255,9 +255,19 @@ Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a
|
|
255
255
|
|
256
256
|
### Grepping through all of datadog
|
257
257
|
|
258
|
-
|
258
|
+
```Bash
|
259
|
+
rake kennel:dump > tmp/dump
|
260
|
+
cat tmp/dump | grep foo
|
261
|
+
```
|
259
262
|
focus on a single type: `TYPE=monitors`
|
260
263
|
|
264
|
+
Show full resources or just their urls by pattern:
|
265
|
+
```Bash
|
266
|
+
rake kennel:dump_grep DUMP=tmp/dump PATTERN=foo URLS=true
|
267
|
+
https://foo.datadog.com/dasboard/123
|
268
|
+
https://foo.datadog.com/monitor/123
|
269
|
+
```
|
270
|
+
|
261
271
|
### Find all monitors with No-Data
|
262
272
|
|
263
273
|
`rake kennel:nodata TAG=team:foo`
|