bugsnag 2.8.12 → 2.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +85 -546
- data/VERSION +1 -1
- data/docs/Configuration.md +239 -0
- data/docs/Notification Options.md +269 -0
- data/docs/README.md +14 -0
- data/lib/bugsnag/configuration.rb +2 -0
- data/lib/bugsnag/delivery/thread_queue.rb +6 -8
- data/lib/bugsnag/deploy.rb +0 -1
- data/lib/bugsnag/notification.rb +13 -2
- data/lib/bugsnag/railtie.rb +2 -2
- data/lib/bugsnag/tasks/bugsnag.rake +1 -1
- data/spec/notification_spec.rb +13 -0
- data/spec/spec_helper.rb +5 -5
- metadata +26 -23
data/docs/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# `bugsnag-ruby` Usage and Configuration
|
2
|
+
|
3
|
+
## [Configuration](Configuration.md)
|
4
|
+
|
5
|
+
Bugsnag includes several configuration for better compatibility with your
|
6
|
+
project and network settings.
|
7
|
+
|
8
|
+
## [Notification Options](Notification Options.md)
|
9
|
+
|
10
|
+
It is often useful to send additional metadata about your app, such as
|
11
|
+
information about the currently logged in user, along with any exceptions, to
|
12
|
+
help debug problems. This document lists possible per-notification options as
|
13
|
+
well as additional configuration available for different project types,
|
14
|
+
including Rails, Rails API, and other frameworks.
|
@@ -14,6 +14,7 @@ module Bugsnag
|
|
14
14
|
attr_accessor :send_environment
|
15
15
|
attr_accessor :send_code
|
16
16
|
attr_accessor :project_root
|
17
|
+
attr_accessor :vendor_paths
|
17
18
|
attr_accessor :app_version
|
18
19
|
attr_accessor :app_type
|
19
20
|
attr_accessor :params_filters
|
@@ -79,6 +80,7 @@ module Bugsnag
|
|
79
80
|
self.hostname = default_hostname
|
80
81
|
self.delivery_method = DEFAULT_DELIVERY_METHOD
|
81
82
|
self.timeout = 15
|
83
|
+
self.vendor_paths = [%r{vendor/}]
|
82
84
|
|
83
85
|
# Read the API key from the environment
|
84
86
|
self.api_key = ENV["BUGSNAG_API_KEY"]
|
@@ -11,19 +11,17 @@ module Bugsnag
|
|
11
11
|
def deliver(url, body, configuration)
|
12
12
|
start_once!
|
13
13
|
|
14
|
-
if queue.length > MAX_OUTSTANDING_REQUESTS
|
15
|
-
Bugsnag.warn("Dropping notification, #{queue.length} outstanding requests")
|
14
|
+
if @queue.length > MAX_OUTSTANDING_REQUESTS
|
15
|
+
Bugsnag.warn("Dropping notification, #{@queue.length} outstanding requests")
|
16
16
|
return
|
17
17
|
end
|
18
18
|
|
19
19
|
# Add delivery to the worker thread
|
20
|
-
queue.push proc { super(url, body, configuration) }
|
20
|
+
@queue.push proc { super(url, body, configuration) }
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
attr_reader :queue
|
26
|
-
|
27
25
|
def start_once!
|
28
26
|
MUTEX.synchronize do
|
29
27
|
return if @started
|
@@ -32,15 +30,15 @@ module Bugsnag
|
|
32
30
|
@queue = Queue.new
|
33
31
|
|
34
32
|
worker_thread = Thread.new do
|
35
|
-
while x = queue.pop
|
33
|
+
while x = @queue.pop
|
36
34
|
break if x == STOP
|
37
35
|
x.call
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
39
|
at_exit do
|
42
|
-
Bugsnag.warn("Waiting for #{queue.length} outstanding request(s)") unless queue.empty?
|
43
|
-
queue.push STOP
|
40
|
+
Bugsnag.warn("Waiting for #{@queue.length} outstanding request(s)") unless @queue.empty?
|
41
|
+
@queue.push STOP
|
44
42
|
worker_thread.join
|
45
43
|
end
|
46
44
|
end
|
data/lib/bugsnag/deploy.rb
CHANGED
data/lib/bugsnag/notification.rb
CHANGED
@@ -30,7 +30,7 @@ module Bugsnag
|
|
30
30
|
CURRENT_PAYLOAD_VERSION = "2"
|
31
31
|
|
32
32
|
attr_accessor :context
|
33
|
-
|
33
|
+
attr_reader :user
|
34
34
|
attr_accessor :configuration
|
35
35
|
attr_accessor :meta_data
|
36
36
|
|
@@ -380,7 +380,7 @@ module Bugsnag
|
|
380
380
|
|
381
381
|
# Generate the stacktrace line hash
|
382
382
|
trace_hash = {}
|
383
|
-
trace_hash[:inProject] = true if
|
383
|
+
trace_hash[:inProject] = true if in_project?(file)
|
384
384
|
trace_hash[:lineNumber] = line_str.to_i
|
385
385
|
|
386
386
|
if @configuration.send_code
|
@@ -410,6 +410,17 @@ module Bugsnag
|
|
410
410
|
end.compact
|
411
411
|
end
|
412
412
|
|
413
|
+
def in_project?(line)
|
414
|
+
return false if @configuration.vendor_paths && @configuration.vendor_paths.any? do |vendor_path|
|
415
|
+
if vendor_path.is_a?(String)
|
416
|
+
line.include?(vendor_path)
|
417
|
+
else
|
418
|
+
line =~ vendor_path
|
419
|
+
end
|
420
|
+
end
|
421
|
+
@configuration.project_root && line.start_with?(@configuration.project_root.to_s)
|
422
|
+
end
|
423
|
+
|
413
424
|
def code(file, line_number, num_lines = 7)
|
414
425
|
code_hash = {}
|
415
426
|
|
data/lib/bugsnag/railtie.rb
CHANGED
@@ -69,9 +69,9 @@ module Bugsnag
|
|
69
69
|
|
70
70
|
initializer "bugsnag.use_rack_middleware" do |app|
|
71
71
|
begin
|
72
|
-
app.config.middleware.insert_after ActionDispatch::DebugExceptions,
|
72
|
+
app.config.middleware.insert_after ActionDispatch::DebugExceptions, Bugsnag::Rack
|
73
73
|
rescue
|
74
|
-
app.config.middleware.use
|
74
|
+
app.config.middleware.use Bugsnag::Rack
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -49,7 +49,7 @@ namespace :bugsnag do
|
|
49
49
|
config_command += " --app #{ENV["HEROKU_APP"]}" if ENV["HEROKU_APP"]
|
50
50
|
heroku_env = run_command.call(config_command).split(/[\n\r]/).each_with_object({}) do |c, obj|
|
51
51
|
k,v = c.split("=")
|
52
|
-
obj[k] = v.strip.empty? ? nil : v
|
52
|
+
obj[k] = (v.nil? || v.strip.empty?) ? nil : v
|
53
53
|
end
|
54
54
|
|
55
55
|
# Check for Bugsnag API key (required)
|
data/spec/notification_spec.rb
CHANGED
@@ -417,6 +417,19 @@ describe Bugsnag::Notification do
|
|
417
417
|
}
|
418
418
|
end
|
419
419
|
|
420
|
+
it "does not mark the top-most stacktrace line as inProject if it matches a vendor path" do
|
421
|
+
Bugsnag.configuration.project_root = File.expand_path('../../', __FILE__)
|
422
|
+
Bugsnag.configuration.vendor_paths = [File.expand_path('../', __FILE__)]
|
423
|
+
|
424
|
+
Bugsnag.notify(BugsnagTestException.new("It crashed"))
|
425
|
+
|
426
|
+
expect(Bugsnag).to have_sent_notification{ |payload|
|
427
|
+
exception = get_exception_from_payload(payload)
|
428
|
+
expect(exception["stacktrace"].size).to be >= 1
|
429
|
+
expect(exception["stacktrace"].first["inProject"]).to be_nil
|
430
|
+
}
|
431
|
+
end
|
432
|
+
|
420
433
|
it "marks the top-most stacktrace line as inProject if necessary" do
|
421
434
|
Bugsnag.configuration.project_root = File.expand_path File.dirname(__FILE__)
|
422
435
|
Bugsnag.notify(BugsnagTestException.new("It crashed"))
|
data/spec/spec_helper.rb
CHANGED
@@ -27,12 +27,12 @@ RSpec.configure do |config|
|
|
27
27
|
WebMock.stub_request(:post, "https://notify.bugsnag.com/")
|
28
28
|
|
29
29
|
Bugsnag.instance_variable_set(:@configuration, Bugsnag::Configuration.new)
|
30
|
-
Bugsnag.configure do |
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
Bugsnag.configure do |bugsnag|
|
31
|
+
bugsnag.api_key = "c9d60ae4c7e70c4b6c4ebd3e8056d2b8"
|
32
|
+
bugsnag.release_stage = "production"
|
33
|
+
bugsnag.delivery_method = :synchronous
|
34
34
|
# silence logger in tests
|
35
|
-
|
35
|
+
bugsnag.logger = Logger.new(StringIO.new)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,103 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
|
-
- -
|
20
|
+
- - '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.7.7
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.7'
|
30
|
-
- -
|
30
|
+
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.7.7
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - '>='
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rdoc
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: pry
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - '>='
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: webmock
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - '>='
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
description: Ruby notifier for bugsnag.com
|
@@ -108,10 +108,10 @@ extra_rdoc_files:
|
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
110
|
files:
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
111
|
+
- .document
|
112
|
+
- .gitignore
|
113
|
+
- .rspec
|
114
|
+
- .travis.yml
|
115
115
|
- CHANGELOG.md
|
116
116
|
- CONTRIBUTING.md
|
117
117
|
- Gemfile
|
@@ -120,6 +120,9 @@ files:
|
|
120
120
|
- Rakefile
|
121
121
|
- VERSION
|
122
122
|
- bugsnag.gemspec
|
123
|
+
- docs/Configuration.md
|
124
|
+
- docs/Notification Options.md
|
125
|
+
- docs/README.md
|
123
126
|
- lib/bugsnag.rb
|
124
127
|
- lib/bugsnag/capistrano.rb
|
125
128
|
- lib/bugsnag/capistrano2.rb
|
@@ -181,17 +184,17 @@ require_paths:
|
|
181
184
|
- lib
|
182
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
183
186
|
requirements:
|
184
|
-
- -
|
187
|
+
- - '>='
|
185
188
|
- !ruby/object:Gem::Version
|
186
189
|
version: '0'
|
187
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
191
|
requirements:
|
189
|
-
- -
|
192
|
+
- - '>='
|
190
193
|
- !ruby/object:Gem::Version
|
191
194
|
version: '0'
|
192
195
|
requirements: []
|
193
196
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.0.14
|
195
198
|
signing_key:
|
196
199
|
specification_version: 4
|
197
200
|
summary: Ruby notifier for bugsnag.com
|