require 'zuora_connect/configuration' require "zuora_connect/engine" require 'zuora_connect/exceptions' require 'zuora_connect/controllers/helpers' require 'zuora_connect/railtie' require 'resque/additions' require 'resque/dynamic_queues' require 'resque/silence_done' require 'resque/self_lookup' require 'resque/plugins/custom_logger' require 'resque/plugins/app_instance_job' require 'metrics/net' require 'mono_logger' require 'zuora_connect/zuora_audit' require 'active_record' require 'zuora_observability' ::ActiveRecord::Base.send :include, ZuoraConnect::ZuoraAudit module ZuoraConnect class << self attr_accessor :configuration attr_writer :logger def logger case Rails.env.to_s when 'development' Rails.logger when 'test' Rails.logger else @logger ||= ZuoraObservability::Logger.custom_logger(name: "Connect", level: Rails.logger.level) end end end module Controllers autoload :Helpers, 'zuora_connect/controllers/helpers' end def self.configuration @configuration ||= Configuration.new end def self.reset @configuration = Configuration.new end def self.configure yield(configuration) ::Apartment.excluded_models << "Delayed::Job" if configuration.delayed_job ::Apartment.excluded_models.concat(configuration.additional_apartment_models) if configuration.additional_apartment_models.class == Array return configuration end def self.elastic_apm_defaults defaults = {} case Rails.env.to_s when 'production' defaults = { server_url: "http://apm-server.logging:8200", transaction_sample_rate: 0.20, capture_body: 'errors' } when 'staging' defaults = { server_url: "http://apm-server.logging:8200", transaction_sample_rate: 1.0 } when 'development' defaults = { server_url: "http://logging.0.ecc.auw2.zuora:8200", transaction_sample_rate: 1.0 } when 'test' defaults = { active: false, disable_send: true } end defaults.merge!({ disable_start_message: true, pool_size: 1, transaction_max_spans: 500, ignore_url_patterns: ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'], verify_server_cert: false, log_level: Logger::INFO, service_name: ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] : Rails.application.class.parent_name, logger: ZuoraObservability::Logger.custom_logger(name: "ElasticAPM", level: MonoLogger::WARN) }) defaults.merge!({disable_send: true}) if defined?(Rails::Console) return defaults end end