kennel 1.44.3 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -1
- data/lib/kennel.rb +0 -1
- data/lib/kennel/syncer.rb +0 -1
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +1 -1
- metadata +2 -3
- data/lib/kennel/models/screen.rb +0 -173
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee0eb25c1eeee5339b2c15799af781497ff2b3725c81232ec022e875c8a74662
|
4
|
+
data.tar.gz: df97a57586b6a096c1a08a6c97eb3dc6af45ff9915d3bb611d943dc9a4388b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac7738e1a4b05d806829f61a5f7ecda1b46d148d73247af9a161a976e7c7a35d5086ccef49c24da35b973bb2a13fef51523edda741733521f3ef79889d40157d
|
7
|
+
data.tar.gz: 66d620fe6f03d72cf5cf7d4b6a122941e761c1906a0dd8cbbada22dd7fdb8387476a374da3dfa92d59a06c5bacb83322ea4f9a3b643c4d6c711b54610becb7aa
|
data/Readme.md
CHANGED
@@ -167,7 +167,7 @@ To link to existing monitors via their kennel_id
|
|
167
167
|
- figure out project name by converting the class name to snake-case
|
168
168
|
- run `PROJECT=foo bundle exec rake kennel:update_datadog` to test changes for a single project
|
169
169
|
|
170
|
-
### Listing
|
170
|
+
### Listing un-muted alerts
|
171
171
|
|
172
172
|
Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a given datadog monitor tag.
|
173
173
|
|
data/lib/kennel.rb
CHANGED
data/lib/kennel/syncer.rb
CHANGED
@@ -123,7 +123,6 @@ module Kennel
|
|
123
123
|
Utils.parallel(api_resources.compact.uniq) do |api_resource|
|
124
124
|
results = @api.list(api_resource, with_downtimes: false) # lookup monitors without adding unnecessary downtime information
|
125
125
|
results = results[results.keys.first] if results.is_a?(Hash) # dashes/screens are nested in {dash: {}}
|
126
|
-
results.each { |r| r[:id] = Integer(r[:id]) if r[:id] =~ /\A\d+\z/ } # screen ids are integers as strings
|
127
126
|
results.each { |c| c[:api_resource] = api_resource } # store api resource for later diffing
|
128
127
|
end.flatten(1)
|
129
128
|
end
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -149,7 +149,7 @@ To link to existing monitors via their kennel_id
|
|
149
149
|
- figure out project name by converting the class name to snake-case
|
150
150
|
- run `PROJECT=foo bundle exec rake kennel:update_datadog` to test changes for a single project
|
151
151
|
|
152
|
-
### Listing
|
152
|
+
### Listing un-muted alerts
|
153
153
|
|
154
154
|
Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a given datadog monitor tag.
|
155
155
|
|
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.
|
4
|
+
version: 1.45.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: 2019-08-
|
11
|
+
date: 2019-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -69,7 +69,6 @@ files:
|
|
69
69
|
- lib/kennel/models/dashboard.rb
|
70
70
|
- lib/kennel/models/monitor.rb
|
71
71
|
- lib/kennel/models/project.rb
|
72
|
-
- lib/kennel/models/screen.rb
|
73
72
|
- lib/kennel/models/team.rb
|
74
73
|
- lib/kennel/optional_validations.rb
|
75
74
|
- lib/kennel/progress.rb
|
data/lib/kennel/models/screen.rb
DELETED
@@ -1,173 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Kennel
|
3
|
-
module Models
|
4
|
-
class Screen < Base
|
5
|
-
include TemplateVariables
|
6
|
-
include OptionalValidations
|
7
|
-
|
8
|
-
API_LIST_INCOMPLETE = true
|
9
|
-
COPIED_WIDGET_VALUES = [:board_id, :isShared].freeze
|
10
|
-
WIDGET_DEFAULTS = {
|
11
|
-
time: {},
|
12
|
-
timeframe: "1h"
|
13
|
-
}.freeze
|
14
|
-
READONLY_ATTRIBUTES = (Base::READONLY_ATTRIBUTES + [
|
15
|
-
:disableCog,
|
16
|
-
:disableEditing,
|
17
|
-
:isIntegration,
|
18
|
-
:isShared,
|
19
|
-
:original_title,
|
20
|
-
:read_only,
|
21
|
-
:resource,
|
22
|
-
:title,
|
23
|
-
:title_edited,
|
24
|
-
:created_by,
|
25
|
-
:board_bgtype,
|
26
|
-
:height,
|
27
|
-
:width,
|
28
|
-
:showGlobalTimeOnboarding,
|
29
|
-
:originalHeight,
|
30
|
-
:originalWidth,
|
31
|
-
:new_id
|
32
|
-
]).freeze
|
33
|
-
SCREEN_DEFAULTS = { template_variables: [] }.freeze
|
34
|
-
|
35
|
-
settings :id, :board_title, :description, :widgets, :kennel_id
|
36
|
-
|
37
|
-
defaults(
|
38
|
-
description: -> { "" },
|
39
|
-
widgets: -> { [] },
|
40
|
-
id: -> { nil }
|
41
|
-
)
|
42
|
-
|
43
|
-
attr_reader :project
|
44
|
-
|
45
|
-
def initialize(project, *args)
|
46
|
-
@project = project
|
47
|
-
super(*args)
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.api_resource
|
51
|
-
"screen"
|
52
|
-
end
|
53
|
-
|
54
|
-
def as_json
|
55
|
-
return @json if @json
|
56
|
-
@json = {
|
57
|
-
id: id,
|
58
|
-
board_title: "#{board_title}#{LOCK}",
|
59
|
-
description: description,
|
60
|
-
widgets: render_widgets,
|
61
|
-
template_variables: render_template_variables
|
62
|
-
}
|
63
|
-
|
64
|
-
validate_json(@json) if validate
|
65
|
-
|
66
|
-
@json
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.normalize(expected, actual)
|
70
|
-
super
|
71
|
-
|
72
|
-
(actual[:widgets] || []).each do |w|
|
73
|
-
# api randomly returns time.live_span or timeframe or empty time hash
|
74
|
-
if w.dig(:time, :live_span)
|
75
|
-
w[:timeframe] = w[:time].delete(:live_span)
|
76
|
-
end
|
77
|
-
|
78
|
-
COPIED_WIDGET_VALUES.each { |v| w.delete v }
|
79
|
-
end
|
80
|
-
|
81
|
-
ignore_default expected, actual, SCREEN_DEFAULTS
|
82
|
-
ignore_defaults expected[:widgets], actual[:widgets], WIDGET_DEFAULTS
|
83
|
-
ignore_request_defaults expected, actual, :widgets, :tile_def
|
84
|
-
end
|
85
|
-
|
86
|
-
def url(id)
|
87
|
-
Utils.path_to_url "/screen/#{id}"
|
88
|
-
end
|
89
|
-
|
90
|
-
def resolve_linked_tracking_ids(id_map)
|
91
|
-
as_json[:widgets].each do |widget|
|
92
|
-
case widget[:type]
|
93
|
-
when "uptime"
|
94
|
-
resolve_link(widget, [:monitor, :id], id_map)
|
95
|
-
when "alert_graph"
|
96
|
-
resolve_link(widget, [:alert_id], id_map)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
|
103
|
-
def validate_json(data)
|
104
|
-
super
|
105
|
-
|
106
|
-
# check for fields that are unsettable
|
107
|
-
data[:widgets].each do |w|
|
108
|
-
COPIED_WIDGET_VALUES.each do |ignored|
|
109
|
-
if w.key?(ignored)
|
110
|
-
invalid! "remove definition #{ignored}, it is unsettable and will always produce a diff"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def render_widgets
|
117
|
-
widgets.map do |widget|
|
118
|
-
widget = widget_defaults(widget[:type]).merge(widget)
|
119
|
-
if tile = widget[:tile_def]
|
120
|
-
tile[:autoscale] = true unless widget[:tile_def].key?(:autoscale) # TODO: use ignore_default
|
121
|
-
end
|
122
|
-
widget
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def widget_defaults(type)
|
127
|
-
basics = {
|
128
|
-
title_size: 16,
|
129
|
-
title_align: "left",
|
130
|
-
height: 20,
|
131
|
-
width: 30
|
132
|
-
}
|
133
|
-
|
134
|
-
custom =
|
135
|
-
case type
|
136
|
-
when "free_text"
|
137
|
-
{
|
138
|
-
font_size: "auto",
|
139
|
-
text_align: "left",
|
140
|
-
title_text: "",
|
141
|
-
title: true,
|
142
|
-
color: "#4d4d4d"
|
143
|
-
}
|
144
|
-
when "timeseries"
|
145
|
-
{
|
146
|
-
title: true,
|
147
|
-
legend: false,
|
148
|
-
legend_size: "0"
|
149
|
-
}
|
150
|
-
else
|
151
|
-
{}
|
152
|
-
end
|
153
|
-
|
154
|
-
basics.merge(custom)
|
155
|
-
end
|
156
|
-
|
157
|
-
def resolve_link(widget, key, id_map)
|
158
|
-
id = widget.dig(*key)
|
159
|
-
return unless tracking_id?(id)
|
160
|
-
|
161
|
-
*id_path, id_key = key
|
162
|
-
monitor_path = (id_path.empty? ? widget : widget.dig(*id_path))
|
163
|
-
monitor_path[id_key] =
|
164
|
-
id_map[id] ||
|
165
|
-
Kennel.err.puts("Unable to find #{id} in existing monitors (they need to be created first to link them)")
|
166
|
-
end
|
167
|
-
|
168
|
-
def tracking_id?(id)
|
169
|
-
id.is_a?(String) && !id.match?(/\A\d+\z/)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|