zuora_connect 1.7.81y → 1.7.81z

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: 3ea720863ce1fe37d6003298db12e63bd14860d5fce2ce9265eecbd34f623742
4
- data.tar.gz: 9df0379c5f5bb077f59fb780681f7fba412b00e53ad4ea2f1c169e780d041be4
3
+ metadata.gz: 7b3981851d33ab348f316691961b5c7d285f484f694410a3346680c311ffe9e8
4
+ data.tar.gz: 8d420ab07b185af43e065328b06e3d6b298451bae6f1594371b4e307872d8849
5
5
  SHA512:
6
- metadata.gz: 50900754abe513cc598891da74e573280373ca979179206bcb45e03d87b61e08af1b2e542926e76db33d69cbbf5a2a03e7dd203a7976c8943e80923b3bc385d4
7
- data.tar.gz: 728ba29c67d3ac12084ecccced393e8be88cb1b738134c2613b0fc459cc619f01f16e4a4f97fa0135f88b70a6df484b5bb15dbb8c76b7612cdc24e007442e5d2
6
+ metadata.gz: c8142f4739b94aee5175713bd694fbdb239ca99b7aeb708290da0f1ba3c2e1aaeb1fc6f909f17b04afffe80ecc0a193e31b34fed45824c5c0849f3aa4a9fe107
7
+ data.tar.gz: 1aa946e26d50d4bedaf7828711b662921164b13469a77c8894dc0801a8daf0c2dd9cf586e3d651d347f50a7febbae153803ac54db3218200a28ace12b3c7d5b5
@@ -26,6 +26,19 @@ module ZuoraConnect
26
26
  end
27
27
 
28
28
  def health
29
+ if params[:error].present?
30
+ begin
31
+ raise ZuoraConnect::Exceptions::Error.new('This is an error')
32
+ rescue => ex
33
+ case params[:error]
34
+ when 'Log'
35
+ Rails.logger.error(ex)
36
+ when 'Exception'
37
+ raise
38
+ end
39
+ end
40
+ end
41
+
29
42
  render json: {
30
43
  message: "Alive",
31
44
  status: 200
@@ -7,7 +7,7 @@ module Resque
7
7
  module Plugins
8
8
  module CustomLogger
9
9
  def before_perform(*args)
10
- Rails.logger.with_fields = { trace_id: SecureRandom.uuid, name: "RailsWorker"} if Rails.configuration.logger.class.to_s == 'Ougai::Logger'
10
+ Rails.logger.with_fields = { trace_id: SecureRandom.uuid, name: "RailsWorker"} if Rails.logger.class.to_s == 'Ougai::Logger'
11
11
  case args.class.to_s
12
12
  when "Array"
13
13
  if args.first.class == Hash
@@ -18,7 +18,9 @@ module Resque
18
18
  when "Hash"
19
19
  data = args.merge({:worker_class => self.to_s})
20
20
  end
21
- Rails.logger.info({:msg => 'Starting job', :job => data}) if data.present?
21
+ data = {:msg => 'Starting job', :job => data}
22
+ data.merge!({:app_instance_id => data.dig(:job, 'app_instance_id')}) if data.dig(:job, 'app_instance_id').present?
23
+ Rails.logger.info(data) if data.present?
22
24
  end
23
25
  end
24
26
  end
@@ -39,6 +39,14 @@ module ZuoraConnect
39
39
  logger.level = level
40
40
  logger.before_log = lambda do |data|
41
41
  data[:trace_id] = ZuoraConnect::RequestIdMiddleware.request_id if ZuoraConnect::RequestIdMiddleware.request_id.present?
42
+ if Thread.current[:appinstance].present?
43
+ data[:app_instance_id] = Thread.current[:appinstance].id
44
+ logitems = Thread.current[:appinstance].logitems
45
+ if logitems.present? && logitems.class == Hash
46
+ data[:tenant_ids] = logitems[:tenant_ids] if logitems[:tenant_ids].present?
47
+ data[:organization] = logitems[:organization] if logitems[:organization].present?
48
+ end
49
+ end
42
50
  end
43
51
  else
44
52
  logger = MonoLogger.new(STDOUT)
@@ -50,13 +58,22 @@ module ZuoraConnect
50
58
  end
51
59
 
52
60
  require 'json'
53
- JSON.dump(
61
+ store = {
54
62
  name: name,
55
63
  level: serverity,
56
64
  timestamp: datetime.strftime('%FT%T.%6NZ'),
57
65
  pid: Process.pid,
58
66
  message: name == "ActionMailer" ? msg.strip : msg
59
- ) + "\n"
67
+ }
68
+ if Thread.current[:appinstance].present?
69
+ store[:app_instance_id] = Thread.current[:appinstance].id
70
+ logitems = Thread.current[:appinstance].logitems
71
+ if logitems.present? && logitems.class == Hash
72
+ store[:tenant_ids] = logitems[:tenant_ids] if logitems[:tenant_ids].present?
73
+ store[:organization] = logitems[:organization] if logitems[:organization].present?
74
+ end
75
+ end
76
+ JSON.dump(store) + "\n"
60
77
  end
61
78
  end
62
79
  return logger
@@ -50,11 +50,11 @@ module ZuoraConnect
50
50
  exceptions = %w(controller action format id)
51
51
  items = {
52
52
  #time: event.time.strftime('%FT%T.%6N'),
53
- params: event.payload[:params].except(*exceptions),
54
- exception: event.payload[:exception],
55
- exception_object: event.payload[:exception_object],
56
- process_id: Process.pid
53
+ params: event.payload[:params].except(*exceptions).to_json.to_s
57
54
  }
55
+ items.merge!({exception_object: event.payload[:exception_object]}) if event.payload[:exception_object].present?
56
+ items.merge!({exception: event.payload[:exception]}) if event.payload[:exception].present?
57
+
58
58
  if Thread.current[:appinstance].present?
59
59
  items.merge!({appinstance_id: Thread.current[:appinstance].id, connect_user: Thread.current[:appinstance].connect_user, new_session: Thread.current[:appinstance].new_session_message})
60
60
  if Thread.current[:appinstance].logitems.present? && Thread.current[:appinstance].logitems.class == Hash
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "1.7.81y"
2
+ VERSION = "1.7.81z"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.81y
4
+ version: 1.7.81z
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team