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, :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.
-
#reraise_global_exceptions ⇒ Object
Returns the value of attribute reraise_global_exceptions.
-
#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.
-
#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
- #reraise_global_exceptions? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/influxdb/rails/configuration.rb', line 82 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] @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 @ignored_exception_messages = 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.
32 33 34 |
# File 'lib/influxdb/rails/configuration.rb', line 32 def aggregated_exception_classes @aggregated_exception_classes end |
#application_id ⇒ Object
Returns the value of attribute application_id.
16 17 18 |
# File 'lib/influxdb/rails/configuration.rb', line 16 def application_id @application_id end |
#application_name ⇒ Object
Returns the value of attribute application_name.
17 18 19 |
# File 'lib/influxdb/rails/configuration.rb', line 17 def application_name @application_name end |
#application_root ⇒ Object
Returns the value of attribute application_root.
18 19 20 |
# File 'lib/influxdb/rails/configuration.rb', line 18 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.
31 32 33 |
# File 'lib/influxdb/rails/configuration.rb', line 31 def backtrace_filters @backtrace_filters end |
#debug ⇒ Object
Returns the value of attribute debug.
37 38 39 |
# File 'lib/influxdb/rails/configuration.rb', line 37 def debug @debug end |
#environment ⇒ Object
Returns the value of attribute environment.
21 22 23 |
# File 'lib/influxdb/rails/configuration.rb', line 21 def environment @environment end |
#environment_variable_filters ⇒ Object
Returns the value of attribute environment_variable_filters.
34 35 36 |
# File 'lib/influxdb/rails/configuration.rb', line 34 def environment_variable_filters @environment_variable_filters end |
#environment_variables ⇒ Object
Returns the value of attribute environment_variables.
33 34 35 |
# File 'lib/influxdb/rails/configuration.rb', line 33 def environment_variables @environment_variables end |
#framework ⇒ Object
Returns the value of attribute framework.
22 23 24 |
# File 'lib/influxdb/rails/configuration.rb', line 22 def framework @framework end |
#framework_version ⇒ Object
Returns the value of attribute framework_version.
23 24 25 |
# File 'lib/influxdb/rails/configuration.rb', line 23 def framework_version @framework_version end |
#ignored_environments ⇒ Object
Returns the value of attribute ignored_environments.
29 30 31 |
# File 'lib/influxdb/rails/configuration.rb', line 29 def ignored_environments @ignored_environments end |
#ignored_exception_messages ⇒ Object
Returns the value of attribute ignored_exception_messages.
27 28 29 |
# File 'lib/influxdb/rails/configuration.rb', line 27 def @ignored_exception_messages end |
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
26 27 28 |
# File 'lib/influxdb/rails/configuration.rb', line 26 def ignored_exceptions @ignored_exceptions end |
#ignored_reports ⇒ Object
Returns the value of attribute ignored_reports.
28 29 30 |
# File 'lib/influxdb/rails/configuration.rb', line 28 def ignored_reports @ignored_reports end |
#ignored_user_agents ⇒ Object
Returns the value of attribute ignored_user_agents.
30 31 32 |
# File 'lib/influxdb/rails/configuration.rb', line 30 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.
36 37 38 |
# File 'lib/influxdb/rails/configuration.rb', line 36 def instrumentation_enabled @instrumentation_enabled end |
#language ⇒ Object
Returns the value of attribute language.
24 25 26 |
# File 'lib/influxdb/rails/configuration.rb', line 24 def language @language end |
#language_version ⇒ Object
Returns the value of attribute language_version.
25 26 27 |
# File 'lib/influxdb/rails/configuration.rb', line 25 def language_version @language_version end |
#logger ⇒ Object
Returns the value of attribute logger.
20 21 22 |
# File 'lib/influxdb/rails/configuration.rb', line 20 def logger @logger end |
#reraise_global_exceptions ⇒ Object
Returns the value of attribute reraise_global_exceptions.
38 39 40 |
# File 'lib/influxdb/rails/configuration.rb', line 38 def reraise_global_exceptions @reraise_global_exceptions end |
#series_name_for_controller_runtimes ⇒ Object
Returns the value of attribute series_name_for_controller_runtimes.
12 13 14 |
# File 'lib/influxdb/rails/configuration.rb', line 12 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.
14 15 16 |
# File 'lib/influxdb/rails/configuration.rb', line 14 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.
13 14 15 |
# File 'lib/influxdb/rails/configuration.rb', line 13 def series_name_for_view_runtimes @series_name_for_view_runtimes 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
133 134 135 |
# File 'lib/influxdb/rails/configuration.rb', line 133 def add_custom_exception_data(exception_presenter) @custom_exception_data_handler.call(exception_presenter) if @custom_exception_data_handler end |
#database_name ⇒ Object
137 138 139 |
# File 'lib/influxdb/rails/configuration.rb', line 137 def database_name @application_id.to_s + @environment.to_s end |
#debug? ⇒ Boolean
108 109 110 |
# File 'lib/influxdb/rails/configuration.rb', line 108 def debug? !!@debug end |
#define_custom_exception_data(&block) ⇒ Object
129 130 131 |
# File 'lib/influxdb/rails/configuration.rb', line 129 def define_custom_exception_data(&block) @custom_exception_data_handler = block end |
#ignore_current_environment? ⇒ Boolean
125 126 127 |
# File 'lib/influxdb/rails/configuration.rb', line 125 def ignore_current_environment? self.ignored_environments.include?(self.environment) end |
#ignore_user_agent?(incoming_user_agent) ⇒ Boolean
120 121 122 123 |
# File 'lib/influxdb/rails/configuration.rb', line 120 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
112 113 114 |
# File 'lib/influxdb/rails/configuration.rb', line 112 def instrumentation_enabled? !!@instrumentation_enabled end |
#reraise_global_exceptions? ⇒ Boolean
116 117 118 |
# File 'lib/influxdb/rails/configuration.rb', line 116 def reraise_global_exceptions? !!@reraise_global_exceptions end |