kennel 1.124.0 → 1.125.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: 31edba322106d5b2f1942c57640f19eff6a265ea970b5bb2cc7f4ef02d1889fd
4
- data.tar.gz: f47474f8b7d745714fb49231755ed2bf41fae62cf8b5ff3817017c8cd8277713
3
+ metadata.gz: 2464486b37bc4711843991d93789d4844d9c9aac33b40cf8b088ec4b249f39ab
4
+ data.tar.gz: 794318abfb10fecca670f6a8d2ad22e6f117e8425d0dc964b76163a658593d16
5
5
  SHA512:
6
- metadata.gz: 3dc6b1b72e834b7b7663b577c830dfa23da87a197752b04988edd2366ac9089685ff01e19a1e3c8244ac9a41f4217c75ec34bc6198ca83cf545bf6079069d71e
7
- data.tar.gz: 1dffcf6adbd06fe80117d9a5f9bc3b55fac90bc21abb4fdd4ebeb5b726ade944c799edbbcca3eabbc5a28beff6a302011ecfcce18f041b4ad2228076e164c2d6
6
+ metadata.gz: 97c3664e939d5776bf4dcc2a8fc72b647af0a8df0112035cadd6105e8117dd116097e85e60838050f96959df5ea0e17d7e00ffe89420712937a32190bcce70ca
7
+ data.tar.gz: 4a1cf01f15ac6959c7cea683297fb41f3a74791a99b3a16c5391f76af48333d9a1b4ea9a9fc804750844feb75d5c02fae0caced96fc3b85723d128d1ad45e289
@@ -21,7 +21,8 @@ module Kennel
21
21
  renotify_interval: 0,
22
22
  notify_audit: false,
23
23
  no_data_timeframe: nil, # this works out ok since if notify_no_data is on, it would never be nil
24
- groupby_simple_monitor: false
24
+ groupby_simple_monitor: false,
25
+ variables: nil
25
26
  }.freeze
26
27
  DEFAULT_ESCALATION_MESSAGE = ["", nil].freeze
27
28
  ALLOWED_PRIORITY_CLASSES = [NilClass, Integer].freeze
@@ -30,7 +31,7 @@ module Kennel
30
31
  settings(
31
32
  :query, :name, :message, :escalation_message, :critical, :type, :renotify_interval, :warning, :timeout_h, :evaluation_delay,
32
33
  :ok, :no_data_timeframe, :notify_no_data, :notify_audit, :tags, :critical_recovery, :warning_recovery, :require_full_window,
33
- :threshold_windows, :new_host_delay, :new_group_delay, :priority, :validate_using_links
34
+ :threshold_windows, :new_host_delay, :new_group_delay, :priority, :validate_using_links, :variables
34
35
  )
35
36
 
36
37
  defaults(
@@ -50,7 +51,8 @@ module Kennel
50
51
  critical_recovery: -> { nil },
51
52
  warning_recovery: -> { nil },
52
53
  threshold_windows: -> { nil },
53
- priority: -> { MONITOR_DEFAULTS.fetch(:priority) }
54
+ priority: -> { MONITOR_DEFAULTS.fetch(:priority) },
55
+ variables: -> { MONITOR_OPTION_DEFAULTS.fetch(:variables) }
54
56
  )
55
57
 
56
58
  def build_json
@@ -73,7 +75,8 @@ module Kennel
73
75
  escalation_message: Utils.presence(escalation_message.strip),
74
76
  evaluation_delay: evaluation_delay,
75
77
  locked: false, # setting this to true prevents any edit and breaks updates when using replace workflow
76
- renotify_interval: renotify_interval || 0
78
+ renotify_interval: renotify_interval || 0,
79
+ variables: variables
77
80
  }
78
81
  )
79
82
 
@@ -2,7 +2,7 @@
2
2
  module Kennel
3
3
  module Models
4
4
  class Slo < Record
5
- READONLY_ATTRIBUTES = superclass::READONLY_ATTRIBUTES + [:type_id, :monitor_tags]
5
+ READONLY_ATTRIBUTES = superclass::READONLY_ATTRIBUTES + [:type_id, :monitor_tags, :target_threshold, :timeframe, :warning_threshold]
6
6
  TRACKING_FIELD = :description
7
7
  DEFAULTS = {
8
8
  description: nil,
data/lib/kennel/syncer.rb CHANGED
@@ -6,7 +6,9 @@ module Kennel
6
6
  class Syncer
7
7
  DELETE_ORDER = ["dashboard", "slo", "monitor", "synthetics/tests"].freeze # dashboards references monitors + slos, slos reference monitors
8
8
  LINE_UP = "\e[1A\033[K" # go up and clear
9
+
9
10
  Plan = Struct.new(:changes, keyword_init: true)
11
+ Change = Struct.new(:type, :api_resource, :tracking_id, :id)
10
12
 
11
13
  def initialize(api, expected, kennel:, project_filter: nil, tracking_id_filter: nil)
12
14
  @api = api
@@ -32,9 +34,9 @@ module Kennel
32
34
 
33
35
  Plan.new(
34
36
  changes:
35
- @create.map { |_id, e| [:create, e.class.api_resource, e.tracking_id, nil] } +
36
- @update.map { |_id, e| [:create, e.class.api_resource, e.tracking_id, nil] } +
37
- @delete.map { |_id, _e, a| [:delete, a.fetch(:klass).api_resource, a.fetch(:tracking_id), a.fetch(:id)] }
37
+ @create.map { |_id, e, _a| Change.new(:create, e.class.api_resource, e.tracking_id, nil) } +
38
+ @update.map { |id, e, _a| Change.new(:update, e.class.api_resource, e.tracking_id, id) } +
39
+ @delete.map { |id, _e, a| Change.new(:delete, a.fetch(:klass).api_resource, a.fetch(:tracking_id), id) }
38
40
  )
39
41
  end
40
42
 
@@ -53,7 +55,7 @@ module Kennel
53
55
  reply = @api.create e.class.api_resource, e.as_json
54
56
  cache_metadata reply, e.class
55
57
  id = reply.fetch(:id)
56
- changes << [:create, e.class.api_resource, e.tracking_id, id]
58
+ changes << Change.new(:create, e.class.api_resource, e.tracking_id, id)
57
59
  populate_id_map [], [reply] # allow resolving ids we could previously no resolve
58
60
  Kennel.out.puts "#{LINE_UP}Created #{message} #{e.class.url(id)}"
59
61
  end
@@ -62,7 +64,7 @@ module Kennel
62
64
  message = "#{e.class.api_resource} #{e.tracking_id} #{e.class.url(id)}"
63
65
  Kennel.out.puts "Updating #{message}"
64
66
  @api.update e.class.api_resource, id, e.as_json
65
- changes << [:update, e.class.api_resource, e.tracking_id, id]
67
+ changes << Change.new(:update, e.class.api_resource, e.tracking_id, id)
66
68
  Kennel.out.puts "#{LINE_UP}Updated #{message}"
67
69
  end
68
70
 
@@ -71,7 +73,7 @@ module Kennel
71
73
  message = "#{klass.api_resource} #{a.fetch(:tracking_id)} #{id}"
72
74
  Kennel.out.puts "Deleting #{message}"
73
75
  @api.delete klass.api_resource, id
74
- changes << [:delete, klass.api_resource, a.fetch(:tracking_id), id]
76
+ changes << Change.new(:delete, klass.api_resource, a.fetch(:tracking_id), id)
75
77
  Kennel.out.puts "#{LINE_UP}Deleted #{message}"
76
78
  end
77
79
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.124.0"
3
+ VERSION = "1.125.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: 1.124.0
4
+ version: 1.125.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: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs