zuora_connect 1.7.88 → 1.7.710
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 +5 -5
- data/app/controllers/zuora_connect/api/v1/app_instance_controller.rb +0 -13
- data/app/controllers/zuora_connect/static_controller.rb +6 -19
- data/app/models/zuora_connect/app_instance_base.rb +60 -122
- data/app/models/zuora_connect/telegraf.rb +7 -11
- data/config/initializers/redis.rb +2 -2
- data/config/initializers/resque.rb +1 -10
- data/config/routes.rb +0 -1
- data/db/migrate/20100718151733_create_connect_app_instances.rb +1 -1
- data/db/migrate/20101024162319_add_tokens_to_app_instance.rb +1 -1
- data/db/migrate/20101024220705_add_token_to_app_instance.rb +1 -1
- data/db/migrate/20110131211919_add_sessions_table.rb +1 -1
- data/db/migrate/20110411200303_add_expiration_to_app_instance.rb +1 -1
- data/db/migrate/20110413191512_add_new_api_token.rb +1 -1
- data/db/migrate/20110503003602_add_catalog_data_to_app_instance.rb +1 -1
- data/db/migrate/20110503003603_add_catalog_mappings_to_app_instance.rb +1 -1
- data/db/migrate/20110503003604_catalog_default.rb +1 -1
- data/db/migrate/20180301052853_add_catalog_attempted_at.rb +1 -1
- data/db/migrate/20181206162339_add_fields_to_instance.rb +1 -1
- data/lib/metrics/net.rb +2 -2
- data/lib/middleware/metrics_middleware.rb +2 -5
- data/lib/resque/plugins/custom_logger.rb +31 -14
- data/lib/zuora_connect/configuration.rb +1 -0
- data/lib/zuora_connect/controllers/helpers.rb +16 -15
- data/lib/zuora_connect/engine.rb +1 -2
- data/lib/zuora_connect/railtie.rb +15 -21
- data/lib/zuora_connect/version.rb +1 -1
- data/lib/zuora_connect.rb +0 -109
- metadata +45 -74
- data/lib/logging/connect_formatter.rb +0 -39
- data/lib/middleware/request_id_middleware.rb +0 -16
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddCatalogDataToAppInstance < ActiveRecord::Migration
|
1
|
+
class AddCatalogDataToAppInstance < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
add_column :zuora_connect_app_instances, :catalog_updated_at, :datetime unless column_exists? :zuora_connect_app_instances, :catalog_updated_at
|
4
4
|
add_column :zuora_connect_app_instances, :catalog, :jsonb, default: {} unless column_exists? :zuora_connect_app_instances, :catalog
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddCatalogMappingsToAppInstance < ActiveRecord::Migration
|
1
|
+
class AddCatalogMappingsToAppInstance < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
add_column :zuora_connect_app_instances, :catalog_mapping, :jsonb, default: {} unless column_exists? :zuora_connect_app_instances, :catalog_mapping
|
4
4
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddCatalogAttemptedAt < ActiveRecord::Migration
|
1
|
+
class AddCatalogAttemptedAt < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
add_column :zuora_connect_app_instances, :catalog_update_attempt_at, :datetime unless column_exists? :zuora_connect_app_instances, :catalog_update_attempt_at
|
4
4
|
end
|
data/lib/metrics/net.rb
CHANGED
@@ -162,7 +162,7 @@ class HttpLogger
|
|
162
162
|
end
|
163
163
|
|
164
164
|
def format_log_entry(message, dump = nil)
|
165
|
-
if self.class.colorize
|
165
|
+
if self.class.colorize
|
166
166
|
message_color, dump_color = "4;32;1", "0;1"
|
167
167
|
log_entry = " \e[#{message_color}m#{message}\e[0m "
|
168
168
|
log_entry << "\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m" % dump if dump
|
@@ -212,7 +212,7 @@ if defined?(Rails)
|
|
212
212
|
if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
|
213
213
|
# Rails3
|
214
214
|
ActiveSupport.on_load(:after_initialize) do
|
215
|
-
HttpLogger.logger =
|
215
|
+
HttpLogger.logger = Rails.logger unless HttpLogger.logger
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Middleware
|
2
2
|
require 'uri'
|
3
3
|
|
4
4
|
# Object of this class is passed to the ActiveSupport::Notification hook
|
@@ -53,10 +53,7 @@ module ZuoraConnect
|
|
53
53
|
env['REQUEST_PATH'] = env['REQUEST_PATH'].gsub(Thread.current[:isHallway], '')
|
54
54
|
|
55
55
|
#We need the forwarded host header to identify location of tenant
|
56
|
-
|
57
|
-
if whitelist.match(env['HTTP_X_FORWARDED_HOST']).present?
|
58
|
-
@bad_headers.delete('HTTP_X_FORWARDED_HOST')
|
59
|
-
end
|
56
|
+
@bad_headers.delete('HTTP_X_FORWARDED_HOST')
|
60
57
|
else
|
61
58
|
Thread.current[:isHallway] = nil
|
62
59
|
end
|
@@ -3,25 +3,42 @@
|
|
3
3
|
#
|
4
4
|
# Monologger supports printing logs in trap block.
|
5
5
|
#
|
6
|
+
# Usage:
|
7
|
+
# require 'resque/plugins/custom_logger'
|
8
|
+
# class ExecuteWorkflowJob
|
9
|
+
# extend Resque::Plugins::CustomLogger
|
10
|
+
# ...
|
11
|
+
# end
|
12
|
+
|
6
13
|
module Resque
|
7
14
|
module Plugins
|
8
15
|
module CustomLogger
|
9
|
-
def before_perform(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
def before_perform(args = nil)
|
17
|
+
marker = SecureRandom.uuid
|
18
|
+
|
19
|
+
logger = MonoLogger.new(STDOUT)
|
20
|
+
logger.level = Rails.application.config.log_level
|
21
|
+
logger.formatter = proc do |serverity, datetime, progname, msg|
|
22
|
+
begin
|
23
|
+
msg = JSON.parse(msg)
|
24
|
+
rescue JSON::ParserError => ex
|
17
25
|
end
|
18
|
-
|
19
|
-
|
26
|
+
|
27
|
+
require 'json'
|
28
|
+
JSON.dump(
|
29
|
+
trace_id: marker,
|
30
|
+
level: serverity,
|
31
|
+
timestamp: datetime.strftime('%FT%T.%6N'),
|
32
|
+
pid: Process.pid,
|
33
|
+
msg: msg
|
34
|
+
) + "\n"
|
20
35
|
end
|
21
|
-
|
22
|
-
|
23
|
-
Rails.logger
|
36
|
+
|
37
|
+
Resque.logger = logger
|
38
|
+
Rails.logger = logger
|
39
|
+
|
40
|
+
Rails.logger.info(args.to_json) if args.present?
|
24
41
|
end
|
25
42
|
end
|
26
43
|
end
|
27
|
-
end
|
44
|
+
end
|
@@ -8,23 +8,23 @@ module ZuoraConnect
|
|
8
8
|
#Skip session for api requests
|
9
9
|
Thread.current[:appinstance] = nil
|
10
10
|
request.session_options[:skip] = true
|
11
|
-
ElasticAPM.set_tag(:trace_id, request.uuid) if defined?(ElasticAPM)
|
11
|
+
ElasticAPM.set_tag(:trace_id, request.uuid) if defined?(ElasticAPM)
|
12
12
|
|
13
13
|
start_time = Time.now
|
14
14
|
if request.headers["API-Token"].present?
|
15
15
|
@appinstance = ZuoraConnect::AppInstance.where(:api_token => request.headers["API-Token"]).first
|
16
|
-
|
16
|
+
Rails.logger.debug("[#{@appinstance.id}] API REQUEST - API token") if @appinstance.present?
|
17
17
|
check_instance
|
18
18
|
else
|
19
19
|
authenticate_or_request_with_http_basic do |username, password|
|
20
20
|
@appinstance = ZuoraConnect::AppInstance.where(:token => password).first
|
21
21
|
@appinstance ||= ZuoraConnect::AppInstance.where(:api_token => password).first
|
22
|
-
|
22
|
+
Rails.logger.debug("[#{@appinstance.id}] API REQUEST - Basic Auth") if @appinstance.present?
|
23
23
|
check_instance
|
24
24
|
end
|
25
25
|
end
|
26
26
|
if @appinstance.present?
|
27
|
-
|
27
|
+
Rails.logger.debug("[#{@appinstance.id}] Authenticate App API Request Completed In - #{(Time.now - start_time).round(2)}s")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -66,13 +66,13 @@ module ZuoraConnect
|
|
66
66
|
render "zuora_connect/static/invalid_launch_request"
|
67
67
|
end
|
68
68
|
rescue => ex
|
69
|
-
|
69
|
+
Rails.logger.debug("Error parsing Instance ID's: #{ex.message}")
|
70
70
|
render "zuora_connect/static/invalid_launch_request"
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
def authenticate_connect_app_request
|
75
|
-
ElasticAPM.set_tag(:trace_id, request.uuid) if defined?(ElasticAPM)
|
75
|
+
ElasticAPM.set_tag(:trace_id, request.uuid) if defined?(ElasticAPM)
|
76
76
|
Thread.current[:appinstance] = nil
|
77
77
|
if params[:app_instance_ids].present? && !params[:app_instance_id].present?
|
78
78
|
begin
|
@@ -86,7 +86,7 @@ module ZuoraConnect
|
|
86
86
|
@appinstance.cache_app_instance
|
87
87
|
session["appInstance"] = app_instance_ids[0]
|
88
88
|
else
|
89
|
-
|
89
|
+
Rails.logger.fatal("Launch Error: Param Instance didnt match session data")
|
90
90
|
render "zuora_connect/static/invalid_launch_request"
|
91
91
|
return
|
92
92
|
end
|
@@ -95,7 +95,7 @@ module ZuoraConnect
|
|
95
95
|
return
|
96
96
|
end
|
97
97
|
rescue => ex
|
98
|
-
|
98
|
+
Rails.logger.fatal("Launch Error: #{ex.message}")
|
99
99
|
render "zuora_connect/static/invalid_launch_request"
|
100
100
|
return
|
101
101
|
end
|
@@ -113,7 +113,7 @@ module ZuoraConnect
|
|
113
113
|
return
|
114
114
|
end
|
115
115
|
rescue => ex
|
116
|
-
|
116
|
+
Rails.logger.fatal("Launch Error: #{ex.message}")
|
117
117
|
render "zuora_connect/static/invalid_launch_request"
|
118
118
|
return
|
119
119
|
end
|
@@ -136,16 +136,16 @@ module ZuoraConnect
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
if session["#{@appinstance.id}::user::email"].present?
|
139
|
-
ElasticAPM.set_user(session["#{@appinstance.id}::user::email"]) if defined?(ElasticAPM)
|
139
|
+
ElasticAPM.set_user(session["#{@appinstance.id}::user::email"]) if defined?(ElasticAPM)
|
140
140
|
PaperTrail.whodunnit = session["#{@appinstance.id}::user::email"] if defined?(PaperTrail)
|
141
141
|
end
|
142
142
|
begin
|
143
143
|
I18n.locale = session["#{@appinstance.id}::user::locale"] ? session["#{@appinstance.id}::user::locale"] : @appinstance.locale
|
144
144
|
rescue I18n::InvalidLocale => ex
|
145
|
-
|
145
|
+
Rails.logger.error("Invalid Locale: #{ex.message}")
|
146
146
|
end
|
147
147
|
Time.zone = session["#{@appinstance.id}::user::timezone"] ? session["#{@appinstance.id}::user::timezone"] : @appinstance.timezone
|
148
|
-
|
148
|
+
Rails.logger.debug("[#{@appinstance.blank? ? "N/A" : @appinstance.id}] Authenticate App Request Completed In - #{(Time.now - start_time).round(2)}s")
|
149
149
|
end
|
150
150
|
|
151
151
|
def persist_connect_app_session
|
@@ -170,6 +170,7 @@ module ZuoraConnect
|
|
170
170
|
def setup_instance_via_data
|
171
171
|
session.clear
|
172
172
|
values = JSON.parse(ZuoraConnect::AppInstance.decrypt_response(Base64.urlsafe_decode64(request["data"])))
|
173
|
+
Rails.logger.debug("Data: #{values.to_json}")
|
173
174
|
if values["param_data"]
|
174
175
|
values["param_data"].each do |k ,v|
|
175
176
|
params[k] = v
|
@@ -184,7 +185,7 @@ module ZuoraConnect
|
|
184
185
|
session["#{values["appInstance"]}::user::email"] = values["current_user"]["email"]
|
185
186
|
end
|
186
187
|
|
187
|
-
|
188
|
+
Rails.logger.debug("App Params: #{values.to_json}}") if Rails.env != "production"
|
188
189
|
|
189
190
|
@appinstance = ZuoraConnect::AppInstance.where(:id => values["appInstance"].to_i).first
|
190
191
|
if @appinstance.blank?
|
@@ -192,7 +193,7 @@ module ZuoraConnect
|
|
192
193
|
begin
|
193
194
|
Apartment::Tenant.create(values["appInstance"].to_s)
|
194
195
|
rescue Apartment::TenantExists => ex
|
195
|
-
|
196
|
+
Rails.logger.debug("Tenant Already Exists")
|
196
197
|
end
|
197
198
|
@appinstance = ZuoraConnect::AppInstance.new(:api_token => values[:api_token],:id => values["appInstance"].to_i, :access_token => values["access_token"].blank? ? values["user"] : values["access_token"], :token => values["refresh_token"] , :refresh_token => values["refresh_token"].blank? ? values["key"] : values["refresh_token"], :oauth_expires_at => values["expires"])
|
198
199
|
@appinstance.save(:validate => false)
|
@@ -249,7 +250,7 @@ module ZuoraConnect
|
|
249
250
|
end
|
250
251
|
Thread.current[:appinstance] = @appinstance
|
251
252
|
PaperTrail.whodunnit = "API User" if defined?(PaperTrail)
|
252
|
-
ElasticAPM.set_user("API User") if defined?(ElasticAPM)
|
253
|
+
ElasticAPM.set_user("API User") if defined?(ElasticAPM)
|
253
254
|
return true
|
254
255
|
else
|
255
256
|
render text: "Access Denied", status: :unauthorized
|
data/lib/zuora_connect/engine.rb
CHANGED
@@ -3,7 +3,6 @@ require 'zuora_connect'
|
|
3
3
|
require 'apartment'
|
4
4
|
require 'httparty'
|
5
5
|
require 'zuora_api'
|
6
|
-
|
7
6
|
module ZuoraConnect
|
8
7
|
class Engine < ::Rails::Engine
|
9
8
|
isolate_namespace ZuoraConnect
|
@@ -16,7 +15,7 @@ module ZuoraConnect
|
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
|
-
|
18
|
+
initializer :append_migrations do |app|
|
20
19
|
unless app.root.to_s.match root.to_s
|
21
20
|
config.paths["db/migrate"].expanded.each do |expanded_path|
|
22
21
|
app.config.paths["db/migrate"] << expanded_path
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'middleware/metrics_middleware'
|
2
|
-
require 'middleware/request_id_middleware'
|
3
2
|
|
4
3
|
module ZuoraConnect
|
5
4
|
class Railtie < Rails::Railtie
|
@@ -23,38 +22,33 @@ module ZuoraConnect
|
|
23
22
|
end
|
24
23
|
end
|
25
24
|
initializer "zuora_connect.configure_rails_initialization" do |app|
|
26
|
-
app.middleware.insert_after Rack::Sendfile,
|
27
|
-
app.middleware.insert_after ActionDispatch::RequestId, ZuoraConnect::RequestIdMiddleware
|
25
|
+
app.middleware.insert_after Rack::Sendfile, Middleware::MetricsMiddleware
|
28
26
|
end
|
29
27
|
|
30
28
|
# hook to process_action
|
31
|
-
ActiveSupport::Notifications.subscribe('process_action.action_controller',
|
29
|
+
ActiveSupport::Notifications.subscribe('process_action.action_controller', Middleware::PageRequest.new)
|
32
30
|
|
33
31
|
initializer(:rails_stdout_logging, before: :initialize_logger) do
|
34
|
-
if Rails.env != 'development' && !ENV['DEIS_APP'].blank?
|
32
|
+
if true || Rails.env != 'development' && !ENV['DEIS_APP'].blank?
|
35
33
|
require 'lograge'
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
35
|
+
logger.formatter = ::Logger::Formatter.new
|
36
|
+
# logger.formatter = proc do |severity, datetime, progname, msg|
|
37
|
+
# {severity: severity, time: datetime.strftime('%FT%T.%6N'), process_id: Process.pid, message: msg }.to_json
|
38
|
+
# end
|
39
|
+
Rails.configuration.logger = ActiveSupport::TaggedLogging.new(logger)
|
40
|
+
Rails.configuration.log_tags = [:uuid]
|
39
41
|
Rails.configuration.lograge.enabled = true
|
40
|
-
Rails.configuration.
|
41
|
-
if Rails.configuration.logger.class.to_s == 'Ougai::Logger'
|
42
|
-
Rails.configuration.lograge.formatter = Class.new do |fmt|
|
43
|
-
def fmt.call(data)
|
44
|
-
{ msg: 'Rails Request', request: data }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
#Rails.configuration.lograge.formatter = Lograge::Formatters::Json.new
|
42
|
+
Rails.configuration.lograge.formatter = Lograge::Formatters::Json.new
|
49
43
|
Rails.configuration.lograge.custom_options = lambda do |event|
|
50
44
|
exceptions = %w(controller action format id)
|
51
45
|
items = {
|
52
46
|
#time: event.time.strftime('%FT%T.%6N'),
|
53
|
-
params: event.payload[:params].except(*exceptions)
|
47
|
+
params: event.payload[:params].except(*exceptions),
|
48
|
+
exception: event.payload[:exception],
|
49
|
+
exception_object: event.payload[:exception_object],
|
50
|
+
process_id: Process.pid
|
54
51
|
}
|
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
52
|
if Thread.current[:appinstance].present?
|
59
53
|
items.merge!({appinstance_id: Thread.current[:appinstance].id, connect_user: Thread.current[:appinstance].connect_user, new_session: Thread.current[:appinstance].new_session_message})
|
60
54
|
if Thread.current[:appinstance].logitems.present? && Thread.current[:appinstance].logitems.class == Hash
|
data/lib/zuora_connect.rb
CHANGED
@@ -9,81 +9,13 @@ require 'resque/dynamic_queues'
|
|
9
9
|
require 'resque/silence_done'
|
10
10
|
require 'resque/self_lookup'
|
11
11
|
require 'resque/plugins/custom_logger'
|
12
|
-
require 'logging/connect_formatter'
|
13
12
|
require 'metrics/influx/point_value'
|
14
13
|
require 'metrics/net'
|
15
14
|
|
16
15
|
module ZuoraConnect
|
17
16
|
class << self
|
18
17
|
attr_accessor :configuration
|
19
|
-
attr_writer :logger
|
20
|
-
|
21
|
-
def logger
|
22
|
-
case Rails.env.to_s
|
23
|
-
when 'development'
|
24
|
-
Rails.logger
|
25
|
-
else
|
26
|
-
@logger ||= custom_logger(name: "Connect", level: Rails.logger.level)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def custom_logger(name: "", level: Rails.logger.present? ? Rails.logger.level : MonoLogger::INFO, type: :ougai)
|
31
|
-
#puts name + ' - ' + {Logger::WARN => 'Logger::WARN', Logger::ERROR => 'Logger::ERROR', Logger::DEBUG => 'Logger::DEBUG', Logger::INFO => 'Logger::INFO' }[level] + ' - '
|
32
|
-
if type == :ougai
|
33
|
-
require 'ougai'
|
34
|
-
#logger = Ougai::Logger.new(MonoLogger.new(STDOUT))
|
35
|
-
logger = Ougai::Logger.new(STDOUT)
|
36
|
-
logger.formatter = Ougai::Formatters::ConnectFormatter.new(name)
|
37
|
-
logger.level = level
|
38
|
-
logger.before_log = lambda do |data|
|
39
|
-
data[:trace_id] = ZuoraConnect::RequestIdMiddleware.request_id if ZuoraConnect::RequestIdMiddleware.request_id.present?
|
40
|
-
data[:zuora_trace_id] = ZuoraConnect::RequestIdMiddleware.zuora_request_id if ZuoraConnect::RequestIdMiddleware.zuora_request_id.present?
|
41
|
-
#data[:traces] = {amazon_id: data[:trace_id], zuora_id: data[:zuora_trace_id]}
|
42
|
-
if !['ElasticAPM', 'ResqueScheduler', 'ResquePool', 'Resque', 'Makara'].include?(name)
|
43
|
-
if Thread.current[:appinstance].present?
|
44
|
-
data[:app_instance_id] = Thread.current[:appinstance].id
|
45
|
-
logitems = Thread.current[:appinstance].logitems
|
46
|
-
if logitems.present? && logitems.class == Hash
|
47
|
-
data[:tenant_ids] = logitems[:tenant_ids] if logitems[:tenant_ids].present?
|
48
|
-
data[:organization] = logitems[:organization] if logitems[:organization].present?
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
else
|
54
|
-
logger = MonoLogger.new(STDOUT)
|
55
|
-
logger.level = level
|
56
|
-
logger.formatter = proc do |serverity, datetime, progname, msg|
|
57
|
-
begin
|
58
|
-
msg = JSON.parse(msg)
|
59
|
-
rescue JSON::ParserError => ex
|
60
|
-
end
|
61
|
-
|
62
|
-
require 'json'
|
63
|
-
store = {
|
64
|
-
name: name,
|
65
|
-
level: serverity,
|
66
|
-
timestamp: datetime.strftime('%FT%T.%6NZ'),
|
67
|
-
pid: Process.pid,
|
68
|
-
message: name == "ActionMailer" ? msg.strip : msg
|
69
|
-
}
|
70
|
-
if !['ElasticAPM', 'ResqueScheduler', 'ResquePool','Resque', 'Makara'].include?(name)
|
71
|
-
if Thread.current[:appinstance].present?
|
72
|
-
store[:app_instance_id] = Thread.current[:appinstance].id
|
73
|
-
logitems = Thread.current[:appinstance].logitems
|
74
|
-
if logitems.present? && logitems.class == Hash
|
75
|
-
store[:tenant_ids] = logitems[:tenant_ids] if logitems[:tenant_ids].present?
|
76
|
-
store[:organization] = logitems[:organization] if logitems[:organization].present?
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
JSON.dump(store) + "\n"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
return logger
|
84
|
-
end
|
85
18
|
end
|
86
|
-
|
87
19
|
module Controllers
|
88
20
|
autoload :Helpers, 'zuora_connect/controllers/helpers'
|
89
21
|
end
|
@@ -107,45 +39,4 @@ module ZuoraConnect
|
|
107
39
|
|
108
40
|
return configuration
|
109
41
|
end
|
110
|
-
|
111
|
-
def self.elastic_apm_defaults
|
112
|
-
defaults = {}
|
113
|
-
case Rails.env.to_s
|
114
|
-
when 'production'
|
115
|
-
defaults = {
|
116
|
-
server_url: "http://apm-server.logging:8200",
|
117
|
-
transaction_sample_rate: 0.20,
|
118
|
-
capture_body: 'errors'
|
119
|
-
}
|
120
|
-
when 'staging'
|
121
|
-
defaults = {
|
122
|
-
server_url: "http://apm-server.logging:8200",
|
123
|
-
transaction_sample_rate: 1.0
|
124
|
-
}
|
125
|
-
when 'development'
|
126
|
-
defaults = {
|
127
|
-
server_url: "http://logging.0.ecc.auw2.zuora:8200",
|
128
|
-
transaction_sample_rate: 1.0
|
129
|
-
}
|
130
|
-
when 'test'
|
131
|
-
defaults = {
|
132
|
-
active: false,
|
133
|
-
disable_send: true
|
134
|
-
}
|
135
|
-
end
|
136
|
-
|
137
|
-
defaults.merge!({
|
138
|
-
disable_start_message: true,
|
139
|
-
pool_size: 1,
|
140
|
-
transaction_max_spans: 500,
|
141
|
-
ignore_url_patterns: ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'],
|
142
|
-
verify_server_cert: false,
|
143
|
-
log_level: Logger::INFO,
|
144
|
-
service_name: ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] : Rails.application.class.parent_name,
|
145
|
-
logger: ZuoraConnect.custom_logger(name: "ElasticAPM", level: MonoLogger::WARN)
|
146
|
-
})
|
147
|
-
defaults.merge!({disable_send: true}) if defined?(Rails::Console)
|
148
|
-
|
149
|
-
return defaults
|
150
|
-
end
|
151
42
|
end
|