bugsnag 2.6.1 → 2.7.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/CHANGELOG.md +7 -0
- data/VERSION +1 -1
- data/bugsnag.gemspec +0 -4
- data/lib/bugsnag/capistrano.rb +0 -1
- data/lib/bugsnag/delivery/synchronous.rb +28 -3
- data/lib/bugsnag/delivery/thread_queue.rb +2 -2
- data/lib/bugsnag/deploy.rb +16 -27
- data/lib/bugsnag/helpers.rb +0 -8
- data/lib/bugsnag/middleware/rack_request.rb +1 -1
- data/lib/bugsnag/notification.rb +1 -7
- data/spec/integration_spec.rb +52 -0
- data/spec/notification_spec.rb +0 -65
- metadata +2 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d479bf3d15d3a4185dfca6ac8c399babd8a1f0f
|
4
|
+
data.tar.gz: 6ea73f53d27cba623b393fea905a964b21b1e217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27994f415bc764ddb82ef036549dc49eca2b05a66aa3a802a9163791d6da30cfe8594c5c81445047530e5a10c3cc76ce4fe76e5b8a141351a81a029d940c709c
|
7
|
+
data.tar.gz: 61885434f5f97dae81e95db08405a8ae27c1076e3a2312ebd4234372845594f8ee3e8768865ad0b830d58545445a626e32a1efbc3659c8d7038b8f0a89daf1f9
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
2.7.0
|
5
|
+
-----
|
6
|
+
- Fix configuration of http timeouts
|
7
|
+
- Fix configuration of http proxies
|
8
|
+
- Remove dependency on httparty
|
9
|
+
- Allow for symbols in rack env
|
10
|
+
|
4
11
|
2.6.1
|
5
12
|
-----
|
6
13
|
- Fix Ruby 1.8 payload delivery bug (thanks @colin!)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.0
|
data/bugsnag.gemspec
CHANGED
@@ -20,11 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency 'multi_json', ["~> 1.0"]
|
21
21
|
|
22
22
|
if RUBY_VERSION < "1.9"
|
23
|
-
# Use ruby 1.8 compatible httparty
|
24
|
-
s.add_runtime_dependency 'httparty', ["< 0.12.0", ">= 0.6"]
|
25
23
|
s.add_development_dependency "rake", "~> 10.1.1"
|
26
24
|
else
|
27
|
-
s.add_runtime_dependency 'httparty', ["< 1.0", ">= 0.6"]
|
28
25
|
s.add_development_dependency 'rake'
|
29
26
|
end
|
30
27
|
|
@@ -33,4 +30,3 @@ Gem::Specification.new do |s|
|
|
33
30
|
s.add_development_dependency 'pry'
|
34
31
|
s.add_development_dependency 'webmock'
|
35
32
|
end
|
36
|
-
|
data/lib/bugsnag/capistrano.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
require "net/https"
|
2
|
+
require "uri"
|
3
|
+
|
1
4
|
module Bugsnag
|
2
5
|
module Delivery
|
3
6
|
class Synchronous
|
4
7
|
HEADERS = {"Content-Type" => "application/json"}
|
5
|
-
TIMEOUT = 5
|
6
8
|
|
7
9
|
class << self
|
8
|
-
def deliver(url, body)
|
10
|
+
def deliver(url, body, configuration)
|
9
11
|
begin
|
10
|
-
response =
|
12
|
+
response = request(url, body, configuration)
|
11
13
|
Bugsnag.debug("Notification to #{url} finished, response was #{response.code}, payload was #{body}")
|
12
14
|
rescue StandardError => e
|
13
15
|
# KLUDGE: Since we don't re-raise http exceptions, this breaks rspec
|
@@ -17,6 +19,29 @@ module Bugsnag
|
|
17
19
|
Bugsnag.warn(e.backtrace)
|
18
20
|
end
|
19
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def request(url, body, configuration)
|
26
|
+
uri = URI.parse(url)
|
27
|
+
http = Net::HTTP.new(uri.host, uri.port, configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password)
|
28
|
+
http.read_timeout = configuration.timeout
|
29
|
+
http.open_timeout = configuration.timeout
|
30
|
+
|
31
|
+
if uri.scheme == "https"
|
32
|
+
http.use_ssl = true
|
33
|
+
# the default in 1.9+, but required for 1.8
|
34
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
35
|
+
end
|
36
|
+
|
37
|
+
request = Net::HTTP::Post.new(path(uri), HEADERS)
|
38
|
+
request.body = body
|
39
|
+
http.request(request)
|
40
|
+
end
|
41
|
+
|
42
|
+
def path(uri)
|
43
|
+
uri.path == "" ? "/" : uri.path
|
44
|
+
end
|
20
45
|
end
|
21
46
|
end
|
22
47
|
end
|
@@ -7,14 +7,14 @@ module Bugsnag
|
|
7
7
|
STOP = Object.new
|
8
8
|
|
9
9
|
class << self
|
10
|
-
def deliver(url, body)
|
10
|
+
def deliver(url, body, configuration)
|
11
11
|
if queue.length > MAX_OUTSTANDING_REQUESTS
|
12
12
|
Bugsnag.warn("Dropping notification, #{queue.length} outstanding requests")
|
13
13
|
return
|
14
14
|
end
|
15
15
|
|
16
16
|
# Add delivery to the worker thread
|
17
|
-
queue.push proc { super(url, body) }
|
17
|
+
queue.push proc { super(url, body, configuration) }
|
18
18
|
|
19
19
|
# Make sure the worker thread is started
|
20
20
|
ensure_worker_thread_started
|
data/lib/bugsnag/deploy.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require "net/http"
|
2
|
-
require "uri"
|
3
1
|
require "bugsnag"
|
4
2
|
|
5
3
|
module Bugsnag
|
6
4
|
class Deploy
|
7
5
|
def self.notify(opts = {})
|
8
|
-
opts[:api_key] ||= Bugsnag.configuration.api_key
|
9
|
-
opts[:release_stage] ||= "production"
|
10
|
-
opts[:endpoint] ||= Bugsnag.configuration.endpoint
|
11
|
-
opts[:use_ssl] = Bugsnag.configuration.use_ssl if opts[:use_ssl] == nil
|
12
|
-
opts[:proxy_host] ||= Bugsnag.configuration.proxy_host
|
13
|
-
opts[:proxy_port] ||= Bugsnag.configuration.proxy_port
|
14
|
-
opts[:proxy_user] ||= Bugsnag.configuration.proxy_user
|
15
|
-
opts[:proxy_password] ||= Bugsnag.configuration.proxy_password
|
16
6
|
|
17
|
-
|
7
|
+
configuration = Bugsnag.configuration.dup
|
8
|
+
|
9
|
+
# update configuration based on parameters passed in
|
10
|
+
[:api_key, :app_version, :release_stage, :endpoint, :use_ssl,
|
11
|
+
:proxy_host, :proxy_port, :proxy_user, :proxy_password].each do |param|
|
12
|
+
unless opts[param].nil?
|
13
|
+
configuration.send :"#{param}=", opts[param]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
endpoint = (configuration.use_ssl ? "https://" : "http://") + configuration.endpoint + "/deploy"
|
18
18
|
|
19
19
|
parameters = {
|
20
|
-
"apiKey" =>
|
21
|
-
"releaseStage" =>
|
22
|
-
"appVersion" =>
|
20
|
+
"apiKey" => configuration.api_key,
|
21
|
+
"releaseStage" => configuration.release_stage,
|
22
|
+
"appVersion" => configuration.app_version,
|
23
23
|
"revision" => opts[:revision],
|
24
24
|
"repository" => opts[:repository],
|
25
25
|
"branch" => opts[:branch]
|
@@ -27,19 +27,8 @@ module Bugsnag
|
|
27
27
|
|
28
28
|
raise RuntimeError.new("No API key found when notifying of deploy") if !parameters["apiKey"] || parameters["apiKey"].empty?
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
req.set_form_data(parameters)
|
33
|
-
http = Net::HTTP.new(
|
34
|
-
uri.host,
|
35
|
-
uri.port,
|
36
|
-
opts[:proxy_host],
|
37
|
-
opts[:proxy_port],
|
38
|
-
opts[:proxy_user],
|
39
|
-
opts[:proxy_password]
|
40
|
-
)
|
41
|
-
http.use_ssl = true if opts[:use_ssl]
|
42
|
-
http.request(req)
|
30
|
+
payload_string = Bugsnag::Helpers.dump_json(parameters)
|
31
|
+
Bugsnag::Delivery::Synchronous.deliver(endpoint, payload_string, configuration)
|
43
32
|
end
|
44
33
|
end
|
45
34
|
end
|
data/lib/bugsnag/helpers.rb
CHANGED
data/lib/bugsnag/notification.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
require "httparty"
|
2
1
|
require "multi_json"
|
3
2
|
require "pathname"
|
4
3
|
|
5
4
|
module Bugsnag
|
6
5
|
class Notification
|
7
|
-
include HTTParty
|
8
|
-
|
9
6
|
NOTIFIER_NAME = "Ruby Bugsnag Notifier"
|
10
7
|
NOTIFIER_VERSION = Bugsnag::VERSION
|
11
8
|
NOTIFIER_URL = "http://www.bugsnag.com"
|
@@ -40,7 +37,7 @@ module Bugsnag
|
|
40
37
|
payload_string = Bugsnag::Helpers.dump_json(payload)
|
41
38
|
end
|
42
39
|
|
43
|
-
Bugsnag::Delivery[delivery_method || configuration.delivery_method].deliver(url, payload_string)
|
40
|
+
Bugsnag::Delivery[delivery_method || configuration.delivery_method].deliver(url, payload_string, configuration)
|
44
41
|
end
|
45
42
|
end
|
46
43
|
|
@@ -101,9 +98,6 @@ module Bugsnag
|
|
101
98
|
ex = nil
|
102
99
|
end
|
103
100
|
end
|
104
|
-
|
105
|
-
self.class.http_proxy(configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password) if configuration.proxy_host
|
106
|
-
self.class.default_timeout(configuration.timeout) if configuration.timeout
|
107
101
|
end
|
108
102
|
|
109
103
|
# Add a single value as custom data, to this notification
|
data/spec/integration_spec.rb
CHANGED
@@ -31,4 +31,56 @@ describe 'Bugsnag' do
|
|
31
31
|
|
32
32
|
expect(request['events'][0]['exceptions'][0]['message']).to eq('yo')
|
33
33
|
end
|
34
|
+
|
35
|
+
it 'should send deploys over the wire' do
|
36
|
+
Bugsnag.configure do |config|
|
37
|
+
config.endpoint = "localhost:#{server.config[:Port]}"
|
38
|
+
config.use_ssl = false
|
39
|
+
end
|
40
|
+
WebMock.allow_net_connect!
|
41
|
+
|
42
|
+
Bugsnag::Deploy.notify :app_version => '1.1.1'
|
43
|
+
|
44
|
+
expect(request['appVersion']).to eq('1.1.1')
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'with a proxy' do
|
48
|
+
proxy = nil
|
49
|
+
pqueue = Queue.new
|
50
|
+
|
51
|
+
before do
|
52
|
+
proxy = WEBrick::HTTPServer.new :Port => 0, :Logger => WEBrick::Log.new("/dev/null"), :AccessLog => []
|
53
|
+
proxy.mount_proc '/' do |req, res|
|
54
|
+
pqueue.push req
|
55
|
+
res.status = 200
|
56
|
+
res.body = "OK\n"
|
57
|
+
end
|
58
|
+
Thread.new{ proxy.start }
|
59
|
+
end
|
60
|
+
after do
|
61
|
+
proxy.stop
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:proxied_request) { pqueue.pop }
|
65
|
+
|
66
|
+
it 'should use a proxy when configured' do
|
67
|
+
Bugsnag.configure do |config|
|
68
|
+
|
69
|
+
config.endpoint = "localhost:#{server.config[:Port]}"
|
70
|
+
config.use_ssl = false
|
71
|
+
|
72
|
+
config.proxy_host = 'localhost'
|
73
|
+
config.proxy_port = proxy.config[:Port]
|
74
|
+
config.proxy_user = 'conrad'
|
75
|
+
config.proxy_password = '$ecret'
|
76
|
+
end
|
77
|
+
|
78
|
+
Bugsnag.notify 'oy'
|
79
|
+
|
80
|
+
r = proxied_request
|
81
|
+
|
82
|
+
expect(r.header['proxy-authorization'].first).to eq("Basic Y29ucmFkOiRlY3JldA==")
|
83
|
+
expect(r.request_line).to eq("POST http://localhost:#{server.config[:Port]}/ HTTP/1.1\r\n")
|
84
|
+
end
|
85
|
+
end
|
34
86
|
end
|
data/spec/notification_spec.rb
CHANGED
@@ -645,71 +645,6 @@ describe Bugsnag::Notification do
|
|
645
645
|
}
|
646
646
|
end
|
647
647
|
|
648
|
-
it "uses a proxy host if configured" do
|
649
|
-
Bugsnag.configure do |config|
|
650
|
-
config.proxy_host = "host_name"
|
651
|
-
end
|
652
|
-
|
653
|
-
expect(Bugsnag::Notification).to receive(:http_proxy) do |*args|
|
654
|
-
expect(args.length).to eq(4)
|
655
|
-
expect(args[0]).to eq("host_name")
|
656
|
-
expect(args[1]).to eq(nil)
|
657
|
-
expect(args[2]).to eq(nil)
|
658
|
-
expect(args[3]).to eq(nil)
|
659
|
-
end
|
660
|
-
|
661
|
-
notify_test_exception
|
662
|
-
end
|
663
|
-
|
664
|
-
it "uses a proxy host/port if configured" do
|
665
|
-
Bugsnag.configure do |config|
|
666
|
-
config.proxy_host = "host_name"
|
667
|
-
config.proxy_port = 1234
|
668
|
-
end
|
669
|
-
|
670
|
-
expect(Bugsnag::Notification).to receive(:http_proxy) do |*args|
|
671
|
-
expect(args.length).to eq(4)
|
672
|
-
expect(args[0]).to eq("host_name")
|
673
|
-
expect(args[1]).to eq(1234)
|
674
|
-
expect(args[2]).to eq(nil)
|
675
|
-
expect(args[3]).to eq(nil)
|
676
|
-
end
|
677
|
-
|
678
|
-
notify_test_exception
|
679
|
-
end
|
680
|
-
|
681
|
-
it "uses a proxy host/port/user/pass if configured" do
|
682
|
-
Bugsnag.configure do |config|
|
683
|
-
config.proxy_host = "host_name"
|
684
|
-
config.proxy_port = 1234
|
685
|
-
config.proxy_user = "user"
|
686
|
-
config.proxy_password = "password"
|
687
|
-
end
|
688
|
-
|
689
|
-
expect(Bugsnag::Notification).to receive(:http_proxy) do |*args|
|
690
|
-
expect(args.length).to eq(4)
|
691
|
-
expect(args[0]).to eq("host_name")
|
692
|
-
expect(args[1]).to eq(1234)
|
693
|
-
expect(args[2]).to eq("user")
|
694
|
-
expect(args[3]).to eq("password")
|
695
|
-
end
|
696
|
-
|
697
|
-
notify_test_exception
|
698
|
-
end
|
699
|
-
|
700
|
-
it "sets the timeout time to the value in the configuration" do
|
701
|
-
Bugsnag.configure do |config|
|
702
|
-
config.timeout = 10
|
703
|
-
end
|
704
|
-
|
705
|
-
expect(Bugsnag::Notification).to receive(:default_timeout) do |*args|
|
706
|
-
expect(args.length).to eq(1)
|
707
|
-
expect(args[0]).to eq(10)
|
708
|
-
end
|
709
|
-
|
710
|
-
notify_test_exception
|
711
|
-
end
|
712
|
-
|
713
648
|
it "should fix invalid utf8" do
|
714
649
|
invalid_data = "fl\xc3ff"
|
715
650
|
invalid_data.force_encoding('BINARY') if invalid_data.respond_to?(:force_encoding)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -24,26 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: httparty
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.0'
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '0.6'
|
37
|
-
type: :runtime
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '1.0'
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.6'
|
47
27
|
- !ruby/object:Gem::Dependency
|
48
28
|
name: rake
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|