ZuoraConnect.configuration.enable_apm = ENV["ENABLE_APM"] == 'true' if ENV.has_key?("ENABLE_APM") ElasticAPM::Agent.stop if !ZuoraConnect.configuration.enable_apm if defined?(ElasticAPM) && !ElasticAPM::Agent.instance.nil? if !defined?(Rails::Console) ElasticAPM.agent.config.disable_send = false else ElasticAPM.agent.config.disable_send = true end case Rails.env.to_s when 'production' ElasticAPM.agent.config.server_url = "http://apm-server.logging:8200" ElasticAPM.agent.config.transaction_sample_rate = 0.20 ElasticAPM.agent.config.capture_body = false when 'staging' ElasticAPM.agent.config.server_url = "http://apm-server.logging:8200" ElasticAPM.agent.config.transaction_sample_rate = 1.0 when 'development' ElasticAPM.agent.config.server_url = "http://logging.0.ecc.auw2.zuora:8200" ElasticAPM.agent.config.transaction_sample_rate = 1.0 end ElasticAPM.agent.config.pool_size = 1 ElasticAPM.agent.config.transaction_max_spans = 500 ElasticAPM.agent.config.ignore_url_patterns = ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'] ElasticAPM.agent.config.verify_server_cert = false ElasticAPM.agent.config.log_level = Logger::INFO ElasticAPM.agent.config.service_name = ::ZuoraConnect::Telegraf.app_name end