insights-api-common 4.1.1 → 4.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b5d5b1fb4fcee54a7ebe9cb45e950c8360c6b53652a90d6aa2d7e0884fdf079
|
4
|
+
data.tar.gz: 83b4b1b28772acd3ccd73ea21380314e4aabfa8417e6bc34509d385c6941a337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43f6f59fd6787c5ac69c746fc89b4f0ab2e8122d13a3e4c0151c2b9fdbd8d4dd5ccc4a9a8068b5da7c466e870299bee88e58994e5169b74571b00b466d2b61f5
|
7
|
+
data.tar.gz: ec3589a7a4327583e3bdbb604862a72f3e421305f566336adb64d1ac5ba9d353da5333865fabb3cf145f3ffef44f29ee67ce5a4519ec252db3b25a138096ffc1
|
@@ -7,7 +7,7 @@ module Insights
|
|
7
7
|
def self.custom_message(exception)
|
8
8
|
case exception.class.to_s
|
9
9
|
when "Pundit::NotAuthorizedError"
|
10
|
-
"You are not authorized to #{exception.query.delete_suffix('?')} this #{exception.record.model_name.human.downcase}"
|
10
|
+
"You are not authorized to #{exception.query.to_s.delete_suffix('?')} this #{exception.record.model_name.human.downcase}"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -6,12 +6,13 @@ module Insights
|
|
6
6
|
require 'prometheus_exporter'
|
7
7
|
require 'prometheus_exporter/client'
|
8
8
|
|
9
|
+
setup_custom_metrics(args[:custom_metrics])
|
10
|
+
|
9
11
|
return if metrics_port == 0
|
10
12
|
|
11
13
|
ensure_exporter_server
|
12
14
|
enable_in_process_metrics
|
13
15
|
enable_web_server_metrics(prefix)
|
14
|
-
setup_custom_metrics(args[:custom_metrics])
|
15
16
|
end
|
16
17
|
|
17
18
|
private_class_method def self.ensure_exporter_server
|
@@ -41,14 +42,18 @@ module Insights
|
|
41
42
|
return if custom_metrics.nil?
|
42
43
|
|
43
44
|
custom_metrics.each do |metric|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
if metrics_port == 0
|
46
|
+
define_singleton_method(metric[:name]) {}
|
47
|
+
else
|
48
|
+
instance_variable_set("@#{metric[:name]}_#{metric[:type]}", PrometheusExporter::Client.default.register(metric[:type], metric[:name], metric[:description]))
|
49
|
+
|
50
|
+
define_singleton_method(metric[:name]) do
|
51
|
+
case metric[:type]
|
52
|
+
when :counter
|
53
|
+
instance_variable_get("@#{metric[:name]}_#{metric[:type]}")&.observe(1)
|
54
|
+
else
|
55
|
+
"Metric of type #{metric[:type]} unsupported, implement it in Insights::API::Common::Metrics#L45"
|
56
|
+
end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
@@ -441,7 +441,7 @@ module Insights
|
|
441
441
|
end
|
442
442
|
|
443
443
|
# Take existing attrs, that we won't generate
|
444
|
-
['example', 'format', 'readOnly', 'title', 'description'].each do |property_key|
|
444
|
+
['example', 'format', 'nullable', 'readOnly', 'title', 'description'].each do |property_key|
|
445
445
|
property_value = openapi_contents.dig(*path_parts(SCHEMAS_PATH), klass_name, "properties", key, property_key)
|
446
446
|
properties_value[property_key] = property_value if property_value
|
447
447
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insights-api-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Insights Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_tenant
|