kennel 1.69.0 → 1.70.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 +2 -2
- data/lib/kennel/models/dashboard.rb +4 -0
- data/lib/kennel/models/monitor.rb +6 -0
- data/lib/kennel/models/record.rb +8 -0
- data/lib/kennel/models/slo.rb +4 -0
- data/lib/kennel/tasks.rb +11 -5
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +2 -2
- 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: 857c5d57edd43c806560c9a97b579398f440ed311dd7b8541e1262af03de51bd
|
4
|
+
data.tar.gz: b75bf7667bcdd473732d1e69231a52a37bdd90366462890a85d39d6325004593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51662e560022e916c3b2e7254cb9dcc4ec331468f06cc29c47f45ea857c1dc49ded3496b9313a06073848abc782576c46d0bfcd410099ababdc5571a19cccc28
|
7
|
+
data.tar.gz: de5dd05943415b655efc290399417853a68477a81a88c098b4812d908e83a19ff06594dbb143f6b3120a41caca2cbbe8d86ef27a8eee449e2d34bc05b1da5140
|
data/Readme.md
CHANGED
@@ -72,7 +72,7 @@ end
|
|
72
72
|
### Updating an existing monitor
|
73
73
|
- use [datadog monitor UI](https://app.datadoghq.com/monitors/manage) to find a monitor
|
74
74
|
- get the `id` from the url
|
75
|
-
- run `
|
75
|
+
- run `URL='https://app.datadoghq.com/monitors/123' bundle exec rake kennel:import` and copy the output
|
76
76
|
- find or create a project in `projects/`
|
77
77
|
- add the monitor to `parts: [` list, for example:
|
78
78
|
```Ruby
|
@@ -118,7 +118,7 @@ end
|
|
118
118
|
### Updating an existing dashboard
|
119
119
|
- go to [datadog dashboard UI](https://app.datadoghq.com/dashboard/lists) and click on _New Dashboard_ to find a dashboard
|
120
120
|
- get the `id` from the url
|
121
|
-
- run `
|
121
|
+
- run `URL='https://app.datadoghq.com/dashboard/bet-foo-bar' bundle exec rake kennel:import` and copy the output
|
122
122
|
- find or create a project in `projects/`
|
123
123
|
- add a dashboard to `parts: [` list, for example:
|
124
124
|
```Ruby
|
@@ -116,6 +116,10 @@ module Kennel
|
|
116
116
|
Utils.path_to_url "/dashboard/#{id}"
|
117
117
|
end
|
118
118
|
|
119
|
+
def self.parse_url(url)
|
120
|
+
url[/\/dashboard\/([a-z\d-]+)/, 1]
|
121
|
+
end
|
122
|
+
|
119
123
|
def resolve_linked_tracking_ids(id_map)
|
120
124
|
widgets = as_json[:widgets].flat_map { |w| [w, *w.dig(:definition, :widgets) || []] }
|
121
125
|
widgets.each do |widget|
|
@@ -120,6 +120,12 @@ module Kennel
|
|
120
120
|
Utils.path_to_url "/monitors##{id}/edit"
|
121
121
|
end
|
122
122
|
|
123
|
+
# datadog uses both / and # as separator in it's links
|
124
|
+
def self.parse_url(url)
|
125
|
+
return unless id = url[/\/monitors[\/#](\d+)/, 1]
|
126
|
+
Integer(id)
|
127
|
+
end
|
128
|
+
|
123
129
|
def self.normalize(expected, actual)
|
124
130
|
super
|
125
131
|
options = actual.fetch(:options)
|
data/lib/kennel/models/record.rb
CHANGED
data/lib/kennel/models/slo.rb
CHANGED
@@ -62,6 +62,10 @@ module Kennel
|
|
62
62
|
Utils.path_to_url "/slo?slo_id=#{id}"
|
63
63
|
end
|
64
64
|
|
65
|
+
def self.parse_url(url)
|
66
|
+
url[/\/slo\?slo_id=([a-z\d]+)/, 1]
|
67
|
+
end
|
68
|
+
|
65
69
|
def resolve_linked_tracking_ids(id_map)
|
66
70
|
as_json[:monitor_ids] = as_json[:monitor_ids].map do |id|
|
67
71
|
id.is_a?(String) ? resolve_link(id, :monitor, id_map) : id
|
data/lib/kennel/tasks.rb
CHANGED
@@ -111,12 +111,18 @@ namespace :kennel do
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
desc "Convert existing resources to copy-
|
114
|
+
desc "Convert existing resources to copy-pasteable definitions to import existing resources (call with URL= or call with RESOURCE= and ID=)"
|
115
115
|
task import: :environment do
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
if (id = ENV["ID"]) && (resource = ENV["RESOURCE"])
|
117
|
+
id = Integer(id) if id =~ /^\d+$/ # dashboards can have alphanumeric ids
|
118
|
+
elsif (url = ENV["URL"])
|
119
|
+
resource, id = Kennel::Models::Record.parse_any_url(url) || Kennel::Tasks.abort("Unable to parse url")
|
120
|
+
else
|
121
|
+
possible_resources = Kennel::Models::Record.subclasses.map(&:api_resource)
|
122
|
+
Kennel::Tasks.abort("Call with URL= or call with RESOURCE=#{possible_resources.join(" or ")} and ID=")
|
123
|
+
end
|
124
|
+
|
125
|
+
Kennel.out.puts Kennel::Importer.new(Kennel.send(:api)).import(resource, id)
|
120
126
|
end
|
121
127
|
|
122
128
|
desc "Dump ALL of datadog config as raw json ... useful for grep/search TYPE=slo|monitor|dashboard"
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -54,7 +54,7 @@ end
|
|
54
54
|
### Updating an existing monitor
|
55
55
|
- use [datadog monitor UI](https://app.datadoghq.com/monitors/manage) to find a monitor
|
56
56
|
- get the `id` from the url
|
57
|
-
- run `
|
57
|
+
- run `URL='https://app.datadoghq.com/monitors/123' bundle exec rake kennel:import` and copy the output
|
58
58
|
- find or create a project in `projects/`
|
59
59
|
- add the monitor to `parts: [` list, for example:
|
60
60
|
```Ruby
|
@@ -100,7 +100,7 @@ end
|
|
100
100
|
### Updating an existing dashboard
|
101
101
|
- go to [datadog dashboard UI](https://app.datadoghq.com/dashboard/lists) and click on _New Dashboard_ to find a dashboard
|
102
102
|
- get the `id` from the url
|
103
|
-
- run `
|
103
|
+
- run `URL='https://app.datadoghq.com/dashboard/bet-foo-bar' bundle exec rake kennel:import` and copy the output
|
104
104
|
- find or create a project in `projects/`
|
105
105
|
- add a dashboard to `parts: [` list, for example:
|
106
106
|
```Ruby
|
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.70.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: 2020-05-
|
11
|
+
date: 2020-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|