Class: InfluxDB::Rails::Configuration
- Inherits:
-
Object
- Object
- InfluxDB::Rails::Configuration
- Defined in:
- lib/influxdb/rails/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ :influxdb_hosts => ["localhost"], :influxdb_port => 8086, :influxdb_username => "root", :influxdb_password => "root", :influxdb_database => nil, :async => true, :use_ssl => false, :retry => nil, :open_timeout => 5, :read_timeout => 300, :max_delay => 30, :time_precision => "s", :series_name_for_controller_runtimes => "rails.controller", :series_name_for_view_runtimes => "rails.view", :series_name_for_db_runtimes => "rails.db", :ignored_exceptions => %w{ActiveRecord::RecordNotFound ActionController::RoutingError}, :ignored_exception_messages => [], :ignored_reports => [], :ignored_environments => %w{test cucumber selenium}, :ignored_user_agents => %w{GoogleBot}, :environment_variable_filters => [ /password/i, /key/i, /secret/i, /ps1/i, /rvm_.*_clr/i, /color/i ], :backtrace_filters => [ lambda { |line| line.gsub(/^\.\//, "") }, lambda { |line| return line if InfluxDB::Rails.configuration.application_root.to_s.empty? line.gsub(/#{InfluxDB::Rails.configuration.application_root}/, "[APP_ROOT]") }, lambda { |line| if defined?(Gem) && !Gem.path.nil? && !Gem.path.empty? Gem.path.each { |path| line = line.gsub(/#{path}/, "[GEM_ROOT]") } end line } ] }
Instance Attribute Summary collapse
-
#aggregated_exception_classes ⇒ Object
Returns the value of attribute aggregated_exception_classes.
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#application_root ⇒ Object
Returns the value of attribute application_root.
-
#async ⇒ Object
Returns the value of attribute async.
-
#backtrace_filters ⇒ Object
Returns the value of attribute backtrace_filters.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#environment_variable_filters ⇒ Object
Returns the value of attribute environment_variable_filters.
-
#environment_variables ⇒ Object
Returns the value of attribute environment_variables.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#framework_version ⇒ Object
Returns the value of attribute framework_version.
-
#ignored_environments ⇒ Object
Returns the value of attribute ignored_environments.
-
#ignored_exception_messages ⇒ Object
Returns the value of attribute ignored_exception_messages.
-
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
-
#ignored_reports ⇒ Object
Returns the value of attribute ignored_reports.
-
#ignored_user_agents ⇒ Object
Returns the value of attribute ignored_user_agents.
-
#influxdb_database ⇒ Object
Returns the value of attribute influxdb_database.
-
#influxdb_hosts ⇒ Object
Returns the value of attribute influxdb_hosts.
-
#influxdb_password ⇒ Object
Returns the value of attribute influxdb_password.
-
#influxdb_port ⇒ Object
Returns the value of attribute influxdb_port.
-
#influxdb_username ⇒ Object
Returns the value of attribute influxdb_username.
-
#instrumentation_enabled ⇒ Object
Returns the value of attribute instrumentation_enabled.
-
#language ⇒ Object
Returns the value of attribute language.
-
#language_version ⇒ Object
Returns the value of attribute language_version.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_delay ⇒ Object
Returns the value of attribute max_delay.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#reraise_global_exceptions ⇒ Object
Returns the value of attribute reraise_global_exceptions.
-
#retry ⇒ Object
Returns the value of attribute retry.
-
#series_name_for_controller_runtimes ⇒ Object
Returns the value of attribute series_name_for_controller_runtimes.
-
#series_name_for_db_runtimes ⇒ Object
Returns the value of attribute series_name_for_db_runtimes.
-
#series_name_for_view_runtimes ⇒ Object
Returns the value of attribute series_name_for_view_runtimes.
-
#time_precision ⇒ Object
Returns the value of attribute time_precision.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
Instance Method Summary collapse
- #add_custom_exception_data(exception_presenter) ⇒ Object
- #database_name ⇒ Object
- #debug? ⇒ Boolean
- #define_custom_exception_data(&block) ⇒ Object
- #ignore_current_environment? ⇒ Boolean
- #ignore_user_agent?(incoming_user_agent) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #instrumentation_enabled? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/influxdb/rails/configuration.rb', line 97 def initialize @influxdb_hosts = DEFAULTS[:influxdb_hosts] @influxdb_port = DEFAULTS[:influxdb_port] @influxdb_username = DEFAULTS[:influxdb_username] @influxdb_password = DEFAULTS[:influxdb_password] @influxdb_database = DEFAULTS[:influxdb_database] @async = DEFAULTS[:async] @use_ssl = DEFAULTS[:use_ssl] @retry = DEFAULTS[:retry] @open_timeout = DEFAULTS[:open_timeout] @read_timeout = DEFAULTS[:read_timeout] @max_delay = DEFAULTS[:max_delay] @time_precision = DEFAULTS[:time_precision] @series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes] @series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes] @series_name_for_db_runtimes = DEFAULTS[:series_name_for_db_runtimes] @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup = DEFAULTS[:ignored_exception_messages].dup @ignored_reports = DEFAULTS[:ignored_reports].dup @ignored_environments = DEFAULTS[:ignored_environments].dup @ignored_user_agents = DEFAULTS[:ignored_user_agents].dup @backtrace_filters = DEFAULTS[:backtrace_filters].dup @environment_variable_filters = DEFAULTS[:environment_variable_filters] @aggregated_exception_classes = [] @debug = false @rescue_global_exceptions = false @instrumentation_enabled = true end |
Instance Attribute Details
#aggregated_exception_classes ⇒ Object
Returns the value of attribute aggregated_exception_classes.
39 40 41 |
# File 'lib/influxdb/rails/configuration.rb', line 39 def aggregated_exception_classes @aggregated_exception_classes end |
#application_id ⇒ Object
Returns the value of attribute application_id.
21 22 23 |
# File 'lib/influxdb/rails/configuration.rb', line 21 def application_id @application_id end |
#application_name ⇒ Object
Returns the value of attribute application_name.
24 25 26 |
# File 'lib/influxdb/rails/configuration.rb', line 24 def application_name @application_name end |
#application_root ⇒ Object
Returns the value of attribute application_root.
25 26 27 |
# File 'lib/influxdb/rails/configuration.rb', line 25 def application_root @application_root end |
#async ⇒ Object
Returns the value of attribute async.
9 10 11 |
# File 'lib/influxdb/rails/configuration.rb', line 9 def async @async end |
#backtrace_filters ⇒ Object
Returns the value of attribute backtrace_filters.
38 39 40 |
# File 'lib/influxdb/rails/configuration.rb', line 38 def backtrace_filters @backtrace_filters end |
#debug ⇒ Object
Returns the value of attribute debug.
44 45 46 |
# File 'lib/influxdb/rails/configuration.rb', line 44 def debug @debug end |
#environment ⇒ Object
Returns the value of attribute environment.
28 29 30 |
# File 'lib/influxdb/rails/configuration.rb', line 28 def environment @environment end |
#environment_variable_filters ⇒ Object
Returns the value of attribute environment_variable_filters.
41 42 43 |
# File 'lib/influxdb/rails/configuration.rb', line 41 def environment_variable_filters @environment_variable_filters end |
#environment_variables ⇒ Object
Returns the value of attribute environment_variables.
40 41 42 |
# File 'lib/influxdb/rails/configuration.rb', line 40 def environment_variables @environment_variables end |
#framework ⇒ Object
Returns the value of attribute framework.
29 30 31 |
# File 'lib/influxdb/rails/configuration.rb', line 29 def framework @framework end |
#framework_version ⇒ Object
Returns the value of attribute framework_version.
30 31 32 |
# File 'lib/influxdb/rails/configuration.rb', line 30 def framework_version @framework_version end |
#ignored_environments ⇒ Object
Returns the value of attribute ignored_environments.
36 37 38 |
# File 'lib/influxdb/rails/configuration.rb', line 36 def ignored_environments @ignored_environments end |
#ignored_exception_messages ⇒ Object
Returns the value of attribute ignored_exception_messages.
34 35 36 |
# File 'lib/influxdb/rails/configuration.rb', line 34 def end |
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
33 34 35 |
# File 'lib/influxdb/rails/configuration.rb', line 33 def ignored_exceptions @ignored_exceptions end |
#ignored_reports ⇒ Object
Returns the value of attribute ignored_reports.
35 36 37 |
# File 'lib/influxdb/rails/configuration.rb', line 35 def ignored_reports @ignored_reports end |
#ignored_user_agents ⇒ Object
Returns the value of attribute ignored_user_agents.
37 38 39 |
# File 'lib/influxdb/rails/configuration.rb', line 37 def ignored_user_agents @ignored_user_agents end |
#influxdb_database ⇒ Object
Returns the value of attribute influxdb_database.
8 9 10 |
# File 'lib/influxdb/rails/configuration.rb', line 8 def influxdb_database @influxdb_database end |
#influxdb_hosts ⇒ Object
Returns the value of attribute influxdb_hosts.
4 5 6 |
# File 'lib/influxdb/rails/configuration.rb', line 4 def influxdb_hosts @influxdb_hosts end |
#influxdb_password ⇒ Object
Returns the value of attribute influxdb_password.
7 8 9 |
# File 'lib/influxdb/rails/configuration.rb', line 7 def influxdb_password @influxdb_password end |
#influxdb_port ⇒ Object
Returns the value of attribute influxdb_port.
5 6 7 |
# File 'lib/influxdb/rails/configuration.rb', line 5 def influxdb_port @influxdb_port end |
#influxdb_username ⇒ Object
Returns the value of attribute influxdb_username.
6 7 8 |
# File 'lib/influxdb/rails/configuration.rb', line 6 def influxdb_username @influxdb_username end |
#instrumentation_enabled ⇒ Object
Returns the value of attribute instrumentation_enabled.
43 44 45 |
# File 'lib/influxdb/rails/configuration.rb', line 43 def instrumentation_enabled @instrumentation_enabled end |
#language ⇒ Object
Returns the value of attribute language.
31 32 33 |
# File 'lib/influxdb/rails/configuration.rb', line 31 def language @language end |
#language_version ⇒ Object
Returns the value of attribute language_version.
32 33 34 |
# File 'lib/influxdb/rails/configuration.rb', line 32 def language_version @language_version end |
#logger ⇒ Object
Returns the value of attribute logger.
27 28 29 |
# File 'lib/influxdb/rails/configuration.rb', line 27 def logger @logger end |
#max_delay ⇒ Object
Returns the value of attribute max_delay.
14 15 16 |
# File 'lib/influxdb/rails/configuration.rb', line 14 def max_delay @max_delay end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
12 13 14 |
# File 'lib/influxdb/rails/configuration.rb', line 12 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
13 14 15 |
# File 'lib/influxdb/rails/configuration.rb', line 13 def read_timeout @read_timeout end |
#reraise_global_exceptions ⇒ Object
Returns the value of attribute reraise_global_exceptions.
46 47 48 |
# File 'lib/influxdb/rails/configuration.rb', line 46 def reraise_global_exceptions @reraise_global_exceptions end |
#retry ⇒ Object
Returns the value of attribute retry.
11 12 13 |
# File 'lib/influxdb/rails/configuration.rb', line 11 def retry @retry end |
#series_name_for_controller_runtimes ⇒ Object
Returns the value of attribute series_name_for_controller_runtimes.
17 18 19 |
# File 'lib/influxdb/rails/configuration.rb', line 17 def series_name_for_controller_runtimes @series_name_for_controller_runtimes end |
#series_name_for_db_runtimes ⇒ Object
Returns the value of attribute series_name_for_db_runtimes.
19 20 21 |
# File 'lib/influxdb/rails/configuration.rb', line 19 def series_name_for_db_runtimes @series_name_for_db_runtimes end |
#series_name_for_view_runtimes ⇒ Object
Returns the value of attribute series_name_for_view_runtimes.
18 19 20 |
# File 'lib/influxdb/rails/configuration.rb', line 18 def series_name_for_view_runtimes @series_name_for_view_runtimes end |
#time_precision ⇒ Object
Returns the value of attribute time_precision.
15 16 17 |
# File 'lib/influxdb/rails/configuration.rb', line 15 def time_precision @time_precision end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
10 11 12 |
# File 'lib/influxdb/rails/configuration.rb', line 10 def use_ssl @use_ssl end |
Instance Method Details
#add_custom_exception_data(exception_presenter) ⇒ Object
150 151 152 |
# File 'lib/influxdb/rails/configuration.rb', line 150 def add_custom_exception_data(exception_presenter) @custom_exception_data_handler.call(exception_presenter) if @custom_exception_data_handler end |
#database_name ⇒ Object
154 155 156 |
# File 'lib/influxdb/rails/configuration.rb', line 154 def database_name @application_id.to_s + @environment.to_s end |
#debug? ⇒ Boolean
129 130 131 |
# File 'lib/influxdb/rails/configuration.rb', line 129 def debug? !!@debug end |
#define_custom_exception_data(&block) ⇒ Object
146 147 148 |
# File 'lib/influxdb/rails/configuration.rb', line 146 def define_custom_exception_data(&block) @custom_exception_data_handler = block end |
#ignore_current_environment? ⇒ Boolean
142 143 144 |
# File 'lib/influxdb/rails/configuration.rb', line 142 def ignore_current_environment? self.ignored_environments.include?(self.environment) end |
#ignore_user_agent?(incoming_user_agent) ⇒ Boolean
137 138 139 140 |
# File 'lib/influxdb/rails/configuration.rb', line 137 def ignore_user_agent?(incoming_user_agent) return false if self.ignored_user_agents.nil? self.ignored_user_agents.any? {|agent| incoming_user_agent =~ /#{agent}/} end |
#instrumentation_enabled? ⇒ Boolean
133 134 135 |
# File 'lib/influxdb/rails/configuration.rb', line 133 def instrumentation_enabled? !!@instrumentation_enabled end |