kennel 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: e8fcef3310361713523891bea44caa42662f5958
4
- data.tar.gz: 42a606f408399f9554b85d5e2348b66d50e11195
3
+ metadata.gz: 89c84ca66da09badb7b9af5bb2ce98c206c6d040
4
+ data.tar.gz: 0bfd6549045618b644a8ffc929fd406efb09ece6
5
5
  SHA512:
6
- metadata.gz: 54c087b00850de42801159ec06e78e128a175a99c46535d3d0466645c43dad1f082ecb08d21711fc82de2fbc204b13b17da8e76bb881d99dc5dbe83235dfb9ac
7
- data.tar.gz: ae1dbefc28044cd1466ef786a366ec3718cc60dcc506f3ec2305afb491da00eaa676a17d5eb4cb8ddd573f6fb844a46f8f0130c0a6c8deb468b8b8d774a8cf5f
6
+ metadata.gz: 5bbe5060680dc1d39c69d98f1aaba8a28931c7c45cd8afad9002c597aae39b2ad61eab676a8cea0ba8a203b365fb0077e1a8a60e70dccaa9c440e46d9fb12078
7
+ data.tar.gz: 8c112950b768eca0c9a0ac15e1452dc18532ee6f5b5a9959e591d62d65f0669ccbc598d0e6a48f58c1f27aa56d5574b399fcbe956f2e1eabec51506ba49a60fb
@@ -5,7 +5,6 @@ module Kennel
5
5
  API_LIST_INCOMPLETE = false
6
6
  RENOTIFY_INTERVALS = [0, 10, 20, 30, 40, 50, 60, 90, 120, 180, 240, 300, 360, 720, 1440].freeze # minutes
7
7
  QUERY_INTERVALS = ["1m", "5m", "10m", "15m", "30m", "1h", "2h", "4h", "24h"].freeze
8
- METRIC_TYPES = ["query alert", "metric alert"].freeze
9
8
 
10
9
  settings(
11
10
  :query, :name, :message, :escalation_message, :critical, :kennel_id, :type, :renotify_interval, :warning,
@@ -14,7 +13,7 @@ module Kennel
14
13
  defaults(
15
14
  message: -> { "" },
16
15
  escalation_message: -> { "" },
17
- type: -> { "metric alert" }, # TODO: can we auto-determine that ?
16
+ type: -> { "query alert" },
18
17
  renotify_interval: -> { 120 },
19
18
  warning: -> { nil },
20
19
  ok: -> { nil },
@@ -22,7 +21,7 @@ module Kennel
22
21
  notify_no_data: -> { true },
23
22
  no_data_timeframe: -> { notify_no_data ? 60 : nil },
24
23
  tags: -> { [] },
25
- multi: -> { !METRIC_TYPES.include?(type) || query.include?(" by ") }
24
+ multi: -> { type != "query alert" || query.include?(" by ") }
26
25
  )
27
26
 
28
27
  attr_reader :project
@@ -80,7 +79,7 @@ module Kennel
80
79
  thresholds[:ok] = ok if ok
81
80
 
82
81
  # metric and query values are stored as float by datadog
83
- if ["metric alert", "query alert"].include? data.fetch(:type)
82
+ if data.fetch(:type) == "query alert"
84
83
  thresholds.each { |k, v| thresholds[k] = Float(v) }
85
84
  end
86
85
 
@@ -123,9 +122,6 @@ module Kennel
123
122
  # nil or "" are not returned from the api
124
123
  options[:evaluation_delay] ||= nil
125
124
 
126
- # datadog uses these types randomly
127
- actual[:type] = type if METRIC_TYPES.include?(actual[:type])
128
-
129
125
  super
130
126
  end
131
127
 
@@ -134,6 +130,10 @@ module Kennel
134
130
  def validate_json(data)
135
131
  type = data.fetch(:type)
136
132
 
133
+ if type == "metric alert"
134
+ raise "#{tracking_id} type 'metric alert' is deprecated, do not set type to use the default 'query alert'"
135
+ end
136
+
137
137
  if type == "service check" && [ok, warning, critical].compact.map(&:class).uniq != [Integer]
138
138
  raise "#{tracking_id} :ok, :warning and :critical must be integers for service check type"
139
139
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
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: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday