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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96eb85d1f22f9e43e77f9dab8a187ce092e6e5bebfc8a40805d42b914ff1b7ad
4
- data.tar.gz: 5f77076744852fed16f83b33c098a9e2be0754cb70ba01ef9c6e8495891a86a3
3
+ metadata.gz: 8f102da5d3b8eacf86f53c79a69e2b0ab306cadfdd67a510b92de93788d02868
4
+ data.tar.gz: 7d3f89da30883780fc07725ce24159e02eed059f68c9579582f1287fd84d0857
5
5
  SHA512:
6
- metadata.gz: 11651fbf9c9407ef28b58090bec1b2a3fa6fd83316f6c7ee1036cb7b169cd4604b4e28a582caeb5c17e71ca23a1465d3dbaafc99fd885df83c5584adbd43606a
7
- data.tar.gz: 7131be1a495b2e47b892f900c55a88a3a798e296661427de47247f0bda17b0a6d73ee6bcb5b0568c7bc82d5e919adb0fc6aaeb76ecb29bacfd34a305c1c06a8b
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
- if controller.instance_variable_defined?(:@appinstance)
5
- appinstance = controller.instance_variable_get(:@appinstance)
6
- if appinstance.logitems.present? && appinstance.logitems.class == Hash
7
- 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.")
8
- custom_payload.merge!(appinstance.logitems)
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
- if controller.instance_variable_defined?(:@appinstance)
16
- appinstance = controller.instance_variable_get(:@appinstance)
17
- custom_payload.merge!({ email: appinstance.connect_user })
18
- end
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.to_s
5
+ case args.class.name
6
6
  when "Array"
7
- if args.first.class == Hash
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 = {job: data, trace_id: SecureRandom.uuid, name: "RailsWorker"}
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(args)
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(args)
73
- Rails.logger.info("Starting job")
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.to_s
10
+ case args.class.name
11
11
  when "Array"
12
- if args.first.class == Hash
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 = {job: data, trace_id: SecureRandom.uuid, name: "RailsWorker"}
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
- Rails.logger.info(data) if data.present?
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, zuora: zuora_details.merge({:error => response.body}))
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, zuora: zuora_details.merge({:error => final_error}))
555
+ ZuoraConnect.logger.warn("UI Authorization Error", ex, response_body: final_error)
556
556
  else
557
- ZuoraConnect.logger.info("UI Authorization Error", ex, zuora: zuora_details.merge({:error => final_error}))
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
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "3.0.0-s"
2
+ VERSION = "3.0.0-x"
3
3
  end
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.s
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-07 00:00:00.000000000 Z
11
+ date: 2021-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment