kennel 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccf24b963a06289a82a03996aafdf59c7932ba1e55f1be8a27e8e5c2e7366a59
4
- data.tar.gz: c691e5fca96de9a9ff904d90e56d15ad8df45b018e530b83bc9b6d1e57ca7035
3
+ metadata.gz: bbd8b93533d2675d85ec94149740499bcb3e5d04ac8099693360ee4985779907
4
+ data.tar.gz: 5edc6138f0077d2841e9fa59bb699bb389b750e5d52f3e3ff9784aae2aea156b
5
5
  SHA512:
6
- metadata.gz: cbae40312ac008e6a213549d0d0c6393276c77081ab2a866cd6b787df33d18ac13d962b78e44f64520c356b6c015f487517bedd909bd82fb9fa019b7e6c40e53
7
- data.tar.gz: 10f59d9002d8504a5bf19dbeea8051c3bba8670332b8f28bdaf1413ecc1889d5e86e30fce8699f94760091d713b0522dfcafc9d8a3cb6eea6583ed4d322d0af1
6
+ metadata.gz: 1e2a89bc5f30b8c615bda2fedd21719045989f3f18ba43e342032661846d69a92f0d3e02cdc4427a184bddb4b9ae11fc299b5a9854846f60c4d049d160e3dfd0
7
+ data.tar.gz: 6d6413324ed9dfc6a2b045fd938f60d49946a42b96e7eeb7478b888150477f15448adee040a6208d5ed9aa8b41facdb1210efba16048074be1beec2a07f2efe2
@@ -22,6 +22,7 @@ module Kennel
22
22
  renotify_interval: 0,
23
23
  notify_audit: false,
24
24
  no_data_timeframe: nil, # this works out ok since if notify_no_data is on, it would never be nil
25
+ group_retention_duration: nil,
25
26
  groupby_simple_monitor: false,
26
27
  variables: nil,
27
28
  on_missing_data: "default", # "default" is "evaluate as zero"
@@ -35,8 +36,8 @@ module Kennel
35
36
  settings(
36
37
  :query, :name, :message, :escalation_message, :critical, :type, :renotify_interval, :warning, :timeout_h, :evaluation_delay,
37
38
  :ok, :no_data_timeframe, :notify_no_data, :notify_audit, :tags, :critical_recovery, :warning_recovery, :require_full_window,
38
- :threshold_windows, :scheduling_options, :new_host_delay, :new_group_delay, :priority, :variables, :on_missing_data,
39
- :notification_preset_name, :notify_by
39
+ :threshold_windows, :scheduling_options, :new_host_delay, :new_group_delay, :group_retention_duration, :priority,
40
+ :variables, :on_missing_data, :notification_preset_name, :notify_by
40
41
  )
41
42
 
42
43
  defaults(
@@ -52,6 +53,7 @@ module Kennel
52
53
  notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
53
54
  new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
54
55
  new_group_delay: -> { nil },
56
+ group_retention_duration: -> { MONITOR_OPTION_DEFAULTS.fetch(:group_retention_duration) },
55
57
  tags: -> { @project.tags },
56
58
  timeout_h: -> { MONITOR_OPTION_DEFAULTS.fetch(:timeout_h) },
57
59
  evaluation_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:evaluation_delay) },
@@ -136,6 +138,10 @@ module Kennel
136
138
  # Datadog requires only either new_group_delay or new_host_delay, never both
137
139
  options.delete(options[:new_group_delay] ? :new_host_delay : :new_group_delay)
138
140
 
141
+ if (duration = group_retention_duration)
142
+ options[:group_retention_duration] = duration
143
+ end
144
+
139
145
  # Add in statuses where we would re notify on. Possible values: alert, no data, warn
140
146
  if options[:renotify_interval] != 0
141
147
  statuses = ["alert"]
@@ -48,9 +48,13 @@ module Kennel
48
48
  list = list.dup
49
49
  loop do
50
50
  return if list.empty?
51
+ size = list.size
52
+ resolved = 0
51
53
  list.reject! do |item|
52
54
  if resolved?(item.expected)
53
- yield item
55
+ last_item = (resolved + 1 == size)
56
+ yield item, last_item
57
+ resolved += 1
54
58
  true
55
59
  else
56
60
  false
data/lib/kennel/syncer.rb CHANGED
@@ -50,7 +50,7 @@ module Kennel
50
50
  # because datadog validates that update+create of slo alerts match an existing timeframe
51
51
  planned_actions.sort_by! { |item| item.expected.is_a?(Models::Slo) ? 0 : 1 }
52
52
 
53
- resolver.each_resolved(planned_actions) do |item|
53
+ resolver.each_resolved(planned_actions) do |item, last_item|
54
54
  if item.is_a?(Types::PlannedCreate)
55
55
  message = "#{item.api_resource} #{item.tracking_id}"
56
56
  Kennel.out.puts "Creating #{message}"
@@ -67,7 +67,7 @@ module Kennel
67
67
  Kennel.out.puts "#{LINE_UP}Updated #{message}"
68
68
  end
69
69
  rescue StandardError
70
- raise unless Console.tty?
70
+ raise if !Console.tty? || last_item
71
71
  Kennel.err.puts $!.message
72
72
  Kennel.err.puts $!.backtrace
73
73
  raise unless Console.ask?("Continue with error ?")
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
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.0.0
4
+ version: 2.1.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-08-21 00:00:00.000000000 Z
11
+ date: 2025-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs