zuora_connect 3.0.0.pre.b → 3.0.0.pre.g

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: d7d9c3445983c015ce0615581bee9d36802b113c220caf4404f4bed697fc67ac
4
- data.tar.gz: 29428d8aec94b04f215ac3faa5faba871cf1c21f60eb804abe6f501adafdb0ca
3
+ metadata.gz: 7443cb29882ccc12bc04d9e58f21fe54dbae32e6b4e7ffe12b699b63854cce55
4
+ data.tar.gz: 9b87ed757abeca777bff58cf469f6e7d918aeacf304ec98bcd6bb02458195754
5
5
  SHA512:
6
- metadata.gz: cb4cee9b6e964dbd417e758bf03e1a7cf1461d600e327110ad0155c5fd710e7083fb2d476697a24fe5d327a22eea4585982dbe1133b32b7c849a921a1004fe07
7
- data.tar.gz: 7bd1393e58a2b341a2c64d8b8d870bbc13e906fa99ba22dd201a2afd250642505b1480469cfa5788dfd45215fe726b3af5a117d6eb80e623cc55e8d37bbd65cc
6
+ metadata.gz: 9ddc22c116f93881f4f7c0901ee9e220087e038392238fd4681c899725fcf72836203eafe88a59b2a5f025bc36f3594e743b298a47b5aa1d1ae2ed21ffb1de57
7
+ data.tar.gz: a9d5f1aaeddd76c772eacfbcdbaa6404a6edeeef8194a7626252f2df55afc7c08b6c962c64be01139c5c4f1f0609a17a4cd101fca16bff2011ab657b23a52cc8
@@ -152,7 +152,8 @@ module ZuoraConnect
152
152
  if ZuoraConnect.configuration.mode != "Production"
153
153
  mock_task_data = {
154
154
  "id" => ZuoraConnect.configuration.dev_mode_appinstance,
155
- "mode" => ZuoraConnect.configuration.dev_mode_mode
155
+ "mode" => ZuoraConnect.configuration.dev_mode_mode,
156
+ "name" => "Developer Instance"
156
157
  }
157
158
 
158
159
  case ZuoraConnect.configuration.dev_mode_options.class
@@ -168,7 +169,7 @@ module ZuoraConnect
168
169
  end
169
170
 
170
171
  self.build_task(task_data: mock_task_data, session: session)
171
- self.set_backup_creds
172
+ self.set_backup_creds if !self['zuora_logins'].present?
172
173
  self.last_refresh = Time.now.to_i
173
174
  else
174
175
  time_expire = (session["#{self.id}::last_refresh"] || Time.now).to_i - INSTANCE_REFRESH_WINDOW.ago.to_i
@@ -34,15 +34,3 @@ Resque.module_eval do
34
34
  Hash[queue_names.zip(sizes)]
35
35
  end
36
36
  end
37
-
38
- if defined?(Resque.logger)
39
- Resque.logger = ZuoraObservability::Logger.custom_logger(name: "Resque", type: 'Monologger', level: MonoLogger::INFO)
40
- Resque::Scheduler.logger = ZuoraObservability::Logger.custom_logger(name: "ResqueScheduler") if defined?(Resque::Scheduler)
41
- end
42
- if defined?(Delayed::Worker.logger)
43
- Delayed::Worker.logger = ZuoraObservability::Logger.custom_logger(name: "DelayedJob", type: 'Monologger', level: MonoLogger::INFO)
44
- end
45
-
46
- Makara::Logging::Logger.logger = ZuoraObservability::Logger.custom_logger(name: "Makara") if defined?(Makara)
47
- ElasticAPM.agent.config.logger = ZuoraObservability::Logger.custom_logger(name: "ElasticAPM", level: MonoLogger::WARN) if defined?(ElasticAPM) && ElasticAPM.running?
48
- ActionMailer::Base.logger = ZuoraObservability::Logger.custom_logger(name: "ActionMailer", type: 'Monologger') if defined?(ActionMailer)
@@ -1,37 +1,6 @@
1
1
  module ZuoraConnect
2
2
  require 'uri'
3
3
 
4
- # Object of this class is passed to the ActiveSupport::Notification hook
5
- class PageRequest
6
-
7
- # This method is triggered when a non error page is loaded (not 404)
8
- def call(name, started, finished, unique_id, payload)
9
- # If the url contains any css or JavaScript files then do not collect metrics for them
10
- return nil if ["css", "assets", "jpg", "png", "jpeg", "ico"].any? { |word| payload[:path].include?(word) }
11
-
12
- # Getting the endpoint and the content_type
13
- content_hash = {:html => "text/html", :js => "application/javascript", :json => "application/json", :csv => "text/csv"}
14
- content_type = content_hash.key?(payload[:format]) ? content_hash[payload[:format]] : payload[:format]
15
- content_type = content_type.to_s.gsub('text/javascript', 'application/javascript')
16
-
17
- # payloads with 500 requests do not have status as it is not set by the controller
18
- # https://github.com/rails/rails/issues/33335
19
- #status_code = payload[:status] ? payload[:status] : payload[:exception_object].present? ? 500 : ""
20
- if payload[:exception].present?
21
- status_code, exception = [500, payload[:exception].first]
22
- else
23
- status_code, exception = [payload[:status], nil]
24
- end
25
-
26
- tags = {method: payload[:method], status: status_code, error_type: exception, content_type: content_type, controller: payload[:controller], action: payload[:action]}.compact
27
-
28
- values = {view_time: payload[:view_runtime], db_time: payload[:db_runtime], response_time: ((finished-started)*1000)}.compact
29
- values = values.map{ |k,v| [k,v.round(2)]}.to_h
30
-
31
- ZuoraObservability::Metrics.write_to_telegraf(direction: :inbound, tags: tags, values: values)
32
- end
33
- end
34
-
35
4
  class MetricsMiddleware
36
5
 
37
6
  require "zuora_connect/version"
@@ -12,7 +12,7 @@ module Resque
12
12
  when "Hash"
13
13
  data = args.merge({:worker_class => self.to_s})
14
14
  end
15
- if Rails.logger.is_a?(Ougai::Logger)
15
+ if Rails.logger.is_a?(Ougai::Logger) && !Rails.env.development?
16
16
  Rails.logger.with_fields = {job: data, trace_id: SecureRandom.uuid, name: "RailsWorker"}
17
17
  end
18
18
 
@@ -17,7 +17,7 @@ module Resque
17
17
  when "Hash"
18
18
  data = args.merge({:worker_class => self.to_s})
19
19
  end
20
- if Rails.logger.is_a?(Ougai::Logger)
20
+ if Rails.logger.is_a?(Ougai::Logger) && !Rails.env.development?
21
21
  Rails.logger.with_fields = {job: data, trace_id: SecureRandom.uuid, name: "RailsWorker"}
22
22
  end
23
23
  data = {:msg => 'Starting job', :job => data}
@@ -680,7 +680,7 @@ module ZuoraConnect
680
680
  session["#{ZuoraConnect.configuration.dev_mode_appinstance}::admin"] = ZuoraConnect.configuration.dev_mode_admin
681
681
 
682
682
  values = {
683
- id: ZuoraConnect.configuration.dev_mode_appinstance,
683
+ id: ZuoraConnect.configuration.dev_mode_appinstance,
684
684
  access_token: ZuoraConnect.configuration.dev_mode_user,
685
685
  refresh_token: ZuoraConnect.configuration.dev_mode_pass,
686
686
  token: ZuoraConnect.configuration.dev_mode_pass+ZuoraConnect.configuration.dev_mode_pass,
@@ -692,9 +692,9 @@ module ZuoraConnect
692
692
  if @appinstance.blank?
693
693
  Apartment::Tenant.switch!("public")
694
694
  begin
695
- Apartment::Tenant.create(values[:appinstance].to_s)
695
+ Apartment::Tenant.create(ZuoraConnect.configuration.dev_mode_appinstance.to_s)
696
696
  rescue Apartment::TenantExists => ex
697
- Apartment::Tenant.drop(values[:appinstance].to_s)
697
+ Apartment::Tenant.drop(ZuoraConnect.configuration.dev_mode_appinstance.to_s)
698
698
  retry
699
699
  end
700
700
  @appinstance = ZuoraConnect::AppInstance.new()
@@ -5,17 +5,6 @@ require 'middleware/bad_multipart_form_data_sanitizer'
5
5
 
6
6
  module ZuoraConnect
7
7
  class Railtie < Rails::Railtie
8
- REQUEST_HEADERS_TO_IGNORE = %W(
9
- RAW_POST_DATA
10
- REQUEST_METHOD
11
- REQUEST_URI
12
- REQUEST_PATH
13
- PATH_INFO
14
- CONTENT_TYPE
15
- ORIGINAL_FULLPATH
16
- QUERY_STRING
17
- )
18
-
19
8
  config.before_initialize do
20
9
  version = Rails.version
21
10
  if version >= "5.0.0"
@@ -43,8 +32,5 @@ module ZuoraConnect
43
32
  app.config.middleware.use Rack::Deflater, if: ->(env, *) { env['PATH_INFO'] == '/connect/internal/metrics' }
44
33
  end
45
34
  end
46
-
47
- # hook to process_action
48
- ActiveSupport::Notifications.subscribe('process_action.action_controller', ZuoraConnect::PageRequest.new)
49
35
  end
50
36
  end
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "3.0.0-b"
2
+ VERSION = "3.0.0-g"
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.b
4
+ version: 3.0.0.pre.g
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-03 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -186,16 +186,16 @@ dependencies:
186
186
  name: zuora_observability
187
187
  requirement: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - ">="
189
+ - - '='
190
190
  - !ruby/object:Gem::Version
191
- version: '0'
191
+ version: 0.1.0.pre.b
192
192
  type: :runtime
193
193
  prerelease: false
194
194
  version_requirements: !ruby/object:Gem::Requirement
195
195
  requirements:
196
- - - ">="
196
+ - - '='
197
197
  - !ruby/object:Gem::Version
198
- version: '0'
198
+ version: 0.1.0.pre.b
199
199
  - !ruby/object:Gem::Dependency
200
200
  name: rspec
201
201
  requirement: !ruby/object:Gem::Requirement