kennel 1.79.0 → 1.80.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 +4 -4
- data/Readme.md +2 -1
- data/lib/kennel.rb +36 -8
- data/lib/kennel/models/monitor.rb +5 -3
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +2 -1
- 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: 0cc9d71dff0d4c4bf8a29d9c58c1b62efbb739f3ebdc0d63fb7bd1a3e1cfec7c
|
4
|
+
data.tar.gz: 312fbda2e1577d071ba7cad7a6c5571b6b3913517cc3e5e9b92f7858637f96dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d07c6d405178e7114c1ebaf67ce3f92a09a411208d20353bf7d07f453093e322b98f2e8e2f501cf902a601fafa1b352b5fa19bff9d54f1d042e87fc7ef81277
|
7
|
+
data.tar.gz: 9d681c94f1d61bbc60a098ea0b6fe12e3efc5b6e3c771ec49743db8e6edaae1c83a64ae322a9f5759fc677465b199842f0401c8a38973d1bbaa14157f53f94da
|
data/Readme.md
CHANGED
@@ -84,7 +84,7 @@ end
|
|
84
84
|
- `cp .env.example .env`
|
85
85
|
- open [Datadog API Settings](https://app.datadoghq.com/account/settings#api)
|
86
86
|
- create a `API Key` or get an existing one from an admin, then add it to `.env` as `DATADOG_API_KEY`
|
87
|
-
-
|
87
|
+
- open [Datadog API Settings](https://app.datadoghq.com/access/application-keys) and create a new key, then add it to `.env` as `DATADOG_APP_KEY=`
|
88
88
|
- change the `DATADOG_SUBDOMAIN=app` in `.env` to your companies subdomain if you have one
|
89
89
|
- verify it works by running `rake plan`, it might show some diff, but should not crash
|
90
90
|
-->
|
@@ -219,6 +219,7 @@ To link to existing monitors via their kennel_id `projects kennel_id` + `:` + `m
|
|
219
219
|
- Screens `uptime` widgets can use `monitor: {id: "foo:bar"}`
|
220
220
|
- Screens `alert_graph` widgets can use `alert_id: "foo:bar"`
|
221
221
|
- Monitors `composite` can use `query: -> { "%{foo:bar} || %{foo:baz}" }`
|
222
|
+
- Monitors `slo alert` can use `query: -> { "error_budget(\"%{foo:bar}\").over(\"7d\") > 123.0" }`
|
222
223
|
- Slos can use `monitor_ids: -> ["foo:bar"]`
|
223
224
|
|
224
225
|
### Debugging changes locally
|
data/lib/kennel.rb
CHANGED
@@ -39,12 +39,7 @@ module Kennel
|
|
39
39
|
attr_accessor :out, :err
|
40
40
|
|
41
41
|
def generate
|
42
|
-
|
43
|
-
generated.each do |part|
|
44
|
-
path = "generated/#{part.tracking_id.sub(":", "/")}.json"
|
45
|
-
FileUtils.mkdir_p(File.dirname(path))
|
46
|
-
File.write(path, JSON.pretty_generate(part.as_json) << "\n")
|
47
|
-
end
|
42
|
+
store generated
|
48
43
|
end
|
49
44
|
|
50
45
|
def plan
|
@@ -58,6 +53,35 @@ module Kennel
|
|
58
53
|
|
59
54
|
private
|
60
55
|
|
56
|
+
def store(parts)
|
57
|
+
Progress.progress "Storing" do
|
58
|
+
old = Dir["generated/**/*"]
|
59
|
+
used = []
|
60
|
+
|
61
|
+
Utils.parallel(parts, max: 2) do |part|
|
62
|
+
path = "generated/#{part.tracking_id.tr("/", ":").sub(":", "/")}.json"
|
63
|
+
used << File.dirname(path) # only 1 level of sub folders, so this is safe
|
64
|
+
used << path
|
65
|
+
write_file_if_necessary(path, JSON.pretty_generate(part.as_json) << "\n")
|
66
|
+
end
|
67
|
+
|
68
|
+
# deleting all is slow, so only delete the extras
|
69
|
+
(old - used).each { |p| FileUtils.rm_rf(p) }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def write_file_if_necessary(path, content)
|
74
|
+
# 99% case
|
75
|
+
begin
|
76
|
+
return if File.read(path) == content
|
77
|
+
rescue Errno::ENOENT
|
78
|
+
FileUtils.mkdir_p(File.dirname(path))
|
79
|
+
end
|
80
|
+
|
81
|
+
# slow 1% case
|
82
|
+
File.write(path, content)
|
83
|
+
end
|
84
|
+
|
61
85
|
def syncer
|
62
86
|
@syncer ||= Syncer.new(api, generated, project: ENV["PROJECT"])
|
63
87
|
end
|
@@ -73,8 +97,12 @@ module Kennel
|
|
73
97
|
parts = Models::Project.recursive_subclasses.flat_map do |project_class|
|
74
98
|
project_class.new.validated_parts
|
75
99
|
end
|
76
|
-
parts.
|
77
|
-
|
100
|
+
parts.group_by(&:tracking_id).each do |tracking_id, same|
|
101
|
+
next if same.size == 1
|
102
|
+
raise <<~ERROR
|
103
|
+
#{tracking_id} is defined #{same.size} times
|
104
|
+
use a different `kennel_id` when defining multiple projects/monitors/dashboards to avoid this conflict
|
105
|
+
ERROR
|
78
106
|
end
|
79
107
|
parts
|
80
108
|
end
|
@@ -112,9 +112,11 @@ module Kennel
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def resolve_linked_tracking_ids!(id_map, **args)
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
case as_json[:type]
|
116
|
+
when "composite", "slo alert"
|
117
|
+
type = (as_json[:type] == "composite" ? :monitor : :slo)
|
118
|
+
as_json[:query] = as_json[:query].gsub(/%{(.*?)}/) do
|
119
|
+
resolve_link($1, type, id_map, **args)
|
118
120
|
end
|
119
121
|
end
|
120
122
|
end
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -67,7 +67,7 @@ end
|
|
67
67
|
- `cp .env.example .env`
|
68
68
|
- open [Datadog API Settings](https://app.datadoghq.com/account/settings#api)
|
69
69
|
- create a `API Key` or get an existing one from an admin, then add it to `.env` as `DATADOG_API_KEY`
|
70
|
-
-
|
70
|
+
- open [Datadog API Settings](https://app.datadoghq.com/access/application-keys) and create a new key, then add it to `.env` as `DATADOG_APP_KEY=`
|
71
71
|
- change the `DATADOG_SUBDOMAIN=app` in `.env` to your companies subdomain if you have one
|
72
72
|
- verify it works by running `rake plan`, it might show some diff, but should not crash
|
73
73
|
|
@@ -201,6 +201,7 @@ To link to existing monitors via their kennel_id `projects kennel_id` + `:` + `m
|
|
201
201
|
- Screens `uptime` widgets can use `monitor: {id: "foo:bar"}`
|
202
202
|
- Screens `alert_graph` widgets can use `alert_id: "foo:bar"`
|
203
203
|
- Monitors `composite` can use `query: -> { "%{foo:bar} || %{foo:baz}" }`
|
204
|
+
- Monitors `slo alert` can use `query: -> { "error_budget(\"%{foo:bar}\").over(\"7d\") > 123.0" }`
|
204
205
|
- Slos can use `monitor_ids: -> ["foo:bar"]`
|
205
206
|
|
206
207
|
### Debugging changes locally
|
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.80.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:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|