airbrake-ruby 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +197 -43
- data/lib/airbrake-ruby/config.rb +43 -11
- data/lib/airbrake-ruby/deploy_notifier.rb +47 -0
- data/lib/airbrake-ruby/filter_chain.rb +32 -50
- data/lib/airbrake-ruby/filters/git_repository_filter.rb +9 -1
- data/lib/airbrake-ruby/filters/sql_filter.rb +104 -0
- data/lib/airbrake-ruby/hash_keyable.rb +37 -0
- data/lib/airbrake-ruby/ignorable.rb +44 -0
- data/lib/airbrake-ruby/notice.rb +2 -22
- data/lib/airbrake-ruby/{notifier.rb → notice_notifier.rb} +66 -46
- data/lib/airbrake-ruby/performance_notifier.rb +161 -0
- data/lib/airbrake-ruby/stat.rb +56 -0
- data/lib/airbrake-ruby/tdigest.rb +393 -0
- data/lib/airbrake-ruby/time_truncate.rb +17 -0
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +57 -13
- data/spec/async_sender_spec.rb +0 -2
- data/spec/backtrace_spec.rb +0 -2
- data/spec/code_hunk_spec.rb +0 -2
- data/spec/config/validator_spec.rb +0 -2
- data/spec/config_spec.rb +16 -4
- data/spec/deploy_notifier_spec.rb +41 -0
- data/spec/file_cache.rb +0 -2
- data/spec/filter_chain_spec.rb +1 -7
- data/spec/filters/context_filter_spec.rb +0 -2
- data/spec/filters/dependency_filter_spec.rb +0 -2
- data/spec/filters/exception_attributes_filter_spec.rb +0 -2
- data/spec/filters/gem_root_filter_spec.rb +0 -2
- data/spec/filters/git_last_checkout_filter_spec.rb +0 -2
- data/spec/filters/git_repository_filter.rb +0 -2
- data/spec/filters/git_revision_filter_spec.rb +0 -2
- data/spec/filters/keys_blacklist_spec.rb +0 -2
- data/spec/filters/keys_whitelist_spec.rb +0 -2
- data/spec/filters/root_directory_filter_spec.rb +0 -2
- data/spec/filters/sql_filter_spec.rb +219 -0
- data/spec/filters/system_exit_filter_spec.rb +0 -2
- data/spec/filters/thread_filter_spec.rb +0 -2
- data/spec/ignorable_spec.rb +14 -0
- data/spec/nested_exception_spec.rb +0 -2
- data/spec/{notifier_spec.rb → notice_notifier_spec.rb} +24 -114
- data/spec/{notifier_spec → notice_notifier_spec}/options_spec.rb +40 -39
- data/spec/notice_spec.rb +2 -4
- data/spec/performance_notifier_spec.rb +287 -0
- data/spec/promise_spec.rb +0 -2
- data/spec/response_spec.rb +0 -2
- data/spec/stat_spec.rb +35 -0
- data/spec/sync_sender_spec.rb +0 -2
- data/spec/tdigest_spec.rb +230 -0
- data/spec/time_truncate_spec.rb +13 -0
- data/spec/truncator_spec.rb +0 -2
- metadata +34 -15
- data/lib/airbrake-ruby/route_sender.rb +0 -175
- data/spec/route_sender_spec.rb +0 -130
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9434113b46be898d421f70cba2eb683fc5fdc1a
|
4
|
+
data.tar.gz: d9f06c9d709dbc0c11c5210d52b7f2d3ca030e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d9a2fef303a9b785e33ee7300c2b26773edb4f617ffede7fbf3b0185ca2bed955d4f865db344079a15b1bb83f7cc8306f866250bcb7c68b4d7201db7762a68
|
7
|
+
data.tar.gz: d1a63fa071431c4333c657d8843bebb684919d68983b5abf476e6a3208cc18894a272a6a64a7adf9520e9ee01eca87b25f2d7cc0f0837464b280018a1cd44213
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -14,6 +14,7 @@ require 'airbrake-ruby/sync_sender'
|
|
14
14
|
require 'airbrake-ruby/async_sender'
|
15
15
|
require 'airbrake-ruby/response'
|
16
16
|
require 'airbrake-ruby/nested_exception'
|
17
|
+
require 'airbrake-ruby/ignorable'
|
17
18
|
require 'airbrake-ruby/notice'
|
18
19
|
require 'airbrake-ruby/backtrace'
|
19
20
|
require 'airbrake-ruby/truncator'
|
@@ -30,11 +31,17 @@ require 'airbrake-ruby/filters/dependency_filter'
|
|
30
31
|
require 'airbrake-ruby/filters/git_revision_filter'
|
31
32
|
require 'airbrake-ruby/filters/git_repository_filter'
|
32
33
|
require 'airbrake-ruby/filters/git_last_checkout_filter'
|
34
|
+
require 'airbrake-ruby/filters/sql_filter'
|
33
35
|
require 'airbrake-ruby/filter_chain'
|
34
|
-
require 'airbrake-ruby/notifier'
|
35
36
|
require 'airbrake-ruby/code_hunk'
|
36
37
|
require 'airbrake-ruby/file_cache'
|
37
|
-
require 'airbrake-ruby/
|
38
|
+
require 'airbrake-ruby/hash_keyable'
|
39
|
+
require 'airbrake-ruby/performance_notifier'
|
40
|
+
require 'airbrake-ruby/notice_notifier'
|
41
|
+
require 'airbrake-ruby/deploy_notifier'
|
42
|
+
require 'airbrake-ruby/stat'
|
43
|
+
require 'airbrake-ruby/time_truncate'
|
44
|
+
require 'airbrake-ruby/tdigest'
|
38
45
|
|
39
46
|
# This module defines the Airbrake API. The user is meant to interact with
|
40
47
|
# Airbrake via its public class methods. Before using the library, you must to
|
@@ -67,7 +74,7 @@ require 'airbrake-ruby/route_sender'
|
|
67
74
|
# params = {}
|
68
75
|
# Airbrake[:my_other_project].notify('Oops', params)
|
69
76
|
#
|
70
|
-
# @see Airbrake::
|
77
|
+
# @see Airbrake::NoticeNotifier
|
71
78
|
# @since v1.0.0
|
72
79
|
module Airbrake
|
73
80
|
# The general error that this library uses when it wants to raise.
|
@@ -83,11 +90,12 @@ module Airbrake
|
|
83
90
|
# @!macro see_public_api_method
|
84
91
|
# @see Airbrake.$0
|
85
92
|
|
86
|
-
#
|
87
|
-
# serves only
|
93
|
+
# NilNoticeNotifier is a no-op notice notifier, which mimics
|
94
|
+
# +Airbrake::NoticeNotifier+ and serves only the purpose of making the library
|
95
|
+
# API easier to use.
|
88
96
|
#
|
89
|
-
# @since
|
90
|
-
class
|
97
|
+
# @since v2.1.0
|
98
|
+
class NilNoticeNotifier
|
91
99
|
# @macro see_public_api_method
|
92
100
|
def notify(_exception, _params = {}, &block); end
|
93
101
|
|
@@ -106,9 +114,6 @@ module Airbrake
|
|
106
114
|
# @macro see_public_api_method
|
107
115
|
def close; end
|
108
116
|
|
109
|
-
# @macro see_public_api_method
|
110
|
-
def create_deploy(_deploy_params); end
|
111
|
-
|
112
117
|
# @macro see_public_api_method
|
113
118
|
def configured?
|
114
119
|
false
|
@@ -116,15 +121,61 @@ module Airbrake
|
|
116
121
|
|
117
122
|
# @macro see_public_api_method
|
118
123
|
def merge_context(_context); end
|
124
|
+
end
|
119
125
|
|
120
|
-
|
121
|
-
|
126
|
+
# @deprecated Use {Airbrake::NoticeNotifier} instead
|
127
|
+
Notifier = NoticeNotifier
|
128
|
+
deprecate_constant(:Notifier) if respond_to?(:deprecate_constant)
|
129
|
+
|
130
|
+
# @deprecated Use {Airbrake::NilNoticeNotifier} instead
|
131
|
+
NilNotifier = NilNoticeNotifier
|
132
|
+
deprecate_constant(:NilNotifier) if respond_to?(:deprecate_constant)
|
133
|
+
|
134
|
+
# NilPerformanceNotifier is a no-op notifier, which mimics
|
135
|
+
# {Airbrake::PerformanceNotifier} and serves only the purpose of making the
|
136
|
+
# library API easier to use.
|
137
|
+
#
|
138
|
+
# @since v3.2.0
|
139
|
+
class NilPerformanceNotifier
|
140
|
+
# @see Airbrake.notify_request
|
141
|
+
# @see Airbrake.notify_query
|
142
|
+
def notify(_performance_info); end
|
143
|
+
|
144
|
+
# @see Airbrake.notify_request
|
145
|
+
# @see Airbrake.notify_query
|
146
|
+
def add_filter(_filter = nil, &_block); end
|
147
|
+
|
148
|
+
# @see Airbrake.notify_request
|
149
|
+
# @see Airbrake.notify_query
|
150
|
+
def delete_filter(_filter_class); end
|
151
|
+
end
|
152
|
+
|
153
|
+
# NilDeployNotifier is a no-op notifier, which mimics
|
154
|
+
# {Airbrake::DeployNotifier} and serves only the purpose of making the library
|
155
|
+
# API easier to use.
|
156
|
+
#
|
157
|
+
# @since v3.2.0
|
158
|
+
class NilDeployNotifier
|
159
|
+
# @see Airbrake.create_deploy
|
160
|
+
def notify(_deploy_info); end
|
122
161
|
end
|
123
162
|
|
124
|
-
# A Hash that holds all notifiers. The keys of the Hash are notifier
|
125
|
-
# names, the values are Airbrake::
|
126
|
-
# assigned to the hash, then it returns a null object (
|
127
|
-
@
|
163
|
+
# A Hash that holds all notice notifiers. The keys of the Hash are notifier
|
164
|
+
# names, the values are {Airbrake::NoticeNotifier} instances. If a notifier is
|
165
|
+
# not assigned to the hash, then it returns a null object (NilNoticeNotifier).
|
166
|
+
@notice_notifiers = Hash.new(NilNoticeNotifier.new)
|
167
|
+
|
168
|
+
# A Hash that holds all performance notifiers. The keys of the Hash are
|
169
|
+
# notifier names, the values are {Airbrake::PerformanceNotifier} instances. If
|
170
|
+
# a notifier is not assigned to the hash, then it returns a null object
|
171
|
+
# (NilPerformanceNotifier).
|
172
|
+
@performance_notifiers = Hash.new(NilPerformanceNotifier.new)
|
173
|
+
|
174
|
+
# A Hash that holds all deploy notifiers. The keys of the Hash are notifier
|
175
|
+
# names, the values are {Airbrake::DeployNotifier} instances. If a deploy
|
176
|
+
# notifier is not assigned to the hash, then it returns a null object
|
177
|
+
# (NilDeployNotifier).
|
178
|
+
@deploy_notifiers = Hash.new(NilDeployNotifier.new)
|
128
179
|
|
129
180
|
class << self
|
130
181
|
# Retrieves configured notifiers.
|
@@ -132,11 +183,23 @@ module Airbrake
|
|
132
183
|
# @example
|
133
184
|
# Airbrake[:my_notifier].notify('oops')
|
134
185
|
#
|
135
|
-
# @param [Symbol] notifier_name the name of the notifier you want to
|
136
|
-
#
|
186
|
+
# @param [Symbol] notifier_name the name of the notice notifier you want to
|
187
|
+
# use
|
188
|
+
# @return [Airbrake::NoticeNotifier, NilClass]
|
137
189
|
# @since v1.8.0
|
138
190
|
def [](notifier_name)
|
139
|
-
@
|
191
|
+
@notice_notifiers[notifier_name]
|
192
|
+
end
|
193
|
+
|
194
|
+
# @return [Hash{Symbol=>Array<Object>}] a Hash with all configured notifiers
|
195
|
+
# (notice, performance, deploy)
|
196
|
+
# @since v3.2.0
|
197
|
+
def notifiers
|
198
|
+
{
|
199
|
+
notice: @notice_notifiers,
|
200
|
+
performance: @performance_notifiers,
|
201
|
+
deploy: @deploy_notifiers
|
202
|
+
}
|
140
203
|
end
|
141
204
|
|
142
205
|
# Configures a new +notifier+ with the given name. If the name is not given,
|
@@ -162,23 +225,29 @@ module Airbrake
|
|
162
225
|
# @return [void]
|
163
226
|
# @raise [Airbrake::Error] when trying to reconfigure already
|
164
227
|
# existing notifier
|
228
|
+
# @raise [Airbrake::Error] when either +project_id+ or +project_key+
|
229
|
+
# is missing (or both)
|
165
230
|
# @note There's no way to reconfigure a notifier
|
166
231
|
# @note There's no way to read config values outside of this library
|
167
232
|
def configure(notifier_name = :default)
|
168
233
|
yield config = Airbrake::Config.new
|
169
234
|
|
170
|
-
if @
|
235
|
+
if @notice_notifiers.key?(notifier_name)
|
171
236
|
raise Airbrake::Error,
|
172
237
|
"the '#{notifier_name}' notifier was already configured"
|
173
|
-
else
|
174
|
-
@notifiers[notifier_name] = Notifier.new(config)
|
175
238
|
end
|
239
|
+
|
240
|
+
raise Airbrake::Error, config.validation_error_message unless config.valid?
|
241
|
+
|
242
|
+
@notice_notifiers[notifier_name] = NoticeNotifier.new(config)
|
243
|
+
@performance_notifiers[notifier_name] = PerformanceNotifier.new(config)
|
244
|
+
@deploy_notifiers[notifier_name] = DeployNotifier.new(config)
|
176
245
|
end
|
177
246
|
|
178
247
|
# @return [Boolean] true if the notifier was configured, false otherwise
|
179
|
-
# @since
|
248
|
+
# @since v2.3.0
|
180
249
|
def configured?
|
181
|
-
@
|
250
|
+
@notice_notifiers[:default].configured?
|
182
251
|
end
|
183
252
|
|
184
253
|
# Sends an exception to Airbrake asynchronously.
|
@@ -203,7 +272,7 @@ module Airbrake
|
|
203
272
|
# @return [Airbrake::Promise]
|
204
273
|
# @see .notify_sync
|
205
274
|
def notify(exception, params = {}, &block)
|
206
|
-
@
|
275
|
+
@notice_notifiers[:default].notify(exception, params, &block)
|
207
276
|
end
|
208
277
|
|
209
278
|
# Sends an exception to Airbrake synchronously.
|
@@ -223,7 +292,7 @@ module Airbrake
|
|
223
292
|
# @return [Hash{String=>String}] the reponse from the server
|
224
293
|
# @see .notify
|
225
294
|
def notify_sync(exception, params = {}, &block)
|
226
|
-
@
|
295
|
+
@notice_notifiers[:default].notify_sync(exception, params, &block)
|
227
296
|
end
|
228
297
|
|
229
298
|
# Runs a callback before {.notify} or {.notify_sync} kicks in. This is
|
@@ -251,7 +320,7 @@ module Airbrake
|
|
251
320
|
# @yieldreturn [void]
|
252
321
|
# @return [void]
|
253
322
|
def add_filter(filter = nil, &block)
|
254
|
-
@
|
323
|
+
@notice_notifiers[:default].add_filter(filter, &block)
|
255
324
|
end
|
256
325
|
|
257
326
|
# Deletes a filter added via {Airbrake#add_filter}.
|
@@ -268,7 +337,7 @@ module Airbrake
|
|
268
337
|
# @since v3.1.0
|
269
338
|
# @note This method cannot delete filters assigned via the Proc form.
|
270
339
|
def delete_filter(filter_class)
|
271
|
-
@
|
340
|
+
@notice_notifiers[:default].delete_filter(filter_class)
|
272
341
|
end
|
273
342
|
|
274
343
|
# Builds an Airbrake notice. This is useful, if you want to add or modify a
|
@@ -286,12 +355,12 @@ module Airbrake
|
|
286
355
|
# @return [Airbrake::Notice] the notice built with help of the given
|
287
356
|
# arguments
|
288
357
|
def build_notice(exception, params = {})
|
289
|
-
@
|
358
|
+
@notice_notifiers[:default].build_notice(exception, params)
|
290
359
|
end
|
291
360
|
|
292
|
-
# Makes the notifier a no-op, which means you cannot use the
|
293
|
-
# {.notify_sync} methods anymore. It also stops the
|
294
|
-
# threads.
|
361
|
+
# Makes the notice notifier a no-op, which means you cannot use the
|
362
|
+
# {.notify} and {.notify_sync} methods anymore. It also stops the notice
|
363
|
+
# notifier's worker threads.
|
295
364
|
#
|
296
365
|
# @example
|
297
366
|
# Airbrake.close
|
@@ -299,21 +368,21 @@ module Airbrake
|
|
299
368
|
#
|
300
369
|
# @return [void]
|
301
370
|
def close
|
302
|
-
@
|
371
|
+
@notice_notifiers[:default].close
|
303
372
|
end
|
304
373
|
|
305
374
|
# Pings the Airbrake Deploy API endpoint about the occurred deploy. This
|
306
375
|
# method is used by the airbrake gem for various integrations.
|
307
376
|
#
|
308
|
-
# @param [Hash{Symbol=>String}]
|
309
|
-
# @option
|
310
|
-
# @option
|
311
|
-
# @option
|
312
|
-
# @option
|
313
|
-
# @option
|
377
|
+
# @param [Hash{Symbol=>String}] deploy_info The params for the API
|
378
|
+
# @option deploy_info [Symbol] :environment
|
379
|
+
# @option deploy_info [Symbol] :username
|
380
|
+
# @option deploy_info [Symbol] :repository
|
381
|
+
# @option deploy_info [Symbol] :revision
|
382
|
+
# @option deploy_info [Symbol] :version
|
314
383
|
# @return [void]
|
315
|
-
def create_deploy(
|
316
|
-
@
|
384
|
+
def create_deploy(deploy_info)
|
385
|
+
@deploy_notifiers[:default].notify(deploy_info)
|
317
386
|
end
|
318
387
|
|
319
388
|
# Merges +context+ with the current context.
|
@@ -361,7 +430,7 @@ module Airbrake
|
|
361
430
|
# @param [Hash{Symbol=>Object}] context
|
362
431
|
# @return [void]
|
363
432
|
def merge_context(context)
|
364
|
-
@
|
433
|
+
@notice_notifiers[:default].merge_context(context)
|
365
434
|
end
|
366
435
|
|
367
436
|
# Increments request statistics of a certain +route+ that was invoked on
|
@@ -388,8 +457,93 @@ module Airbrake
|
|
388
457
|
# @option request_info [Time] :end_time When the request ended (optional)
|
389
458
|
# @return [void]
|
390
459
|
# @since v3.0.0
|
460
|
+
# @see Airbrake::PerformanceNotifier#notify
|
391
461
|
def notify_request(request_info)
|
392
|
-
@
|
462
|
+
@performance_notifiers[:default].notify(Request.new(request_info))
|
463
|
+
end
|
464
|
+
|
465
|
+
# Increments SQL statistics of a certain +query+ that was invoked on
|
466
|
+
# +start_time+ and finished on +end_time+. When +method+ and +route+ are
|
467
|
+
# provided, the query is grouped by these parameters.
|
468
|
+
#
|
469
|
+
# After a certain amount of time (n seconds) the aggregated query
|
470
|
+
# information will be sent to Airbrake.
|
471
|
+
#
|
472
|
+
# @example
|
473
|
+
# Airbrake.notify_query(
|
474
|
+
# method: 'GET',
|
475
|
+
# route: '/things',
|
476
|
+
# query: 'SELECT * FROM things',
|
477
|
+
# start_time: timestamp,
|
478
|
+
# end_time: Time.now
|
479
|
+
# )
|
480
|
+
#
|
481
|
+
# @param [Hash{Symbol=>Object}] query_info
|
482
|
+
# @option request_info [String] :method The HTTP method that triggered this
|
483
|
+
# SQL query (optional)
|
484
|
+
# @option request_info [String] :route The route that triggered this SQL
|
485
|
+
# query (optional)
|
486
|
+
# @option request_info [String] :query The query that was executed
|
487
|
+
# @option request_info [Date] :start_time When the query started executing
|
488
|
+
# @option request_info [Time] :end_time When the query finished (optional)
|
489
|
+
# @return [void]
|
490
|
+
# @since v3.2.0
|
491
|
+
# @see Airbrake::PerformanceNotifier#notify
|
492
|
+
def notify_query(query_info)
|
493
|
+
@performance_notifiers[:default].notify(Query.new(query_info))
|
494
|
+
end
|
495
|
+
|
496
|
+
# Runs a callback before {.notify_request} or {.notify_query} kicks in. This
|
497
|
+
# is useful if you want to ignore specific resources or filter the data the
|
498
|
+
# resource contains.
|
499
|
+
#
|
500
|
+
# @example Ignore all resources
|
501
|
+
# Airbrake.add_performance_filter(&:ignore!)
|
502
|
+
# @example Filter sensitive data
|
503
|
+
# Airbrake.add_performance_filter do |resource|
|
504
|
+
# case resource
|
505
|
+
# when Airbrake::Query
|
506
|
+
# resource.route = '[Filtered]'
|
507
|
+
# when Airbrake::Request
|
508
|
+
# resource.query = '[Filtered]'
|
509
|
+
# end
|
510
|
+
# end
|
511
|
+
# @example Filter with help of a class
|
512
|
+
# class MyFilter
|
513
|
+
# def call(resource)
|
514
|
+
# # ...
|
515
|
+
# end
|
516
|
+
# end
|
517
|
+
#
|
518
|
+
# Airbrake.add_performance_filter(MyFilter.new)
|
519
|
+
#
|
520
|
+
# @param [#call] filter The filter object
|
521
|
+
# @yield [resource] The resource to filter
|
522
|
+
# @yieldparam [Airbrake::Query, Airbrake::Request]
|
523
|
+
# @yieldreturn [void]
|
524
|
+
# @return [void]
|
525
|
+
# @since v3.2.0
|
526
|
+
# @see Airbrake::PerformanceNotifier#add_filter
|
527
|
+
def add_performance_filter(filter = nil, &block)
|
528
|
+
@performance_notifiers[:default].add_filter(filter, &block)
|
529
|
+
end
|
530
|
+
|
531
|
+
# Deletes a filter added via {Airbrake#add_performance_filter}.
|
532
|
+
#
|
533
|
+
# @example
|
534
|
+
# # Add a MyFilter filter (we pass an instance here).
|
535
|
+
# Airbrake.add_performance_filter(MyFilter.new)
|
536
|
+
#
|
537
|
+
# # Delete the filter (we pass class name here).
|
538
|
+
# Airbrake.delete_performance_filter(MyFilter)
|
539
|
+
#
|
540
|
+
# @param [Class] filter_class The class of the filter you want to delete
|
541
|
+
# @return [void]
|
542
|
+
# @since v3.2.0
|
543
|
+
# @note This method cannot delete filters assigned via the Proc form.
|
544
|
+
# @see Airbrake::PerformanceNotifier#delete_filter
|
545
|
+
def delete_performance_filter(filter_class)
|
546
|
+
@performance_notifiers[:default].delete_filter(filter_class)
|
393
547
|
end
|
394
548
|
end
|
395
549
|
end
|
data/lib/airbrake-ruby/config.rb
CHANGED
@@ -2,7 +2,7 @@ module Airbrake
|
|
2
2
|
# Represents the Airbrake config. A config contains all the options that you
|
3
3
|
# can use to configure an Airbrake instance.
|
4
4
|
#
|
5
|
-
# @api
|
5
|
+
# @api public
|
6
6
|
# @since v1.0.0
|
7
7
|
class Config
|
8
8
|
# @return [Integer] the project identificator. This value *must* be set.
|
@@ -68,13 +68,13 @@ module Airbrake
|
|
68
68
|
# @return [Array<String, Symbol, Regexp>] the keys, which should be
|
69
69
|
# filtered
|
70
70
|
# @api public
|
71
|
-
# @since
|
71
|
+
# @since v1.2.0
|
72
72
|
attr_accessor :blacklist_keys
|
73
73
|
|
74
74
|
# @return [Array<String, Symbol, Regexp>] the keys, which shouldn't be
|
75
75
|
# filtered
|
76
76
|
# @api public
|
77
|
-
# @since
|
77
|
+
# @since v1.2.0
|
78
78
|
attr_accessor :whitelist_keys
|
79
79
|
|
80
80
|
# @return [Boolean] true if the library should attach code hunks to each
|
@@ -83,17 +83,17 @@ module Airbrake
|
|
83
83
|
# @since v2.5.0
|
84
84
|
attr_accessor :code_hunks
|
85
85
|
|
86
|
-
# @return [Boolean] true if the library should send
|
87
|
-
# to Airbrake, false otherwise
|
86
|
+
# @return [Boolean] true if the library should send performance stats
|
87
|
+
# information to Airbrake (routes, SQL queries), false otherwise
|
88
88
|
# @api public
|
89
|
-
# @since v3.
|
90
|
-
attr_accessor :
|
89
|
+
# @since v3.2.0
|
90
|
+
attr_accessor :performance_stats
|
91
91
|
|
92
92
|
# @return [Integer] how many seconds to wait before sending collected route
|
93
93
|
# stats
|
94
94
|
# @api public
|
95
|
-
# @since v3.
|
96
|
-
attr_accessor :
|
95
|
+
# @since v3.2.0
|
96
|
+
attr_accessor :performance_stats_flush_period
|
97
97
|
|
98
98
|
# @param [Hash{Symbol=>Object}] user_config the hash to be used to build the
|
99
99
|
# config
|
@@ -126,8 +126,8 @@ module Airbrake
|
|
126
126
|
)
|
127
127
|
|
128
128
|
self.versions = {}
|
129
|
-
self.
|
130
|
-
self.
|
129
|
+
self.performance_stats = false
|
130
|
+
self.performance_stats_flush_period = 15
|
131
131
|
|
132
132
|
merge(user_config)
|
133
133
|
end
|
@@ -195,6 +195,38 @@ module Airbrake
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
+
def route_stats
|
199
|
+
logger.warn(
|
200
|
+
"#{LOG_LABEL} the 'route_stats' option is deprecated. " \
|
201
|
+
"Use 'performance_stats' instead"
|
202
|
+
)
|
203
|
+
@performance_stats
|
204
|
+
end
|
205
|
+
|
206
|
+
def route_stats=(value)
|
207
|
+
logger.warn(
|
208
|
+
"#{LOG_LABEL} the 'route_stats' option is deprecated. " \
|
209
|
+
"Use 'performance_stats_flush_period' instead"
|
210
|
+
)
|
211
|
+
@performance_stats = value
|
212
|
+
end
|
213
|
+
|
214
|
+
def route_stats_flush_period
|
215
|
+
logger.warn(
|
216
|
+
"#{LOG_LABEL} the 'route_stats_flush_period' option is deprecated. " \
|
217
|
+
"Use 'performance_stats_flush_period' instead"
|
218
|
+
)
|
219
|
+
@performance_stats_flush_period
|
220
|
+
end
|
221
|
+
|
222
|
+
def route_stats_flush_period=(value)
|
223
|
+
logger.warn(
|
224
|
+
"#{LOG_LABEL} the 'route_stats_flush_period' option is deprecated. " \
|
225
|
+
"Use 'performance_stats' instead"
|
226
|
+
)
|
227
|
+
@performance_stats_flush_period = value
|
228
|
+
end
|
229
|
+
|
198
230
|
private
|
199
231
|
|
200
232
|
def set_option(option, value)
|