experimental-influxdb-rails 1.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +78 -0
  5. data/.travis.yml +37 -0
  6. data/CHANGELOG.md +133 -0
  7. data/Gemfile +9 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +292 -0
  10. data/Rakefile +34 -0
  11. data/config.ru +7 -0
  12. data/experimental-influxdb-rails.gemspec +35 -0
  13. data/gemfiles/Gemfile.rails-4.2.x +7 -0
  14. data/gemfiles/Gemfile.rails-5.0.x +7 -0
  15. data/gemfiles/Gemfile.rails-5.1.x +7 -0
  16. data/gemfiles/Gemfile.rails-5.2.x +7 -0
  17. data/lib/experimental-influxdb-rails.rb +123 -0
  18. data/lib/influxdb/rails/air_traffic_controller.rb +41 -0
  19. data/lib/influxdb/rails/backtrace.rb +44 -0
  20. data/lib/influxdb/rails/configuration.rb +211 -0
  21. data/lib/influxdb/rails/context.rb +51 -0
  22. data/lib/influxdb/rails/exception_presenter.rb +94 -0
  23. data/lib/influxdb/rails/instrumentation.rb +34 -0
  24. data/lib/influxdb/rails/logger.rb +16 -0
  25. data/lib/influxdb/rails/middleware/hijack_render_exception.rb +16 -0
  26. data/lib/influxdb/rails/middleware/hijack_rescue_action_everywhere.rb +31 -0
  27. data/lib/influxdb/rails/middleware/render_subscriber.rb +26 -0
  28. data/lib/influxdb/rails/middleware/request_subscriber.rb +59 -0
  29. data/lib/influxdb/rails/middleware/simple_subscriber.rb +49 -0
  30. data/lib/influxdb/rails/middleware/sql_subscriber.rb +38 -0
  31. data/lib/influxdb/rails/middleware/subscriber.rb +48 -0
  32. data/lib/influxdb/rails/rack.rb +24 -0
  33. data/lib/influxdb/rails/railtie.rb +51 -0
  34. data/lib/influxdb/rails/sql/normalizer.rb +27 -0
  35. data/lib/influxdb/rails/sql/query.rb +32 -0
  36. data/lib/influxdb/rails/version.rb +5 -0
  37. data/lib/rails/generators/influxdb/influxdb_generator.rb +15 -0
  38. data/lib/rails/generators/influxdb/templates/initializer.rb +11 -0
  39. data/spec/controllers/widgets_controller_spec.rb +15 -0
  40. data/spec/integration/exceptions_spec.rb +37 -0
  41. data/spec/integration/integration_helper.rb +1 -0
  42. data/spec/integration/metrics_spec.rb +28 -0
  43. data/spec/shared_examples/data.rb +67 -0
  44. data/spec/shared_examples/tags.rb +45 -0
  45. data/spec/spec_helper.rb +31 -0
  46. data/spec/support/rails4/app.rb +44 -0
  47. data/spec/support/rails5/app.rb +44 -0
  48. data/spec/support/views/widgets/_item.html.erb +1 -0
  49. data/spec/support/views/widgets/index.html.erb +5 -0
  50. data/spec/unit/backtrace_spec.rb +85 -0
  51. data/spec/unit/configuration_spec.rb +125 -0
  52. data/spec/unit/context_spec.rb +40 -0
  53. data/spec/unit/exception_presenter_spec.rb +23 -0
  54. data/spec/unit/influxdb_rails_spec.rb +78 -0
  55. data/spec/unit/middleware/render_subscriber_spec.rb +92 -0
  56. data/spec/unit/middleware/request_subscriber_spec.rb +94 -0
  57. data/spec/unit/middleware/sql_subscriber_spec.rb +95 -0
  58. data/spec/unit/sql/normalizer_spec.rb +15 -0
  59. data/spec/unit/sql/query_spec.rb +29 -0
  60. metadata +300 -0
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require "bundler/gem_tasks"
2
+ require "rubocop/rake_task"
3
+ RuboCop::RakeTask.new
4
+
5
+ targeted_files = ARGV.drop(1)
6
+ file_pattern = targeted_files.empty? ? "spec/**/*_spec.rb" : targeted_files
7
+
8
+ require "rspec/core"
9
+ require "rspec/core/rake_task"
10
+
11
+ RSpec::Core::RakeTask.new(:spec) do |t|
12
+ t.pattern = FileList[file_pattern]
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.color = true
17
+ config.formatter = :documentation
18
+ end
19
+
20
+ task default: %i[spec rubocop]
21
+
22
+ task "test:all" => :default do
23
+ Dir.glob("gemfiles/Gemfile.rails-*.x") do |gemfile|
24
+ if RUBY_VERSION >= "2.6.0" && gemfile == "gemfiles/Gemfile.rails-4.2.x"
25
+ msg = "ignore #{gemfile} on Ruby #{RUBY_VERSION}"
26
+ puts RSpec::Core::Formatters::ConsoleCodes.wrap(msg, :yellow)
27
+ next
28
+ end
29
+
30
+ puts RSpec::Core::Formatters::ConsoleCodes.wrap(gemfile, :cyan)
31
+ sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle", "install", "--quiet", "--retry=2", "--jobs=2")
32
+ sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle", "exec", "rspec")
33
+ end
34
+ end
data/config.ru ADDED
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ Bundler.require :default, :development
5
+
6
+ Combustion.initialize!
7
+ run Combustion::Application
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "influxdb/rails/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "experimental-influxdb-rails"
7
+ spec.version = InfluxDB::Rails::VERSION
8
+ spec.authors = ["Dominik Menke", "Todd Persen"]
9
+ spec.email = ["dominik.menke@gmail.com", "todd@influxdb.com"]
10
+ spec.homepage = "https://influxdata.com"
11
+ spec.summary = "InfluxDB bindings for Ruby on Rails."
12
+ spec.description = "This gem automatically instruments your Ruby on Rails" \
13
+ " 4.2/5.x applications using InfluxDB for storage."
14
+ spec.licenses = ["MIT"]
15
+
16
+ spec.files = `git ls-files`.split($/) # rubocop:disable Style/SpecialGlobalVars
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = ">= 2.3.0"
21
+
22
+ spec.add_runtime_dependency "influxdb", "~> 0.6", ">= 0.6.4"
23
+ spec.add_runtime_dependency "railties", ">= 4.2"
24
+
25
+ spec.add_development_dependency "activerecord"
26
+ spec.add_development_dependency "bundler", ">= 1.0.0"
27
+ spec.add_development_dependency "fakeweb"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rdoc"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "rspec-rails", ">= 3.0.0"
32
+ spec.add_development_dependency "rubocop", "~> 0.61.1"
33
+ spec.add_development_dependency "sqlite3"
34
+ spec.add_development_dependency "tzinfo"
35
+ end
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'actionpack', '~> 4.2.0'
4
+ gem 'activesupport', '~> 4.2.0'
5
+ gem 'activemodel', '~> 4.2.0'
6
+
7
+ gemspec :path => '../'
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'actionpack', '~> 5.0.0'
4
+ gem 'activesupport', '~> 5.0.0'
5
+ gem 'activemodel', '~> 5.0.0'
6
+
7
+ gemspec :path => '../'
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'actionpack', '~> 5.1.0'
4
+ gem 'activesupport', '~> 5.1.0'
5
+ gem 'activemodel', '~> 5.1.0'
6
+
7
+ gemspec :path => '../'
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'actionpack', '~> 5.2.0'
4
+ gem 'activesupport', '~> 5.2.0'
5
+ gem 'activemodel', '~> 5.2.0'
6
+
7
+ gemspec :path => '../'
@@ -0,0 +1,123 @@
1
+ require "net/http"
2
+ require "net/https"
3
+ require "rubygems"
4
+ require "socket"
5
+ require "influxdb/rails/middleware/render_subscriber"
6
+ require "influxdb/rails/middleware/request_subscriber"
7
+ require "influxdb/rails/middleware/sql_subscriber"
8
+ require "influxdb/rails/sql/query"
9
+ require "influxdb/rails/version"
10
+ require "influxdb/rails/logger"
11
+ require "influxdb/rails/exception_presenter"
12
+ require "influxdb/rails/configuration"
13
+ require "influxdb/rails/backtrace"
14
+ require "influxdb/rails/context"
15
+ require "influxdb/rails/rack"
16
+
17
+ require "influxdb/rails/railtie" if defined?(Rails::Railtie)
18
+
19
+ module InfluxDB
20
+ # InfluxDB::Rails contains the glue code needed to integrate with
21
+ # InfluxDB and Rails. This is a singleton class.
22
+ module Rails
23
+ class << self
24
+ include InfluxDB::Rails::Logger
25
+
26
+ attr_writer :configuration
27
+ attr_writer :client
28
+
29
+ def configure(_silent = false)
30
+ yield(configuration)
31
+
32
+ # if we change configuration, reload the client
33
+ self.client = nil
34
+
35
+ InfluxDB::Logging.logger = configuration.logger unless configuration.logger.nil?
36
+ end
37
+
38
+ # rubocop:disable Metrics/MethodLength
39
+ # rubocop:disable Metrics/AbcSize
40
+
41
+ def client
42
+ @client ||= InfluxDB::Client.new \
43
+ database: configuration.influxdb_database,
44
+ username: configuration.influxdb_username,
45
+ password: configuration.influxdb_password,
46
+ hosts: configuration.influxdb_hosts,
47
+ port: configuration.influxdb_port,
48
+ async: configuration.async,
49
+ use_ssl: configuration.use_ssl,
50
+ retry: configuration.retry,
51
+ open_timeout: configuration.open_timeout,
52
+ read_timeout: configuration.read_timeout,
53
+ max_delay: configuration.max_delay,
54
+ time_precision: configuration.time_precision
55
+ end
56
+
57
+ # rubocop:enable Metrics/MethodLength
58
+ # rubocop:enable Metrics/AbcSize
59
+
60
+ def configuration
61
+ @configuration ||= InfluxDB::Rails::Configuration.new
62
+ end
63
+
64
+ def current
65
+ @current ||= InfluxDB::Rails::Context.new
66
+ end
67
+
68
+ def report_exception_unless_ignorable(ex, env = {})
69
+ report_exception(ex, env) unless ignorable_exception?(ex)
70
+ end
71
+ alias transmit_unless_ignorable report_exception_unless_ignorable
72
+
73
+ # rubocop:disable Metrics/MethodLength
74
+ # rubocop:disable Metrics/AbcSize
75
+
76
+ def report_exception(ex, env = {})
77
+ timestamp = InfluxDB::Rails.current_timestamp
78
+ env = influxdb_request_data if env.empty? && defined? influxdb_request_data
79
+ exception_presenter = ExceptionPresenter.new(ex, env)
80
+ log :info, "Exception: #{exception_presenter.to_json[0..512]}..."
81
+ tags = configuration.tags_middleware.call(
82
+ exception_presenter.context.merge(exception_presenter.dimensions)
83
+ )
84
+
85
+ client.write_point \
86
+ configuration.series_name_for_exceptions,
87
+ values: exception_presenter.values.merge(ts: timestamp),
88
+ tags: tags,
89
+ timestamp: timestamp
90
+ rescue StandardError => ex
91
+ log :info, "[InfluxDB::Rails] Something went terribly wrong." \
92
+ " Exception failed to take off! #{ex.class}: #{ex.message}"
93
+ end
94
+ alias transmit report_exception
95
+
96
+ # rubocop:enable Metrics/MethodLength
97
+ # rubocop:enable Metrics/AbcSize
98
+
99
+ def current_timestamp
100
+ InfluxDB.now(configuration.time_precision)
101
+ end
102
+
103
+ def ignorable_exception?(ex)
104
+ configuration.ignore_current_environment? || configuration.ignore_exception?(ex)
105
+ end
106
+
107
+ def rescue
108
+ yield
109
+ rescue StandardError => ex
110
+ raise ex if configuration.ignore_current_environment?
111
+
112
+ transmit_unless_ignorable(ex)
113
+ end
114
+
115
+ def rescue_and_reraise
116
+ yield
117
+ rescue StandardError => ex
118
+ transmit_unless_ignorable(ex)
119
+ raise ex
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,41 @@
1
+ module InfluxDB
2
+ module Rails
3
+ module AirTrafficController # :nodoc:
4
+ def influxdb_request_data # rubocop:disable Metrics/MethodLength
5
+ {
6
+ params: influxdb_filtered_params,
7
+ session_data: influxdb_session_data,
8
+ controller: params[:controller],
9
+ action: params[:action],
10
+ request_url: influxdb_request_url,
11
+ user_agent: request.env["HTTP_USER_AGENT"],
12
+ remote_ip: request.remote_ip,
13
+ referer: request.referer,
14
+ current_user: (current_user rescue nil),
15
+ }
16
+ end
17
+
18
+ private
19
+
20
+ def influxdb_session_data
21
+ session.respond_to?(:to_hash) ? session.to_hash : session.data
22
+ end
23
+
24
+ def influxdb_request_url
25
+ url = "#{request.protocol}#{request.host}"
26
+ url << ":#{request.port}" unless [80, 443].include?(request.port)
27
+ url << request.fullpath
28
+ end
29
+
30
+ def influxdb_filtered_params
31
+ if respond_to?(:filter_parameters)
32
+ filter_parameters(unfiltered_params)
33
+ elsif defined?(request.filtered_parameters)
34
+ request.filtered_parameters
35
+ else
36
+ params.to_hash.except(:password, :password_confirmation)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,44 @@
1
+ module InfluxDB
2
+ module Rails
3
+ class Backtrace # rubocop:disable Style/Documentation
4
+ class Line # rubocop:disable Style/Documentation
5
+ FORMAT = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/.freeze
6
+
7
+ attr_reader :file
8
+ attr_reader :number
9
+ attr_reader :method
10
+
11
+ def initialize(line)
12
+ _, @file, @number, @method = line.match(FORMAT).to_a
13
+ end
14
+
15
+ def to_s
16
+ "#{file}:#{number} in `#{method}'"
17
+ end
18
+
19
+ def inspect
20
+ "<Line: #{to_s}>" # rubocop:disable Lint/StringConversionInInterpolation
21
+ end
22
+ end
23
+
24
+ attr_reader :lines
25
+
26
+ def initialize(backtrace)
27
+ @lines = Array(backtrace).each.collect do |line|
28
+ InfluxDB::Rails.configuration.backtrace_filters.each do |filter|
29
+ line = filter.call(line)
30
+ end
31
+ Line.new(line)
32
+ end
33
+ end
34
+
35
+ def to_a
36
+ lines.map(&:to_s)
37
+ end
38
+
39
+ def inspect
40
+ "<Backtrace: " + lines.collect(&:to_s).join(", ") + ">"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,211 @@
1
+ module InfluxDB
2
+ module Rails
3
+ # rubocop:disable Metrics/ClassLength
4
+
5
+ class Configuration # rubocop:disable Style/Documentation
6
+ attr_accessor :influxdb_hosts
7
+ attr_accessor :influxdb_port
8
+ attr_accessor :influxdb_username
9
+ attr_accessor :influxdb_password
10
+ attr_accessor :influxdb_database
11
+ attr_accessor :async
12
+ attr_accessor :use_ssl
13
+ attr_accessor :retry
14
+ attr_accessor :open_timeout
15
+ attr_accessor :read_timeout
16
+ attr_accessor :max_delay
17
+ attr_accessor :time_precision
18
+
19
+ attr_accessor :series_name_for_controller_runtimes
20
+ attr_accessor :series_name_for_view_runtimes
21
+ attr_accessor :series_name_for_db_runtimes
22
+ attr_accessor :series_name_for_exceptions
23
+ attr_accessor :series_name_for_instrumentation
24
+ attr_accessor :series_name_for_render_template
25
+ attr_accessor :series_name_for_render_partial
26
+ attr_accessor :series_name_for_render_collection
27
+ attr_accessor :series_name_for_sql
28
+
29
+ attr_accessor :tags_middleware
30
+ attr_accessor :rails_app_name
31
+
32
+ attr_accessor :application_name
33
+ attr_accessor :application_root
34
+
35
+ attr_accessor :logger
36
+ attr_accessor :environment
37
+ attr_accessor :framework
38
+ attr_accessor :framework_version
39
+ attr_accessor :language
40
+ attr_accessor :language_version
41
+ attr_accessor :ignored_exceptions
42
+ attr_accessor :ignored_exception_messages
43
+ attr_accessor :ignored_reports
44
+ attr_accessor :ignored_environments
45
+ attr_accessor :ignored_user_agents
46
+ attr_accessor :backtrace_filters
47
+ attr_accessor :aggregated_exception_classes
48
+ attr_accessor :environment_variables
49
+ attr_accessor :environment_variable_filters
50
+
51
+ attr_accessor :instrumentation_enabled
52
+ attr_accessor :debug
53
+
54
+ DEFAULTS = {
55
+ influxdb_hosts: ["localhost"].freeze,
56
+ influxdb_port: 8086,
57
+ influxdb_username: "root".freeze,
58
+ influxdb_password: "root".freeze,
59
+ influxdb_database: nil,
60
+ async: true,
61
+ use_ssl: false,
62
+ retry: nil,
63
+ open_timeout: 5,
64
+ read_timeout: 300,
65
+ max_delay: 30,
66
+ time_precision: "s".freeze,
67
+
68
+ series_name_for_controller_runtimes: "rails.controller".freeze,
69
+ series_name_for_view_runtimes: "rails.view".freeze,
70
+ series_name_for_db_runtimes: "rails.db".freeze,
71
+ series_name_for_exceptions: "rails.exceptions".freeze,
72
+ series_name_for_instrumentation: "instrumentation".freeze,
73
+ series_name_for_render_template: "rails.render_template".freeze,
74
+ series_name_for_render_partial: "rails.render_partial".freeze,
75
+ series_name_for_render_collection: "rails.render_collection".freeze,
76
+ series_name_for_sql: nil,
77
+
78
+ tags_middleware: ->(tags) { tags },
79
+ rails_app_name: nil,
80
+
81
+ ignored_exceptions: %w[
82
+ ActiveRecord::RecordNotFound
83
+ ActionController::RoutingError
84
+ ].freeze,
85
+
86
+ ignored_exception_messages: [].freeze,
87
+ ignored_reports: [].freeze,
88
+ ignored_environments: %w[test cucumber selenium].freeze,
89
+ ignored_user_agents: %w[GoogleBot].freeze,
90
+ environment_variable_filters: [
91
+ /password/i,
92
+ /key/i,
93
+ /secret/i,
94
+ /ps1/i,
95
+ /rvm_.*_clr/i,
96
+ /color/i,
97
+ ].freeze,
98
+
99
+ backtrace_filters: [
100
+ ->(line) { line.gsub(%r{^\./}, "") },
101
+ lambda { |line|
102
+ return line if InfluxDB::Rails.configuration.application_root.to_s.empty?
103
+
104
+ line.gsub(/#{InfluxDB::Rails.configuration.application_root}/, "[APP_ROOT]")
105
+ },
106
+ lambda { |line|
107
+ if defined?(Gem) && !Gem.path.nil? && !Gem.path.empty?
108
+ Gem.path.each { |path| line = line.gsub(/#{path}/, "[GEM_ROOT]") }
109
+ end
110
+ line
111
+ },
112
+ ].freeze,
113
+ }.freeze
114
+
115
+ # rubocop:disable Metrics/MethodLength
116
+ # rubocop:disable Metrics/AbcSize
117
+
118
+ def initialize
119
+ @influxdb_hosts = DEFAULTS[:influxdb_hosts]
120
+ @influxdb_port = DEFAULTS[:influxdb_port]
121
+ @influxdb_username = DEFAULTS[:influxdb_username]
122
+ @influxdb_password = DEFAULTS[:influxdb_password]
123
+ @influxdb_database = DEFAULTS[:influxdb_database]
124
+ @async = DEFAULTS[:async]
125
+ @use_ssl = DEFAULTS[:use_ssl]
126
+ @retry = DEFAULTS[:retry]
127
+ @open_timeout = DEFAULTS[:open_timeout]
128
+ @read_timeout = DEFAULTS[:read_timeout]
129
+ @max_delay = DEFAULTS[:max_delay]
130
+ @time_precision = DEFAULTS[:time_precision]
131
+
132
+ @series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes]
133
+ @series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes]
134
+ @series_name_for_db_runtimes = DEFAULTS[:series_name_for_db_runtimes]
135
+ @series_name_for_exceptions = DEFAULTS[:series_name_for_exceptions]
136
+ @series_name_for_instrumentation = DEFAULTS[:series_name_for_instrumentation]
137
+ @series_name_for_render_template = DEFAULTS[:series_name_for_render_template]
138
+ @series_name_for_render_partial = DEFAULTS[:series_name_for_render_partial]
139
+ @series_name_for_render_collection = DEFAULTS[:series_name_for_render_collection]
140
+ @series_name_for_sql = DEFAULTS[:series_name_for_sql]
141
+
142
+ @tags_middleware = DEFAULTS[:tags_middleware]
143
+ @rails_app_name = DEFAULTS[:rails_app_name]
144
+
145
+ @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup
146
+ @ignored_exception_messages = DEFAULTS[:ignored_exception_messages].dup
147
+ @ignored_reports = DEFAULTS[:ignored_reports].dup
148
+ @ignored_environments = DEFAULTS[:ignored_environments].dup
149
+ @ignored_user_agents = DEFAULTS[:ignored_user_agents].dup
150
+ @backtrace_filters = DEFAULTS[:backtrace_filters].dup
151
+ @environment_variable_filters = DEFAULTS[:environment_variable_filters]
152
+ @aggregated_exception_classes = []
153
+
154
+ @debug = false
155
+ @rescue_global_exceptions = false
156
+ @instrumentation_enabled = true
157
+ end
158
+
159
+ # rubocop:enable Metrics/MethodLength
160
+ # rubocop:enable Metrics/AbcSize
161
+
162
+ def debug?
163
+ !!@debug # rubocop:disable Style/DoubleNegation
164
+ end
165
+
166
+ def instrumentation_enabled?
167
+ !!@instrumentation_enabled # rubocop:disable Style/DoubleNegation
168
+ end
169
+
170
+ def ignore_user_agent?(incoming_user_agent)
171
+ return false if ignored_user_agents.nil?
172
+
173
+ ignored_user_agents.any? { |agent| incoming_user_agent =~ /#{agent}/ }
174
+ end
175
+
176
+ def ignore_current_environment?
177
+ ignored_environments.include?(environment)
178
+ end
179
+
180
+ def ignore_exception?(ex)
181
+ !ignored_exception_messages.find { |msg| /.*#{msg}.*/ =~ ex.message }.nil? ||
182
+ ignored_exceptions.include?(ex.class.to_s)
183
+ end
184
+
185
+ def define_custom_exception_data(&block)
186
+ @custom_exception_data_handler = block
187
+ end
188
+
189
+ def add_custom_exception_data(exception_presenter)
190
+ @custom_exception_data_handler&.call(exception_presenter)
191
+ end
192
+
193
+ def load_rails_defaults
194
+ @logger ||= ::Rails.logger
195
+ @environment ||= ::Rails.env
196
+ @application_root ||= ::Rails.root
197
+ @application_name ||= ::Rails.application.class.parent_name
198
+ @framework = "Rails"
199
+ @framework_version = ::Rails.version
200
+ end
201
+
202
+ private
203
+
204
+ def initialize_http_connection
205
+ Net::HTTP.new(@app_host, "80")
206
+ end
207
+ end
208
+
209
+ # rubocop:enable Metrics/ClassLength
210
+ end
211
+ end