rorvswild 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0d7eae69ceb93804c2297b8fb97a400e09d183eeeb46ac879dc02873ba7f5b0
4
- data.tar.gz: 0bfe3e2d48fcecd010eeb399ad896d6e4e519073aa6ae0fc160ebcb9e1cf554c
3
+ metadata.gz: 34fc75a952dcdd5b7291e2227f2f59da531413338f0fb91ea64a61245b9368af
4
+ data.tar.gz: daab97444a9876ef871ca0c2832afd667cfb986fc1e101c36c97f3880f700b1a
5
5
  SHA512:
6
- metadata.gz: 5bf001a094bfa234414b8247c18d57159b734f1a829ef62997cdf66b7265fdc40e9cdad0530ecac8bc108459b202930487f0cad30b610cc4ebd7b00326ef17af
7
- data.tar.gz: 25ace108524d491befd74c9682c92f2a95e17c4ee4b8e11174143bb29425685074d81923f4cf981e0f0dc313ab7c493731206037d6036d2d74ff633411519ffd
6
+ metadata.gz: 3986c7c35162a29f6f4173fa4ce6728fea1eac8d2c4293fc275f850b885fb0eb472c4a3be85a473761295322aa10c490f2ad1e4ae198b4528075033eb8c977db
7
+ data.tar.gz: 94ecd7c5f04ecbf7608f5fd37467ebfa5d49e8f6f5e50d2be4822d4cb695c65e15daa325c8843a2f04b6c841803040dfdb020e055bb961f6122101119e1e04df
data/README.md CHANGED
@@ -155,12 +155,15 @@ From the configuration file, you can tell RorVsWild to skip monitoring some requ
155
155
  production:
156
156
  api_key: API_KEY
157
157
  ignore_requests:
158
- - SecretController#index
158
+ - HeartbeatController#show
159
+ - !ruby/regexp /SecretController/ # Ignore the entire controller
159
160
  ignore_jobs:
160
161
  - SecretJob
162
+ - !ruby/regexp /Secret::/ # Ignore the entire Secret namespace
161
163
  ignore_exceptions:
162
164
  - ActionController::RoutingError # Ignore by default any 404
163
165
  - ZeroDivisionError
166
+ - !ruby/regexp /Secret::/ # Ignore all secret errors
164
167
  ignore_plugins:
165
168
  - Sidekiq # If you don't want to monitor your Sidekiq jobs
166
169
  ```
@@ -171,9 +174,9 @@ Here is the equivalent if you prefer initialising RorVsWild manually.
171
174
  # config/initializers/rorvswild.rb
172
175
  RorVsWild.start(
173
176
  api_key: "API_KEY",
174
- ignore_requests: ["SecretController#index"],
175
- ignore_jobs: ["SecretJob"],
176
- ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError"],
177
+ ignore_requests: ["ApplicationController#heartbeat", /SecretController/],
178
+ ignore_jobs: ["SecretJob", /Secret::/],
179
+ ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError", /Secret::/],
177
180
  ignore_plugins: ["Sidekiq"])
178
181
  ```
179
182
 
@@ -101,17 +101,17 @@ module RorVsWild
101
101
  queue_request
102
102
  end
103
103
 
104
- def catch_error(extra_details = nil, &block)
104
+ def catch_error(context = nil, &block)
105
105
  begin
106
106
  block.call
107
107
  rescue Exception => ex
108
- record_error(ex, extra_details) if !ignored_exception?(ex)
108
+ record_error(ex, context)
109
109
  ex
110
110
  end
111
111
  end
112
112
 
113
- def record_error(exception, extra_details = nil)
114
- send_error(exception_to_hash(exception, extra_details))
113
+ def record_error(exception, context = nil)
114
+ send_error(exception_to_hash(exception, context)) if !ignored_exception?(exception)
115
115
  end
116
116
 
117
117
  def push_exception(exception, options = nil)
@@ -148,11 +148,16 @@ module RorVsWild
148
148
  end
149
149
 
150
150
  def ignored_request?(name)
151
- (config[:ignore_actions] || config[:ignore_requests]).include?(name)
151
+ config[:ignore_requests].any? { |str_or_regex| str_or_regex === name }
152
152
  end
153
153
 
154
154
  def ignored_job?(name)
155
- config[:ignore_jobs].include?(name)
155
+ config[:ignore_jobs].any? { |str_or_regex| str_or_regex === name }
156
+ end
157
+
158
+ def ignored_exception?(exception)
159
+ return false unless config[:ignore_exceptions]
160
+ config[:ignore_exceptions].any? { |str_or_regex| str_or_regex === exception.class.to_s }
156
161
  end
157
162
 
158
163
  def send_deployment
@@ -201,13 +206,9 @@ module RorVsWild
201
206
  message: exception.message,
202
207
  backtrace: exception.backtrace || ["No backtrace"],
203
208
  exception: exception.class.to_s,
204
- extra_details: context,
209
+ context: context,
205
210
  environment: Host.to_h,
206
211
  }
207
212
  end
208
-
209
- def ignored_exception?(exception)
210
- (config[:ignored_exceptions] || config[:ignore_exceptions]).include?(exception.class.to_s)
211
- end
212
213
  end
213
214
  end
@@ -20,8 +20,9 @@ module RorVsWild
20
20
 
21
21
  def self.load_config
22
22
  if (path = Rails.root.join("config/rorvswild.yml")).exist?
23
- hash = YAML.load(ERB.new(path.read).result)[Rails.env]
24
- hash && hash.deep_symbolize_keys
23
+ yaml = ERB.new(path.read).result
24
+ hash = YAML.safe_load(yaml, permitted_classes: [Regexp])
25
+ hash[Rails.env] && hash[Rails.env].deep_symbolize_keys
25
26
  end
26
27
  end
27
28
  end
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "1.6.1".freeze
2
+ VERSION = "1.6.2".freeze
3
3
  end
data/lib/rorvswild.rb CHANGED
@@ -38,12 +38,12 @@ module RorVsWild
38
38
  agent ? agent.measure_block(name , &block) : block.call
39
39
  end
40
40
 
41
- def self.catch_error(extra_details = nil, &block)
42
- agent ? agent.catch_error(extra_details, &block) : block.call
41
+ def self.catch_error(context = nil, &block)
42
+ agent ? agent.catch_error(context, &block) : block.call
43
43
  end
44
44
 
45
- def self.record_error(exception, extra_details = nil)
46
- agent.record_error(exception, extra_details) if agent
45
+ def self.record_error(exception, context = nil)
46
+ agent.record_error(exception, context) if agent
47
47
  end
48
48
 
49
49
  def self.merge_error_context(hash)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-02-07 00:00:00.000000000 Z
12
+ date: 2023-02-23 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Performances and errors insights for rails developers.
15
15
  email: