zuora_connect 3.0.0.pre.s → 3.0.0.pre.x
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/resque.rb +4 -0
- data/config/initializers/zuora_observability.rb +13 -10
- data/lib/resque/plugins/app_instance_job.rb +8 -7
- data/lib/resque/plugins/custom_logger.rb +8 -9
- data/lib/zuora_connect/controllers/helpers.rb +3 -3
- data/lib/zuora_connect/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: 8f102da5d3b8eacf86f53c79a69e2b0ab306cadfdd67a510b92de93788d02868
|
4
|
+
data.tar.gz: 7d3f89da30883780fc07725ce24159e02eed059f68c9579582f1287fd84d0857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ebaffa1df592eb2982b690c40bd9e2db671f52ad8f302005a7b72152ff0327bfe61f8554f22e2d4c49b2fbfc57ca280e407cb048b3457d2ee5426e51b38bcec
|
7
|
+
data.tar.gz: 5fb9cb8bffc0b6f0327f2191d663b2574068f50d568c38728570bdb55130b3bbc7e626f6f1060db861467455195c49c6fcf78a4981bffa85a66716e059fc9b79
|
@@ -5,6 +5,10 @@ if defined?(Resque::Worker)
|
|
5
5
|
Resque::Job.send(:include, Resque::SelfLookup)
|
6
6
|
end
|
7
7
|
|
8
|
+
if ENV['PROCESS_TYPE'] == 'worker'
|
9
|
+
Rails.logger = ZuoraObservability::Logger.custom_logger(name: 'RailsWorker', level: Logger::INFO)
|
10
|
+
end
|
11
|
+
|
8
12
|
Resque.module_eval do
|
9
13
|
# Returns a hash, mapping queue names to queue sizes
|
10
14
|
def queue_sizes
|
@@ -1,21 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ZuoraObservability.configure do |config|
|
2
4
|
config.zecs_service_hook = lambda do |controller|
|
3
5
|
custom_payload = {}
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
6
|
+
appinstance = controller.instance_variable_get(:@appinstance)
|
7
|
+
|
8
|
+
if appinstance&.logitems.present? && appinstance.logitems.class == Hash
|
9
|
+
ActiveSupport::Deprecation.warn("logitems is deprecated, please use zecs_service_hook. See 'https://gitlab.zeta.tools/extension-products/incubating-projects/zuora_observability/-/blob/master/doc/logging.md' for more details.")
|
10
|
+
custom_payload.merge!(appinstance.logitems)
|
10
11
|
end
|
12
|
+
|
11
13
|
custom_payload
|
12
14
|
end
|
15
|
+
|
13
16
|
config.add_custom_payload_hook do |controller|
|
14
17
|
custom_payload = {}
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
18
|
+
appinstance = controller.instance_variable_get(:@appinstance)
|
19
|
+
|
20
|
+
custom_payload.merge!({ email: appinstance.connect_user }) if appinstance
|
21
|
+
|
19
22
|
custom_payload
|
20
23
|
end
|
21
24
|
end
|
@@ -2,24 +2,25 @@ module Resque
|
|
2
2
|
module Plugins
|
3
3
|
module AppInstanceJob
|
4
4
|
def around_perform(args)
|
5
|
-
case args.class.
|
5
|
+
case args.class.name
|
6
6
|
when "Array"
|
7
|
-
if args.first.
|
7
|
+
if args.first.is_a?(Hash)
|
8
8
|
data = args.first.merge({:worker_class => self.to_s})
|
9
9
|
else
|
10
|
-
data = {:worker_class => self.to_s, :args => args}
|
10
|
+
data = {:worker_class => self.to_s, :args => args.to_json}
|
11
11
|
end
|
12
12
|
when "Hash"
|
13
13
|
data = args.merge({:worker_class => self.to_s})
|
14
14
|
end
|
15
|
+
|
15
16
|
if Rails.logger.is_a?(Ougai::Logger) && !Rails.env.development?
|
16
|
-
Rails.logger.with_fields = {
|
17
|
+
Rails.logger.with_fields = { zecs_service: data.transform_keys(&:to_sym), trace_id: SecureRandom.uuid }
|
17
18
|
end
|
18
19
|
|
19
20
|
begin
|
20
21
|
connection_count ||= 0
|
21
22
|
@appinstance = ZuoraConnect::AppInstance.find(args['app_instance_id'].to_i)
|
22
|
-
job_start_log
|
23
|
+
job_start_log
|
23
24
|
|
24
25
|
@appinstance.new_session(holding_pattern: true)
|
25
26
|
rescue ActiveRecord::RecordNotFound => exception
|
@@ -69,8 +70,8 @@ module Resque
|
|
69
70
|
Rails.logger.flush if Rails.logger.methods.include?(:flush)
|
70
71
|
end
|
71
72
|
|
72
|
-
def job_start_log
|
73
|
-
|
73
|
+
def job_start_log
|
74
|
+
Rails.logger.info('Starting job')
|
74
75
|
end
|
75
76
|
end
|
76
77
|
end
|
@@ -7,25 +7,24 @@ module Resque
|
|
7
7
|
module Plugins
|
8
8
|
module CustomLogger
|
9
9
|
def before_perform(*args)
|
10
|
-
case args.class.
|
10
|
+
case args.class.name
|
11
11
|
when "Array"
|
12
|
-
if args.first.
|
12
|
+
if args.first.is_a?(Hash)
|
13
13
|
data = args.first.merge({:worker_class => self.to_s})
|
14
14
|
else
|
15
|
-
data = {:worker_class => self.to_s, :args => args}
|
15
|
+
data = {:worker_class => self.to_s, :args => args.to_json}
|
16
16
|
end
|
17
17
|
when "Hash"
|
18
18
|
data = args.merge({:worker_class => self.to_s})
|
19
19
|
end
|
20
|
+
|
20
21
|
if Rails.logger.is_a?(Ougai::Logger) && !Rails.env.development?
|
21
|
-
Rails.logger.with_fields = {
|
22
|
-
end
|
23
|
-
data = {:msg => 'Starting job', :job => data}
|
24
|
-
if data.dig(:job, 'app_instance_id').present?
|
25
|
-
data[:app_instance_id] = data.dig(:job, 'app_instance_id')
|
22
|
+
Rails.logger.with_fields = { zecs_service: data.transform_keys(&:to_sym), trace_id: SecureRandom.uuid }
|
26
23
|
end
|
27
24
|
|
28
|
-
|
25
|
+
if data.present?
|
26
|
+
Rails.logger.info('Starting job')
|
27
|
+
end
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
@@ -550,11 +550,11 @@ module ZuoraConnect
|
|
550
550
|
final_error = output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text
|
551
551
|
session.clear
|
552
552
|
if final_error.blank?
|
553
|
-
ZuoraConnect.logger.warn("UI Authorization Error", ex,
|
553
|
+
ZuoraConnect.logger.warn("UI Authorization Error", ex, response_body: response.body)
|
554
554
|
elsif final_error != "INVALID_SESSION"
|
555
|
-
ZuoraConnect.logger.warn("UI Authorization Error", ex,
|
555
|
+
ZuoraConnect.logger.warn("UI Authorization Error", ex, response_body: final_error)
|
556
556
|
else
|
557
|
-
ZuoraConnect.logger.info("UI Authorization Error", ex,
|
557
|
+
ZuoraConnect.logger.info("UI Authorization Error", ex, response_body: final_error)
|
558
558
|
end
|
559
559
|
redirect_to "https://#{zuora_host}/apps/newlogin.do?retURL=#{request.fullpath}"
|
560
560
|
return
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.pre.
|
4
|
+
version: 3.0.0.pre.x
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|