airbrake 5.8.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake.rb +1 -46
- data/lib/airbrake/version.rb +1 -1
- metadata +4 -6
- data/spec/unit/airbrake_spec.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd6dc0541e7ed8b5c12e51970d26ef14ad61d75
|
4
|
+
data.tar.gz: 5dbd13f274588c4bfe444914c0dfdd28985e8693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2463751a7a8e16c003acc7671e0a88db25878462fe6cf4fc74ff07160636c87579a1c05eddbe6f16e25fe570d61832c3ca86fc92961ea4c813e9e5d2ef1077e4
|
7
|
+
data.tar.gz: 2884c1a743235a0e7c25dc1f07a8f662a6d486d0de7e8fe729b2cfe4a3e33007566b2e258b40994d4495aa849e375fcbbe103637b41c78d8ac8e2729b4069a50
|
data/lib/airbrake.rb
CHANGED
@@ -28,53 +28,8 @@ require 'airbrake/delayed_job/plugin' if defined?(Delayed)
|
|
28
28
|
|
29
29
|
require 'airbrake/logger/airbrake_logger'
|
30
30
|
|
31
|
-
##
|
32
|
-
# This module reopens the original Airbrake module from airbrake-ruby and adds
|
33
|
-
# integration specific methods.
|
34
|
-
module Airbrake
|
35
|
-
class << self
|
36
|
-
##
|
37
|
-
# Attaches a callback (builder) that runs every time the Rack integration
|
38
|
-
# reports an error. Can be used to attach additional data from the Rack
|
39
|
-
# request.
|
40
|
-
#
|
41
|
-
# @example Adding remote IP from the Rack environment
|
42
|
-
# Airbrake.add_rack_builder do |notice, request|
|
43
|
-
# notice[:params][:remoteIp] = request.env['REMOTE_IP']
|
44
|
-
# end
|
45
|
-
#
|
46
|
-
# @yieldparam notice [Airbrake::Notice] notice that will be sent to Airbrake
|
47
|
-
# @yieldparam request [Rack::Request] current rack request
|
48
|
-
# @yieldreturn [void]
|
49
|
-
# @return [void]
|
50
|
-
# @since 5.1.0
|
51
|
-
# @deprecated Use {Airbrake.add_filter} with {Airbrake::Notice#stash}
|
52
|
-
# instead.
|
53
|
-
def add_rack_builder(&block)
|
54
|
-
warn(
|
55
|
-
"#{LOG_LABEL} `Airbrake.add_rack_builder` is deprecated and will " \
|
56
|
-
"be removed. Please use `Airbrake.add_filter` with `Notice#stash` " \
|
57
|
-
"instead. The stashed object is accessible through the :rack_request " \
|
58
|
-
"key. How to use: https://goo.gl/2dbuzR"
|
59
|
-
)
|
60
|
-
Airbrake.add_filter(rack_builder_shim(block))
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def rack_builder_shim(block)
|
66
|
-
proc do |notice|
|
67
|
-
if notice.stash[:rack_request]
|
68
|
-
block.call(notice, notice.stash[:rack_request])
|
69
|
-
else
|
70
|
-
block.call(notice)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
31
|
# Notify of unhandled exceptions, if there were any, but ignore SystemExit.
|
78
32
|
at_exit do
|
79
33
|
Airbrake.notify_sync($ERROR_INFO) if $ERROR_INFO
|
34
|
+
Airbrake.close
|
80
35
|
end
|
data/lib/airbrake/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +234,6 @@ files:
|
|
234
234
|
- spec/integration/shared_examples/rack_examples.rb
|
235
235
|
- spec/integration/sinatra/sinatra_spec.rb
|
236
236
|
- spec/spec_helper.rb
|
237
|
-
- spec/unit/airbrake_spec.rb
|
238
237
|
- spec/unit/logger/airbrake_logger_spec.rb
|
239
238
|
- spec/unit/rack/context_filter_spec.rb
|
240
239
|
- spec/unit/rack/http_headers_filter_spec.rb
|
@@ -289,7 +288,6 @@ test_files:
|
|
289
288
|
- spec/integration/shared_examples/rack_examples.rb
|
290
289
|
- spec/integration/sinatra/sinatra_spec.rb
|
291
290
|
- spec/spec_helper.rb
|
292
|
-
- spec/unit/airbrake_spec.rb
|
293
291
|
- spec/unit/logger/airbrake_logger_spec.rb
|
294
292
|
- spec/unit/rack/context_filter_spec.rb
|
295
293
|
- spec/unit/rack/http_headers_filter_spec.rb
|
data/spec/unit/airbrake_spec.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Airbrake do
|
4
|
-
let(:endpoint) do
|
5
|
-
'https://airbrake.io/api/v3/projects/113743/notices?key=fd04e13d806a90f96614ad8e529b2822'
|
6
|
-
end
|
7
|
-
|
8
|
-
def env_for(url, opts = {})
|
9
|
-
Rack::MockRequest.env_for(url, opts)
|
10
|
-
end
|
11
|
-
|
12
|
-
before do
|
13
|
-
stub_request(:post, endpoint).to_return(status: 201, body: '{}')
|
14
|
-
end
|
15
|
-
|
16
|
-
describe ".add_rack_builder" do
|
17
|
-
let(:filters) do
|
18
|
-
notifier = Airbrake.instance_variable_get(:@notifiers)[:default]
|
19
|
-
filter_chain = notifier.instance_variable_get(:@filter_chain)
|
20
|
-
filter_chain.instance_variable_get(:@filters)
|
21
|
-
end
|
22
|
-
|
23
|
-
after { filters.pop }
|
24
|
-
|
25
|
-
it "adds new builder to the filter chain" do
|
26
|
-
expect do
|
27
|
-
Airbrake.add_rack_builder(&proc { |_, _| nil })
|
28
|
-
end.to change { filters.count }.by(1)
|
29
|
-
end
|
30
|
-
|
31
|
-
context "when notice has :rack_request in stash" do
|
32
|
-
it "executes the filter yielding 2 params (last one is request)" do
|
33
|
-
executed = false
|
34
|
-
builder = proc do |notice, request|
|
35
|
-
executed = true
|
36
|
-
expect(notice).to be_an(Airbrake::Notice)
|
37
|
-
expect(request).to be_a(Rack::Request)
|
38
|
-
end
|
39
|
-
Airbrake.add_rack_builder(&builder)
|
40
|
-
|
41
|
-
notice = Airbrake.build_notice('oops')
|
42
|
-
notice.stash[:rack_request] = Rack::Request.new(env_for('/'))
|
43
|
-
Airbrake.notify_sync(notice)
|
44
|
-
|
45
|
-
expect(executed).to be_truthy
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "when notice doesn't have :rack_request in stash" do
|
50
|
-
it "executes the filter yielding only one param" do
|
51
|
-
executed = false
|
52
|
-
builder = proc do |notice, request|
|
53
|
-
executed = true
|
54
|
-
expect(notice).to be_an(Airbrake::Notice)
|
55
|
-
expect(request).to be_nil
|
56
|
-
end
|
57
|
-
Airbrake.add_rack_builder(&builder)
|
58
|
-
|
59
|
-
Airbrake.notify_sync('oops')
|
60
|
-
|
61
|
-
expect(executed).to be_truthy
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|