kennel 1.70.0 → 1.72.2

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: 857c5d57edd43c806560c9a97b579398f440ed311dd7b8541e1262af03de51bd
4
- data.tar.gz: b75bf7667bcdd473732d1e69231a52a37bdd90366462890a85d39d6325004593
3
+ metadata.gz: 1aa2b3776b0249a4013afd8ef6b078f4a783b9df6461193a83ed25b4b4721ce7
4
+ data.tar.gz: 4b60552e08b14ce5e124dde66329d74983abf5306b9aa4e4e0ae66414fc42a16
5
5
  SHA512:
6
- metadata.gz: 51662e560022e916c3b2e7254cb9dcc4ec331468f06cc29c47f45ea857c1dc49ded3496b9313a06073848abc782576c46d0bfcd410099ababdc5571a19cccc28
7
- data.tar.gz: de5dd05943415b655efc290399417853a68477a81a88c098b4812d908e83a19ff06594dbb143f6b3120a41caca2cbbe8d86ef27a8eee449e2d34bc05b1da5140
6
+ metadata.gz: 04bdf0ba96f2c3911215d9f611b397a763c1890f7404bff62f050605b017944bb7e820ec2ba13697b7e29a7e007ddeb70324dfba30be6b896bf05f4f4ed1218c
7
+ data.tar.gz: '08cb0890b0235e1af195a465e9026f8465c5fed46ab1828e78c27f69002720c8a7c0c3ec58c0b6821da12d5ef57013c58a1cf7798435f30067daa84cf6f4c8f8'
data/Readme.md CHANGED
@@ -23,7 +23,7 @@ Manage datadog monitors/dashboards/slos as code
23
23
  ```
24
24
  - add a basic projects and teams so others can copy-paste to get started
25
25
  - setup travis build for your repo
26
- - uncomment `.travis.yml` section for automated github PR feedback and datadog updates on merge
26
+ - uncomment `.travis.yml` section for automated PR planing and datadog updates on merge
27
27
  - follow `Setup` in your repos Readme.md
28
28
  <!-- NOT IN -->
29
29
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # Not used in here, but in our templated repo ... so keeping it around for now.
2
3
  module Kennel
3
4
  class GithubReporter
4
5
  MAX_COMMENT_SIZE = 65536
@@ -16,12 +16,17 @@ module Kennel
16
16
  TIMESERIES_DEFAULTS = { show_legend: false, legend_size: "0" }.freeze
17
17
  SUPPORTED_DEFINITION_OPTIONS = [:events, :markers, :precision].freeze
18
18
 
19
- settings :title, :description, :definitions, :widgets, :layout_type
19
+ DEFAULTS = {
20
+ template_variable_presets: nil
21
+ }.freeze
22
+
23
+ settings :title, :description, :definitions, :widgets, :layout_type, :template_variable_presets
20
24
 
21
25
  defaults(
22
26
  description: -> { "" },
23
27
  definitions: -> { [] },
24
28
  widgets: -> { [] },
29
+ template_variable_presets: -> { nil },
25
30
  id: -> { nil }
26
31
  )
27
32
 
@@ -33,6 +38,8 @@ module Kennel
33
38
  def normalize(expected, actual)
34
39
  super
35
40
 
41
+ ignore_default(expected, actual, DEFAULTS)
42
+
36
43
  widgets_pairs(expected, actual).each do |pair|
37
44
  # conditional_formats ordering is randomly changed by datadog, compare a stable ordering
38
45
  pair.each do |widgets|
@@ -102,6 +109,7 @@ module Kennel
102
109
  title: "#{title}#{LOCK}",
103
110
  description: description,
104
111
  template_variables: render_template_variables,
112
+ template_variable_presets: template_variable_presets,
105
113
  widgets: all_widgets
106
114
  }
107
115
 
@@ -167,6 +175,10 @@ module Kennel
167
175
  super
168
176
 
169
177
  validate_template_variables data, :widgets
178
+
179
+ # Avoid diff from datadog presets sorting.
180
+ presets = data[:template_variable_presets]
181
+ invalid! "template_variable_presets must be sorted by name" if presets && presets != presets.sort_by { |p| p[:name] }
170
182
  end
171
183
 
172
184
  def render_definitions
@@ -202,7 +202,7 @@ module Kennel
202
202
  # verify is_match uses available variables
203
203
  message = data.fetch(:message)
204
204
  used = message.scan(/{{\s*#is_match\s*"([a-zA-Z\d_.-]+).name"/).flatten.uniq
205
- allowed = data.fetch(:query)[/by\s*{([^\}]+)}/, 1].to_s.split(/\s*,\s*/)
205
+ allowed = data.fetch(:query)[/by\s*[\({]([^\}\)]+)[}\)]/, 1].to_s.gsub(/["']/, "").split(/\s*,\s*/)
206
206
  unsupported = used - allowed
207
207
  if unsupported.any?
208
208
  invalid! "is_match used with #{unsupported}, but metric is only grouped by #{allowed}"
@@ -228,7 +228,7 @@ module Kennel
228
228
  json = e.as_json
229
229
  field = tracking_field(json)
230
230
  value = json[field]
231
- json[field] = value.dup.sub!(/\n-- Managed by kennel .*/, "") || raise("did not find tracking id in #{value}")
231
+ json[field] = value.dup.sub!(/\n?-- Managed by kennel .*/, "") || raise("did not find tracking id in #{value}")
232
232
  end
233
233
 
234
234
  def tracking_id(a)
@@ -68,7 +68,7 @@ namespace :kennel do
68
68
  Kennel.update
69
69
  end
70
70
 
71
- desc "update if this is a push to the default branch, otherwise plan (report to github with GITHUB_TOKEN)"
71
+ desc "update if this is a push to the default branch, otherwise plan"
72
72
  task :travis do
73
73
  on_default_branch = (ENV["TRAVIS_BRANCH"] == (ENV["DEFAULT_BRANCH"] || "master"))
74
74
  is_push = (ENV["TRAVIS_PULL_REQUEST"] == "false")
@@ -79,9 +79,7 @@ namespace :kennel do
79
79
  "kennel:plan" # show plan in travis logs
80
80
  end
81
81
 
82
- Kennel::GithubReporter.report(ENV["GITHUB_TOKEN"]) do
83
- Rake::Task[task_name].invoke
84
- end
82
+ Rake::Task[task_name].invoke
85
83
  end
86
84
 
87
85
  desc "show unmuted alerts filtered by TAG, for example TAG=team:foo"
@@ -19,6 +19,7 @@ module Kennel
19
19
  .gsub(/::/, "_") # Foo::Bar -> foo_bar
20
20
  .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') # FOOBar -> foo_bar
21
21
  .gsub(/([a-z\d])([A-Z])/, '\1_\2') # fooBar -> foo_bar
22
+ .tr("-", "_") # foo-bar -> foo_bar
22
23
  .downcase
23
24
  end
24
25
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.70.0"
3
+ VERSION = "1.72.2"
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.70.0
4
+ version: 1.72.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-30 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday