kennel 2.2.1 → 2.3.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: f9945e9a42b446b95f53152f08d74765e4f7c228a4a4e9d3f5770eb6006338a0
4
- data.tar.gz: 3cc6fd5ff0cece1763b9a4e798ac9da97df80c6b27b613caf45abe7f9ef4a1eb
3
+ metadata.gz: 9a72c925b5388b403514bc0be5c998595428bb41cdf41f97f91571a374716e14
4
+ data.tar.gz: 6bcd5f992433b13f088c633e1cd3468c1966cada8df12a689a07343a17e23d2c
5
5
  SHA512:
6
- metadata.gz: c43fb32a753b1e59aca9728195612568ec2a11d7d83e7a74daad064bbc5ec2d9f29951d0e0ff66e290d25e357b5a3e2d310cbac0b335ebccb1da7cbb5752a225
7
- data.tar.gz: 61f079c7c9a0d8c746c529badc5e2d67fe4c3e8c19e2025ab95516be2667f4b1788d288d3e8420b929dc2fa85a98cd5c6f23b9395c3a066785194f44a02cb0a9
6
+ metadata.gz: 713d35626d870aeaaa1148a73b56b73b25e515dfa2523a97e2e423f5f63dc84461b4bcadbe0fc928698717f2928e99fca47ccb9c7a755057635b4b3b51025acc
7
+ data.tar.gz: 1d65adb907acd6c31f60c53be6dabf9d3849793f684d2d142403f7fa4b71439ec4544e72b325eb7d4181a50e81542b7704c1144ff2e7e79bb7d90716a9b0ce2e
@@ -14,10 +14,11 @@ module Kennel
14
14
  query: nil,
15
15
  groups: nil,
16
16
  monitor_ids: [],
17
- thresholds: []
17
+ thresholds: [],
18
+ primary: nil
18
19
  }.freeze
19
20
 
20
- settings :type, :description, :thresholds, :query, :tags, :monitor_ids, :monitor_tags, :name, :groups, :sli_specification
21
+ settings :type, :description, :thresholds, :query, :tags, :monitor_ids, :monitor_tags, :name, :groups, :sli_specification, :primary
21
22
 
22
23
  defaults(
23
24
  tags: -> { @project.tags },
@@ -25,7 +26,8 @@ module Kennel
25
26
  description: -> { DEFAULTS.fetch(:description) },
26
27
  monitor_ids: -> { DEFAULTS.fetch(:monitor_ids) },
27
28
  thresholds: -> { DEFAULTS.fetch(:thresholds) },
28
- groups: -> { DEFAULTS.fetch(:groups) }
29
+ groups: -> { DEFAULTS.fetch(:groups) },
30
+ primary: -> { DEFAULTS.fetch(:primary) }
29
31
  )
30
32
 
31
33
  def build_json
@@ -38,6 +40,23 @@ module Kennel
38
40
  type: type
39
41
  )
40
42
 
43
+ # Add timeframe and thresholds based on primary setting
44
+ if primary
45
+ data[:timeframe] = primary
46
+
47
+ threshold =
48
+ thresholds.detect { |t| t[:timeframe] == primary } ||
49
+ raise("unable to find threshold with timeframe #{primary}")
50
+
51
+ # Only add warning_threshold if it exists
52
+ if threshold[:warning]
53
+ data[:warning_threshold] = threshold[:warning]
54
+ end
55
+
56
+ # target is required
57
+ data[:target_threshold] = threshold[:target]
58
+ end
59
+
41
60
  if type == "time_slice"
42
61
  data[:sli_specification] = sli_specification
43
62
  elsif (v = query)
@@ -97,6 +116,11 @@ module Kennel
97
116
  invalid! :tags_are_upper_case, "Tags must not be upper case (bad tags: #{bad_tags.sort.inspect})"
98
117
  end
99
118
 
119
+ # Check that thresholds are not empty
120
+ if !data[:thresholds] || data[:thresholds].empty?
121
+ invalid! :thresholds_empty, "SLO must have at least one threshold defined"
122
+ end
123
+
100
124
  # prevent "Invalid payload: The target is incorrect: target must be a positive number between (0.0, 100.0)"
101
125
  data[:thresholds]&.each do |threshold|
102
126
  target = threshold.fetch(:target)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "2.2.1"
3
+ VERSION = "2.3.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.2.1
4
+ version: 2.3.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-10-03 00:00:00.000000000 Z
11
+ date: 2025-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs