kennel 1.96.0 → 1.98.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dad671ae1433588cff8641dbe5337c5db450d2bda9a05d61ba272a76c2482a5b
4
- data.tar.gz: 493cac344bfa4b1e2cab2de6e395887e91eac3d374fea84333af0268b8ee544d
3
+ metadata.gz: c3a596895475dbc4577d69916cb277fecfb45add58faf0bf1b6e06d314f161c3
4
+ data.tar.gz: 1f618cd4aa9a8eed2ad38ec067876e21f6d3f148d541a96bcc9afaa79619a48d
5
5
  SHA512:
6
- metadata.gz: 6048d4264a57b5b1bbda44bbc302965de9b09ba8985f397d5c537910d1d79fad0b0e77b02dfcda9e43b2168bc32b1c3ad335081afb1f9f2a3c09096c811d0b4d
7
- data.tar.gz: d4f919fcda3553c30bcfb38719b9996b5eca9189c0f4d7d73718f52b526a5eb84cb35f128463ae35fbac525dd61aacc54f7d2447bcf53eff5ed4f2bc5a30cc22
6
+ metadata.gz: 4324951f97ef28dd0a5081231ea6aa676b81c3f405598dcf683d0ad5abc5dc346333d0e5029e84c5c742aa896b90aa1c11cd5891483f5c3bb5e67f0bec6ba6a8
7
+ data.tar.gz: 44e1c9af9868579db4497c2a9807a814bc6a78e49956c165d0b954fd4cbc0d6511ee046a43777354ef4f18c79ab70e5ae5061468ab5fd410aab5f55f1f219af2
@@ -31,7 +31,7 @@ module Kennel
31
31
  settings(
32
32
  :query, :name, :message, :escalation_message, :critical, :type, :renotify_interval, :warning, :timeout_h, :evaluation_delay,
33
33
  :ok, :no_data_timeframe, :notify_no_data, :notify_audit, :tags, :critical_recovery, :warning_recovery, :require_full_window,
34
- :threshold_windows, :new_host_delay, :priority
34
+ :threshold_windows, :new_host_delay, :new_group_delay, :priority
35
35
  )
36
36
 
37
37
  defaults(
@@ -45,6 +45,7 @@ module Kennel
45
45
  no_data_timeframe: -> { 60 },
46
46
  notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
47
47
  new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
48
+ new_group_delay: -> { nil },
48
49
  tags: -> { @project.tags },
49
50
  timeout_h: -> { MONITOR_OPTION_DEFAULTS.fetch(:timeout_h) },
50
51
  evaluation_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:evaluation_delay) },
@@ -70,6 +71,7 @@ module Kennel
70
71
  notify_audit: notify_audit,
71
72
  require_full_window: require_full_window,
72
73
  new_host_delay: new_host_delay,
74
+ new_group_delay: new_group_delay,
73
75
  include_tags: true,
74
76
  escalation_message: Utils.presence(escalation_message.strip),
75
77
  evaluation_delay: evaluation_delay,
@@ -106,6 +108,9 @@ module Kennel
106
108
  options[:threshold_windows] = windows
107
109
  end
108
110
 
111
+ # Datadog requires only either new_group_delay or new_host_delay, never both
112
+ options.delete(options[:new_group_delay] ? :new_host_delay : :new_group_delay)
113
+
109
114
  validate_json(data) if validate
110
115
 
111
116
  @as_json = data
@@ -2,7 +2,7 @@
2
2
  module Kennel
3
3
  module Models
4
4
  class Project < Base
5
- settings :team, :parts, :tags, :mention
5
+ settings :team, :parts, :tags, :mention, :name, :kennel_id
6
6
  defaults(
7
7
  tags: -> { ["service:#{kennel_id}"] + team.tags },
8
8
  mention: -> { team.mention }
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.96.0"
3
+ VERSION = "1.98.0"
4
4
  end
data/lib/kennel.rb CHANGED
@@ -138,10 +138,29 @@ module Kennel
138
138
  Dir.exist?("parts") && loader.push_dir("parts")
139
139
  loader.setup
140
140
 
141
- # TODO: also do projects
141
+ # TODO: also do projects and update expected path too
142
142
  ["projects"].each do |folder|
143
143
  Dir["#{folder}/**/*.rb"].sort.each { |f| require "./#{f}" }
144
144
  end
145
+ rescue NameError => e
146
+ message = e.message
147
+ raise unless klass = message[/uninitialized constant (.*)/, 1]
148
+
149
+ # inverse of zeitwerk lib/zeitwerk/inflector.rb
150
+ path = klass.gsub("::", "/").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + ".rb"
151
+ expected_path = (path.start_with?("teams/") ? path : "parts/#{path}")
152
+
153
+ # TODO: prefer to raise a new exception with the old backtrace attacked
154
+ e.define_singleton_method(:message) do
155
+ "\n" + <<~MSG.gsub(/^/, " ")
156
+ #{message}
157
+ Unable to load #{klass} from #{expected_path}
158
+ - Option 1: rename the constant or the file it lives in, to make them match
159
+ - Option 2: Use `require` or `require_relative` to load the constant
160
+ MSG
161
+ end
162
+
163
+ raise
145
164
  end
146
165
  end
147
166
  end
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.96.0
4
+ version: 1.98.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: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday