kennel 1.78.1 → 1.78.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 +4 -4
- data/lib/kennel/models/dashboard.rb +1 -1
- data/lib/kennel/models/monitor.rb +4 -1
- data/lib/kennel/template_variables.rb +13 -9
- data/lib/kennel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 404c565dc87a8ffd30f1c0293228cc5270bedd3c6e5eaae1d191ba6cdae60ce7
|
4
|
+
data.tar.gz: 274f807772d6077c625a503aeb3d98edeef795bf0d7c40845db56d7b2e2e2ff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b165262ab6d8f6e8efadff786d3829a75e96d6893e4235eed961ef5203c66d0f250488e7911964a77c2862df0e196e08619582ce9cda51fed851141785a0a9c4
|
7
|
+
data.tar.gz: ab59bfdd4ca2d73526fb28126fd1f18765ce92703d7bad71c05d7f321f54fa39192db87ad4a7ae65c12441e38eb794264bceae8aad57be84e30a2c06ac65b3f5
|
@@ -209,7 +209,10 @@ module Kennel
|
|
209
209
|
.map! { |w| %("#{w}.name") }
|
210
210
|
used.uniq.each do |match, group|
|
211
211
|
next if allowed.include?(group)
|
212
|
-
invalid!
|
212
|
+
invalid!(
|
213
|
+
"#{match} used with #{group}, but can only be used with #{allowed.join(", ")}. " \
|
214
|
+
"Group the query by #{group.sub(".name", "").tr('"', "")} or change the #{match}"
|
215
|
+
)
|
213
216
|
end
|
214
217
|
end
|
215
218
|
end
|
@@ -16,18 +16,22 @@ module Kennel
|
|
16
16
|
|
17
17
|
# check for queries that do not use the variables and would be misleading
|
18
18
|
# TODO: do the same check for apm_query and their group_by
|
19
|
-
def validate_template_variables(data
|
19
|
+
def validate_template_variables(data)
|
20
20
|
variables = (data[:template_variables] || []).map { |v| "$#{v.fetch(:name)}" }
|
21
|
-
|
21
|
+
return if variables.empty?
|
22
|
+
|
23
|
+
queries = data[:widgets].flat_map do |widget|
|
22
24
|
([widget] + (widget.dig(:definition, :widgets) || [])).flat_map { |w| widget_queries(w) }
|
23
25
|
end.compact
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
|
27
|
+
matches = variables.map { |v| Regexp.new "#{Regexp.escape(v)}\\b" }
|
28
|
+
queries.reject! { |q| matches.all? { |m| q.match? m } }
|
29
|
+
return if queries.empty?
|
30
|
+
|
31
|
+
invalid!(
|
32
|
+
"queries #{queries.join(", ")} must use the template variables #{variables.join(", ")}\n" \
|
33
|
+
"If that is not possible, add `validate: -> { false } # query foo in bar does not have baz tag`"
|
34
|
+
)
|
31
35
|
end
|
32
36
|
|
33
37
|
def widget_queries(widget)
|
data/lib/kennel/version.rb
CHANGED
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.78.
|
4
|
+
version: 1.78.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-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|