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: 38345e2eca706bb365900e3e3eb7ea2488d38587b654536cfe60bc04367a9e8c
4
- data.tar.gz: 101d18e408627530170f6b62013ed494970939fa40e46fecb8e38e7cf4493685
3
+ metadata.gz: 3b5d5b1fb4fcee54a7ebe9cb45e950c8360c6b53652a90d6aa2d7e0884fdf079
4
+ data.tar.gz: 83b4b1b28772acd3ccd73ea21380314e4aabfa8417e6bc34509d385c6941a337
5
5
  SHA512:
6
- metadata.gz: fcf19c204af28d1a540408f86967e96e25e7345ffe0cdd1cfd9fc07b697cdbfba2abfee9fb9dca9f042c34988826dd3f2e000e57239fd3d1f5a19b1fd72309f8
7
- data.tar.gz: a0bb8e4e1499fcdca95a925565fe601db6cc1a410c2c2d0c36b47ec3d766e248477bb67ecb842d4c79540a4cb3b49df332faa87c9913bb3e2851fe60a8e2a514
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
- instance_variable_set("@#{metric[:name]}_#{metric[:type]}", PrometheusExporter::Client.default.register(metric[:type], metric[:name], metric[:description]))
45
-
46
- define_singleton_method(metric[:name]) do
47
- case metric[:type]
48
- when :counter
49
- instance_variable_get("@#{metric[:name]}_#{metric[:type]}")&.observe(1)
50
- else
51
- "Metric of type #{metric[:type]} unsupported, implement it in Insights::API::Common::Metrics#L45"
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
@@ -1,7 +1,7 @@
1
1
  module Insights
2
2
  module API
3
3
  module Common
4
- VERSION = "4.1.1".freeze
4
+ VERSION = "4.1.2".freeze
5
5
  end
6
6
  end
7
7
  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.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-06-09 00:00:00.000000000 Z
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