kennel 1.160.0 → 1.162.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/lib/kennel/importer.rb +3 -1
- data/lib/kennel/models/monitor.rb +4 -1
- data/lib/kennel/projects_provider.rb +21 -7
- data/lib/kennel/version.rb +1 -1
- data/lib/kennel.rb +7 -7
- 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: 8412928c5e979ad1f46ac333e0f51a9d2601fa435a6ec2951390211515b0b35b
|
4
|
+
data.tar.gz: 2d25fbf232b3d784f3ea04ff51a38aeea2c7f034969e2065c4ddbb6dbbd3ea99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 320fbf356dbfb89826f99b7a3b90f3f41af07022b8ab783b546af7cb6a7430081fa955431bfd642fbda50de31e6308b863912c9c6d0af768622ff2f9b302b4e1
|
7
|
+
data.tar.gz: ef91e1bebe47fd623d65a5a308c726930e077632ac3b993241986f8625b695312789675e2bc5de4ee55ea2bfc1828252e110fbc65f81b91307ba0f6773efaf9f
|
data/lib/kennel/importer.rb
CHANGED
@@ -47,7 +47,9 @@ module Kennel
|
|
47
47
|
data.merge!(data.delete(:thresholds) || {})
|
48
48
|
|
49
49
|
# clean up values that are the default
|
50
|
-
|
50
|
+
if !!data[:notify_no_data] == !Models::Monitor::SKIP_NOTIFY_NO_DATA_TYPES.include?(data[:type])
|
51
|
+
data.delete(:notify_no_data)
|
52
|
+
end
|
51
53
|
data.delete(:notify_audit) unless data[:notify_audit] # Monitor uses false by default
|
52
54
|
|
53
55
|
# keep all values that are settable
|
@@ -30,6 +30,7 @@ module Kennel
|
|
30
30
|
}.freeze
|
31
31
|
DEFAULT_ESCALATION_MESSAGE = ["", nil].freeze
|
32
32
|
ALLOWED_PRIORITY_CLASSES = [NilClass, Integer].freeze
|
33
|
+
SKIP_NOTIFY_NO_DATA_TYPES = ["event alert", "event-v2 alert", "log alert"].freeze
|
33
34
|
|
34
35
|
settings(
|
35
36
|
:query, :name, :message, :escalation_message, :critical, :type, :renotify_interval, :warning, :timeout_h, :evaluation_delay,
|
@@ -44,7 +45,9 @@ module Kennel
|
|
44
45
|
renotify_interval: -> { project.team.renotify_interval },
|
45
46
|
warning: -> { nil },
|
46
47
|
ok: -> { nil },
|
47
|
-
|
48
|
+
# datadog UI sets this to false by default, but true is safer
|
49
|
+
# except for log alerts which will always have "no error" gaps and should default to false
|
50
|
+
notify_no_data: -> { !SKIP_NOTIFY_NO_DATA_TYPES.include?(type) },
|
48
51
|
no_data_timeframe: -> { 60 },
|
49
52
|
notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
|
50
53
|
new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
|
@@ -1,6 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Kennel
|
3
3
|
class ProjectsProvider
|
4
|
+
class AutoloadFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
# @return [Array<Models::Project>]
|
8
|
+
# All projects in the system. This is a slow operation.
|
9
|
+
# Use `projects` to get all projects in the system.
|
10
|
+
def all_projects
|
11
|
+
load_all
|
12
|
+
Models::Project.recursive_subclasses.map(&:new)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array<Models::Project>]
|
16
|
+
# All projects in the system. This is a slow operation.
|
17
|
+
|
4
18
|
def projects
|
5
19
|
load_all
|
6
20
|
Models::Project.recursive_subclasses.map(&:new)
|
@@ -21,9 +35,7 @@ module Kennel
|
|
21
35
|
Dir.exist?("teams") && loader.push_dir("teams", namespace: Teams)
|
22
36
|
Dir.exist?("parts") && loader.push_dir("parts")
|
23
37
|
|
24
|
-
|
25
|
-
# in isolation, then remove AUTOLOAD_PROJECTS
|
26
|
-
if ENV["AUTOLOAD_PROJECTS"]
|
38
|
+
if (autoload = ENV["AUTOLOAD_PROJECTS"]) && autoload != "false"
|
27
39
|
loader.push_dir("projects")
|
28
40
|
loader.setup
|
29
41
|
|
@@ -32,7 +44,7 @@ module Kennel
|
|
32
44
|
# so when loading a project we need to find anything that could be a project source
|
33
45
|
# sorting by name and nesting level to avoid confusion
|
34
46
|
segments = project.split("_")
|
35
|
-
search = /#{segments[0...-1].map { |p| "#{p}[_/]" }.join}#{segments[-1]}(\.rb|\/project\.rb)/
|
47
|
+
search = /#{segments[0...-1].map { |p| "#{p}[_/]" }.join}#{segments[-1]}(\.rb|\/project\.rb|\/base\.rb)/
|
36
48
|
|
37
49
|
projects_path = "#{File.expand_path("projects")}/"
|
38
50
|
known_paths = loader.all_expected_cpaths.keys
|
@@ -41,17 +53,19 @@ module Kennel
|
|
41
53
|
end.sort.min_by { |p| p.count("/") }
|
42
54
|
if project_path
|
43
55
|
require project_path
|
44
|
-
|
56
|
+
elsif autoload != "abort"
|
45
57
|
Kennel.err.puts(
|
46
58
|
"No projects/ file matching #{search} found" \
|
47
59
|
", falling back to slow loading of all projects instead"
|
48
60
|
)
|
49
61
|
loader.eager_load
|
62
|
+
else
|
63
|
+
raise AutoloadFailed, "No projects/ file matching #{search} found"
|
50
64
|
end
|
51
|
-
else
|
65
|
+
else # all projects needed
|
52
66
|
loader.eager_load
|
53
67
|
end
|
54
|
-
else
|
68
|
+
else # old style without autoload
|
55
69
|
loader.setup
|
56
70
|
loader.eager_load # TODO: this should not be needed but we see hanging CI processes when it's not added
|
57
71
|
# TODO: also auto-load projects and update expected path too
|
data/lib/kennel/version.rb
CHANGED
data/lib/kennel.rb
CHANGED
@@ -131,13 +131,13 @@ module Kennel
|
|
131
131
|
|
132
132
|
# performance: this takes ~100ms on large codebases, tried rewriting with Set or Hash but it was slower
|
133
133
|
def validate_unique_tracking_ids(parts)
|
134
|
-
parts.group_by(&:tracking_id).
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
134
|
+
bad = parts.group_by(&:tracking_id).select { |_, same| same.size > 1 }
|
135
|
+
return if bad.empty?
|
136
|
+
raise <<~ERROR
|
137
|
+
#{bad.map { |tracking_id, same| "#{tracking_id} is defined #{same.size} times" }.join("\n")}
|
138
|
+
|
139
|
+
use a different `kennel_id` when defining multiple projects/monitors/dashboards to avoid this conflict
|
140
|
+
ERROR
|
141
141
|
end
|
142
142
|
|
143
143
|
def definitions(**kwargs)
|
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.162.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: 2025-04-
|
11
|
+
date: 2025-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|