Class: InfluxReporter::Configuration
- Inherits:
-
Object
- Object
- InfluxReporter::Configuration
- Defined in:
- lib/influx_reporter/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ influx_db: {}, database: 'endpoints', logger: Logger.new(nil), context_lines: 3, enabled_environments: %w[production], excluded_exceptions: [], filter_parameters: [/(authorization|password|passwd|secret)/i], timeout: 100, open_timeout: 100, backoff_multiplier: 2, current_user_method: :current_user, environment: ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'default', transaction_post_interval: 60, worker_quit_timeout: 5, payload_tags: [], payload_values: [], disable_performance: false, disable_errors: false, debug_traces: false, view_paths: [], tags: {}, # for tests disable_worker: false }.freeze
Instance Attribute Summary collapse
-
#backoff_multiplier ⇒ Object
Returns the value of attribute backoff_multiplier.
-
#context_lines ⇒ Object
Returns the value of attribute context_lines.
-
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
-
#database ⇒ Object
Returns the value of attribute database.
-
#debug_traces ⇒ Object
Returns the value of attribute debug_traces.
-
#disable_errors ⇒ Object
Returns the value of attribute disable_errors.
-
#disable_performance ⇒ Object
Returns the value of attribute disable_performance.
-
#disable_worker ⇒ Object
Returns the value of attribute disable_worker.
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#excluded_exceptions ⇒ Object
Returns the value of attribute excluded_exceptions.
-
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters.
-
#influx_db ⇒ Object
Returns the value of attribute influx_db.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#payload_tags ⇒ Object
Returns the value of attribute payload_tags.
-
#payload_values ⇒ Object
Returns the value of attribute payload_values.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#transaction_post_interval ⇒ Object
Returns the value of attribute transaction_post_interval.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#view_paths ⇒ Object
Returns the value of attribute view_paths.
-
#worker_quit_timeout ⇒ Object
Returns the value of attribute worker_quit_timeout.
Instance Method Summary collapse
-
#initialize(opts = {}) {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize(opts = {}) {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
69 70 71 72 73 74 75 |
# File 'lib/influx_reporter/configuration.rb', line 69 def initialize(opts = {}) DEFAULTS.merge(opts).each do |k, v| send("#{k}=", v) end yield self if block_given? end |
Instance Attribute Details
#backoff_multiplier ⇒ Object
Returns the value of attribute backoff_multiplier.
48 49 50 |
# File 'lib/influx_reporter/configuration.rb', line 48 def backoff_multiplier @backoff_multiplier end |
#context_lines ⇒ Object
Returns the value of attribute context_lines.
42 43 44 |
# File 'lib/influx_reporter/configuration.rb', line 42 def context_lines @context_lines end |
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
50 51 52 |
# File 'lib/influx_reporter/configuration.rb', line 50 def current_user_method @current_user_method end |
#database ⇒ Object
Returns the value of attribute database.
40 41 42 |
# File 'lib/influx_reporter/configuration.rb', line 40 def database @database end |
#debug_traces ⇒ Object
Returns the value of attribute debug_traces.
61 62 63 |
# File 'lib/influx_reporter/configuration.rb', line 61 def debug_traces @debug_traces end |
#disable_errors ⇒ Object
Returns the value of attribute disable_errors.
59 60 61 |
# File 'lib/influx_reporter/configuration.rb', line 59 def disable_errors @disable_errors end |
#disable_performance ⇒ Object
Returns the value of attribute disable_performance.
58 59 60 |
# File 'lib/influx_reporter/configuration.rb', line 58 def disable_performance @disable_performance end |
#disable_worker ⇒ Object
Returns the value of attribute disable_worker.
63 64 65 |
# File 'lib/influx_reporter/configuration.rb', line 63 def disable_worker @disable_worker end |
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
43 44 45 |
# File 'lib/influx_reporter/configuration.rb', line 43 def enabled_environments @enabled_environments end |
#environment ⇒ Object
Returns the value of attribute environment.
51 52 53 |
# File 'lib/influx_reporter/configuration.rb', line 51 def environment @environment end |
#excluded_exceptions ⇒ Object
Returns the value of attribute excluded_exceptions.
44 45 46 |
# File 'lib/influx_reporter/configuration.rb', line 44 def excluded_exceptions @excluded_exceptions end |
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters.
45 46 47 |
# File 'lib/influx_reporter/configuration.rb', line 45 def filter_parameters @filter_parameters end |
#influx_db ⇒ Object
Returns the value of attribute influx_db.
39 40 41 |
# File 'lib/influx_reporter/configuration.rb', line 39 def influx_db @influx_db end |
#logger ⇒ Object
Returns the value of attribute logger.
41 42 43 |
# File 'lib/influx_reporter/configuration.rb', line 41 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
47 48 49 |
# File 'lib/influx_reporter/configuration.rb', line 47 def open_timeout @open_timeout end |
#payload_tags ⇒ Object
Returns the value of attribute payload_tags.
55 56 57 |
# File 'lib/influx_reporter/configuration.rb', line 55 def @payload_tags end |
#payload_values ⇒ Object
Returns the value of attribute payload_values.
56 57 58 |
# File 'lib/influx_reporter/configuration.rb', line 56 def payload_values @payload_values end |
#tags ⇒ Object
Returns the value of attribute tags.
67 68 69 |
# File 'lib/influx_reporter/configuration.rb', line 67 def @tags end |
#timeout ⇒ Object
Returns the value of attribute timeout.
46 47 48 |
# File 'lib/influx_reporter/configuration.rb', line 46 def timeout @timeout end |
#transaction_post_interval ⇒ Object
Returns the value of attribute transaction_post_interval.
52 53 54 |
# File 'lib/influx_reporter/configuration.rb', line 52 def transaction_post_interval @transaction_post_interval end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
49 50 51 |
# File 'lib/influx_reporter/configuration.rb', line 49 def use_ssl @use_ssl end |
#view_paths ⇒ Object
Returns the value of attribute view_paths.
65 66 67 |
# File 'lib/influx_reporter/configuration.rb', line 65 def view_paths @view_paths end |
#worker_quit_timeout ⇒ Object
Returns the value of attribute worker_quit_timeout.
53 54 55 |
# File 'lib/influx_reporter/configuration.rb', line 53 def worker_quit_timeout @worker_quit_timeout end |
Instance Method Details
#validate! ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/influx_reporter/configuration.rb', line 77 def validate! %w[database influx_db tags].each do |key| raise Error, "InfluxReporter Configuration missing `#{key}'" unless send(key) end true rescue Error => e logger.error e. false end |