kennel 1.160.0 → 1.161.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: 305e0eb2205f87e8f993c0a6d19936f8ab2b2bdffa20316cc54dd241932cdad0
4
- data.tar.gz: aea7a8fe0cbb8981e777bf83cdcfdf07489581c0621140f299aa9ec4a3447ac3
3
+ metadata.gz: 856d925b4aeee8af7171cb092b746c70c8e21cfa06a1987910a25ef193e79a50
4
+ data.tar.gz: c174845463912362beba00a86f63d11316ec54f0a57459e4c6cd32e0d1d358d4
5
5
  SHA512:
6
- metadata.gz: 19ebc04a7b038919f635a33fc9e8f9e94500c62d9e8c68f6a51df9d66d4d8bc9e4b0036cd48b04f1215cfaa23d28321982ac28f90b26fd091cbac6da671b1f22
7
- data.tar.gz: cddea78b6c4050cfbb3b7de37346ea91022a00f72f3da62368870878c8630a2024988b894bb102be81e05f80002c0e9ffcf2ce1ae434673eca43fc342c902f44
6
+ metadata.gz: 328b385c98c37473d65799e1721da32f9a8ff4d4d238be42a37196aea6e880d5ce1ae76dfb5ec8ffd4e6f60c70c99af070566b09c3fa4c34032d431b4e2a6189
7
+ data.tar.gz: f74557a8ff3fe9ee436034774ed1fe5c5176e9919114e48241f08f3ffbc3950b2a32d25574d9d99c1a3c6470d3381d2880b356a7a54cc2795c2f13b4843980af
@@ -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
- data.delete(:notify_no_data) if data[:notify_no_data] # Monitor uses true by default
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
- notify_no_data: -> { true }, # datadog UI sets this to false by default, but true is safer
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,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.160.0"
3
+ VERSION = "1.161.0"
4
4
  end
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).each do |tracking_id, same|
135
- next if same.size == 1
136
- raise <<~ERROR
137
- #{tracking_id} is defined #{same.size} times
138
- use a different `kennel_id` when defining multiple projects/monitors/dashboards to avoid this conflict
139
- ERROR
140
- end
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.160.0
4
+ version: 1.161.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-10 00:00:00.000000000 Z
11
+ date: 2025-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs