kennel 2.11.0 → 2.12.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88495b67d113181455cb6dc751d2f7820eababca5679cfb714bb614dc9370ad6
4
- data.tar.gz: a8703613913aa4557c585e605f35a1aef9555902c65a5f1c1772b1038e9d4d34
3
+ metadata.gz: 820cb0c4f746cbbafc79598199ba6c4e6d8d762e8505b432af9bf3c27de3ca74
4
+ data.tar.gz: d1c54c6ecd55bfd00e432b9258dfb6c6f16fa15c9181f862adca7bd885a0c4c2
5
5
  SHA512:
6
- metadata.gz: d730ee50ff704f25eb39fdd8daa9c95a2c0b43f9a9534c7f1a05a245bd3881ab5ce36f12ebf226354eeafe94c4a961e843eebbbcf0312b2b548577b26a4debdd
7
- data.tar.gz: ff487e51479e7a463464e37ec09a10ef7c1dc7d695bcf18f97303048ab0a75759d71eda14aa95e512aa69b66c25baf016d778be449455c0ef069e081f5957373
6
+ metadata.gz: e001bd09798e846ddabdd5dae8b47aa9174cdd19be8f4af77b52d2eb877ed2cb6043a2022c229f23e0c232700104c930902ec89ecb2db416e77de2e29074ef0b
7
+ data.tar.gz: bd930e26de4108718b8228056b726a5aeb41407ddef31175879b8126b250639e027b2d1e05cbabe47d5e94399aa8a8c609dddc3bb0163eeb920051d436186b1d
@@ -56,6 +56,7 @@ module Kennel
56
56
  # datadog UI sets this to false by default, but true is safer
57
57
  # except for log alerts which will always have "no error" gaps and should default to false
58
58
  notify_no_data: -> { !SKIP_NOTIFY_NO_DATA_TYPES.include?(type) },
59
+ no_data_timeframe: -> { MONITOR_OPTION_DEFAULTS.fetch(:no_data_timeframe) },
59
60
  notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
60
61
  new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
61
62
  new_group_delay: -> { nil },
@@ -149,16 +150,28 @@ module Kennel
149
150
  # and enforce that it is not set at the same time as on_missing_data
150
151
  def configure_no_data
151
152
  notify = notify_no_data
153
+ timeframe = no_data_timeframe
152
154
  action = on_missing_data
155
+ action ||= "default" if type == "event-v2 alert"
153
156
 
154
- # on_missing_data cannot be used with notify_no_data or no_data_timeframe
155
- if type == "event-v2 alert" || action
156
- # TODO: mark setting notify_no_data or no_data_timeframe at all as invalid
157
+ # TODO: mark setting action && !notify.nil? at all as invalid
158
+ if action && timeframe
159
+ invalid! :invalid_no_data_config, "set either no_data_timeframe or on_missing_data"
160
+ end
161
+ if type == "composite" && action
162
+ invalid! :invalid_no_data_config, "cannot use on_missing_data with composite monitor"
163
+ end
164
+ if action == "resolve" && timeout_h.to_i != 0
165
+ invalid! :invalid_no_data_config, "timeout_h cannot be set and non-zero when on_missing_data is `resolve`"
166
+ end
167
+
168
+ # on_missing_data cannot be used with notify_no_data + no_data_timeframe
169
+ if action
157
170
  { on_missing_data: action || "default" }
158
171
  else
159
172
  {
160
173
  notify_no_data: notify,
161
- no_data_timeframe: notify ? no_data_timeframe : nil
174
+ no_data_timeframe: notify ? no_data_timeframe || default_no_data_timeframe : nil
162
175
  }
163
176
  end
164
177
  end
@@ -184,7 +197,7 @@ module Kennel
184
197
  # deprecated this setting is no longer returned by dd for new monitors
185
198
  # datadog UI warns when setting no data timeframe to less than 2x the query window
186
199
  # limited to 24h because `no_data_timeframe must not exceed group retention` and max group retention is 24h
187
- def no_data_timeframe
200
+ def default_no_data_timeframe
188
201
  default = 60
189
202
  if type == "query alert" && (minutes = query_window_minutes)
190
203
  (minutes * 2).clamp(default, 24 * 60)
@@ -305,9 +318,11 @@ module Kennel
305
318
  end
306
319
 
307
320
  # verify query includes critical value
308
- if (query_value = data.fetch(:query)[/\s*[<>]=?\s*(\d+(\.\d+)?)\s*$/, 1])
309
- if Float(query_value) != Float(data.dig(:options, :thresholds, :critical))
310
- invalid! :critical_does_not_match_query, "critical and value used in query must match"
321
+ if (critical = data.dig(:options, :thresholds, :critical))
322
+ if (query_value = data.fetch(:query)[/\s*[<>]=?\s*(\d+(\.\d+)?)\s*$/, 1])
323
+ if Float(query_value) != Float(critical)
324
+ invalid! :critical_does_not_match_query, "critical and value used in query must match"
325
+ end
311
326
  end
312
327
  end
313
328
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "2.11.0"
3
+ VERSION = "2.12.1"
4
4
  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: 2.11.0
4
+ version: 2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-09 00:00:00.000000000 Z
11
+ date: 2026-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs