airbrake 4.1.0 → 4.2.0

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
  SHA1:
3
- metadata.gz: 92520a721aab5d73da3d97a7014615e3488fad82
4
- data.tar.gz: 0b6fa7570aec43283532474d468eeda973d4b45b
3
+ metadata.gz: ded8541777d75a9ba2c09642bdd86597ea50a27b
4
+ data.tar.gz: 906c8494c89ba2eea2e11ccac54aeba0b8c2a8c9
5
5
  SHA512:
6
- metadata.gz: d36f715cdaef5b5f3af800ec998df09fcd55ce2304b76879df71dd8a68b42202871b4b4443beda2a7c8071f677a14941915ce91cd92ec3908fa515004589df41
7
- data.tar.gz: ae00ca913a519e76a6fa8fb7fe31f8daf4a9d9daf94db4d97953d654ab1b8ece9a8b4bd61f656420609c9a1c9f5b53f857e8dff2d58ec1fb43ff1746e71f7869
6
+ metadata.gz: ec4e5304b839b160469c95ee8fd7865854710d68bc98aca71cf7d31ddf5b998c30da88b37413ad85aeafc29a3785a13e087b7e1c0cf54bd32c09bf3034e31a7a
7
+ data.tar.gz: 3a111f2210212d4cf7df1f66030949ef623cc7a56242b636f12637330a2a81261013e9af286e5fb59a52ff172ccd04ff2055764f7c3724f1c686f60f9b4c46b3
data/CHANGELOG CHANGED
@@ -1,3 +1,74 @@
1
+ Version 4.2.0 - 2015-05-27 19:05:32 -0500
2
+ ===============================================================================
3
+
4
+ Abdelkader Boudih (1):
5
+ Update sidekiq.rb
6
+
7
+ Adam King (1):
8
+ Fix DEFAULT_BACKTRACE_FILTERS bug that caused backtrace to not show up in certain contexts. See https://github.com/airbrake/airbrake/issues/343.
9
+
10
+ David (8):
11
+ Merge pull request #329 from grosser/grosser/gemspec
12
+ Merge pull request #335 from airbrake/fix/cucumber-suite
13
+ Merge pull request #327 from airbrake/feature/faster-params-cleaning
14
+ Merge pull request #337 from airbrake/fix/rails4-is-here
15
+ Merge pull request #326 from airbrake/fix/cast-ENV-to-Hash
16
+ Merge pull request #328 from grosser/grosser/dup
17
+ Merge pull request #334 from airbrake/fix/user-info-consumes-db-connections
18
+ Merge pull request #340 from grosser/grosser/dup
19
+
20
+ David Palm (9):
21
+ Cast CGI data to hash, as that's what the code really expects
22
+ Speed up notice generation by avoiding copying data and putting most common cases on top
23
+ Refactor #airbrake_current_user
24
+ Typo
25
+ Add comment explaining why we release connections
26
+ Comment out @wip scenarios to facilitate running parts of the suite
27
+ Add 4 to version sniffing code
28
+ PR feedback
29
+ Clone to ensure we do not mess with the provided data
30
+
31
+ Eero Raun (1):
32
+ Ignore RACK_ENV if it is empty (capistrano deploy), fixes #341.
33
+
34
+ Jonathan Worek (1):
35
+ Assumption of existence of :app role may not be valid
36
+
37
+ Marko Šiftar (3):
38
+ Merge pull request #354 from wojobucco/patch-1
39
+ Merge pull request #342 from oree/341
40
+ Merge pull request #382 from airbrake/fix/use-proper-capistrano-hook
41
+
42
+ Martin Tepper (1):
43
+ This should fix #369
44
+
45
+ grosser (3):
46
+ cleanup gemspec
47
+ fix having symbols in the environment blows up filter_parameters with blocks
48
+ If we cannot stringify then at least rescue the dup exceptions ...
49
+
50
+ halida (1):
51
+ fix rails request.fullpath behavior change in 4.1.6 -- no longer has leading /
52
+
53
+ shifi (17):
54
+ add test for filtering frozen objects
55
+ Merge branch 'Promptus-issue_369_frozen_array_issue'
56
+ update Appraisals file
57
+ Merge branch 'master' of https://github.com/halida/airbrake into halida-master
58
+ remove whitespaces
59
+ add test for airbrake_request_url
60
+ Merge branch 'halida-master'
61
+ update year in license and readme
62
+ use proper capistrano hook depending on capistrano version
63
+ set localhost IP to satisfy web console when testing in development
64
+ Merge branch 'patch-1' of https://github.com/seuros/airbrake into seuros-patch-1
65
+ fix syntax error in Sidekiq configuration
66
+ Merge branch 'seuros-patch-1'
67
+ Merge branch 'master' of https://github.com/developwithvelocity/airbrake into developwithvelocity-master
68
+ tests for backtrace default filters - gem paths
69
+ Merge branch 'developwithvelocity-master'
70
+
71
+
1
72
  Version 4.1.0 - 2014-09-04 23:16:08 +0200
2
73
  ===============================================================================
3
74
 
@@ -1443,5 +1514,6 @@ Nick Quaranto (3):
1443
1514
 
1444
1515
 
1445
1516
 
1517
+
1446
1518
 
1447
1519
 
data/LICENSE CHANGED
@@ -25,7 +25,7 @@ See https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
25
25
 
26
26
 
27
27
  All other components of this product are
28
- Copyright (c) 2007-2014 Rackspace, Inc.
28
+ Copyright (c) 2007-2015 Rackspace, Inc.
29
29
 
30
30
  Subject to the terms of this notice, Rackspace, Inc. grants you a
31
31
  nonexclusive, nontransferable license, without the right to
@@ -36,25 +36,25 @@ foregoing grant, you must provide this notice along with each copy you
36
36
  distribute and you must not remove, alter, or obscure this notice. All
37
37
  other use, reproduction, modification, distribution, or other
38
38
  exploitation of these files is strictly prohibited, except as may be set
39
- forth in a separate written license agreement between you and ERackspace,
39
+ forth in a separate written license agreement between you and ERackspace,
40
40
  Inc. The terms of any such license agreement will control over this
41
41
  notice. The license stated above will be automatically terminated and
42
42
  revoked if you exceed its scope or violate any of the terms of this
43
43
  notice.
44
44
 
45
45
  This License does not grant permission to use the trade names,
46
- trademarks, service marks, or product names of Rackspace, Inc.,
47
- Airbrake, Exceptional, Airbrake.io, Exceptional.io except as
48
- required for reasonable and customary use in describing the origin
49
- of this file and reproducing the content of this notice. You may
50
- not mark or brand this file with any trade name, trademarks,
51
- servicemarks, or product names other than the original brand
46
+ trademarks, service marks, or product names of Rackspace, Inc.,
47
+ Airbrake, Exceptional, Airbrake.io, Exceptional.io except as
48
+ required for reasonable and customary use in describing the origin
49
+ of this file and reproducing the content of this notice. You may
50
+ not mark or brand this file with any trade name, trademarks,
51
+ servicemarks, or product names other than the original brand
52
52
  (if any)provided by Rackspace, Inc.
53
53
 
54
- Unless otherwise expressly agreed by Rackspace, Inc., in a
54
+ Unless otherwise expressly agreed by Rackspace, Inc., in a
55
55
  separate written license agreement, these files are provided AS IS,
56
56
  WITHOUT WARRANTY OF ANY KIND, including without any implied warranties
57
- of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT.
57
+ of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT.
58
58
  As a condition to your use of these files, you are solely responsible for
59
59
  such use. Rackspace, Inc. will have no liability to you for direct,
60
60
  indirect, consequential, incidental, special, or punitive damages or
data/README.md CHANGED
@@ -145,4 +145,4 @@ The names and logos for Airbrake, thoughtbot are trademarks of their respective
145
145
  License
146
146
  -------
147
147
 
148
- Airbrake is Copyright © 2008-2013 Airbrake.
148
+ Airbrake is Copyright © 2008-2015 Airbrake.
data/Rakefile CHANGED
@@ -1,16 +1,11 @@
1
- require 'rubygems'
1
+ require 'rubygems' unless RUBY_VERSION > "1.8"
2
2
  require 'bundler/setup'
3
3
  require 'appraisal'
4
4
  require 'rake'
5
5
  require 'rake/testtask'
6
6
  require 'coveralls/rake/task'
7
7
  require 'rubygems/package_task'
8
- begin
9
- require 'cucumber/rake/task'
10
- rescue LoadError
11
- $stderr.puts "Please install cucumber: `gem install cucumber`"
12
- exit 1
13
- end
8
+ require 'cucumber/rake/task'
14
9
  require './lib/airbrake/version'
15
10
 
16
11
  Coveralls::RakeTask.new
@@ -1,14 +1,11 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "airbrake/version"
1
+ require "./lib/airbrake/version"
4
2
 
5
3
  Gem::Specification.new do |s|
6
- s.name = %q{airbrake}
4
+ s.name = "airbrake"
7
5
  s.version = Airbrake::VERSION.dup
8
- s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
9
- s.license = %q{MIT}
6
+ s.summary = "Send your application errors to our hosted service and reclaim your inbox."
7
+ s.license = "MIT"
10
8
 
11
- s.require_paths = ["lib"]
12
9
  s.executables << "airbrake"
13
10
  s.files = Dir["{generators/**/*,lib/**/*,rails/**/*,resources/*,script/*}"] +
14
11
  %w(airbrake.gemspec CHANGELOG Gemfile Guardfile INSTALL LICENSE Rakefile README_FOR_HEROKU_ADDON.md README.md TESTED_AGAINST install.rb)
@@ -35,10 +32,10 @@ Gem::Specification.new do |s|
35
32
  s.add_development_dependency("pry")
36
33
  s.add_development_dependency("coveralls")
37
34
  s.add_development_dependency("minitest", ["~> 4.0"])
35
+ s.add_development_dependency("test-unit")
36
+
38
37
 
39
38
  s.authors = ["Airbrake"]
40
- s.email = %q{support@airbrake.io}
39
+ s.email = "support@airbrake.io"
41
40
  s.homepage = "http://www.airbrake.io"
42
-
43
- s.platform = Gem::Platform::RUBY
44
41
  end
@@ -81,30 +81,30 @@ Feature: Install the Gem in a Rails application
81
81
  And I run `rails generate airbrake -k myapikey`
82
82
  Then "config/deploy.rb" should not contain "capistrano"
83
83
 
84
- @wip
85
- Scenario: Support the Heroku addon in the generator
86
- When I configure the Airbrake shim
87
- And I run `rails generate airbrake -k myapikey -t`
88
- And I configure the Heroku shim with "myapikey"
89
- And I successfully run `rails generate airbrake --heroku`
90
- Then I should receive a Airbrake notification
91
- And I should see the Rails version
92
- And my Airbrake configuration should contain the following line:
93
- """
94
- config.api_key = ENV['HOPTOAD_API_KEY']
95
- """
84
+ # @wip
85
+ # Scenario: Support the Heroku addon in the generator
86
+ # When I configure the Airbrake shim
87
+ # And I run `rails generate airbrake -k myapikey -t`
88
+ # And I configure the Heroku shim with "myapikey"
89
+ # And I run `rails generate airbrake --heroku`
90
+ # Then I should receive a Airbrake notification
91
+ # And I should see the Rails version
92
+ # And my Airbrake configuration should contain the following line:
93
+ # """
94
+ # config.api_key = 'myapikey'
95
+ # """
96
96
 
97
- @wip
98
- Scenario: Support the --app option for the Heroku addon in the generator
99
- When I configure the Airbrake shim
100
- And I configure the Heroku shim with "myapikey" and multiple app support
101
- And I run `rails generate airbrake --heroku -a myapp -t`
102
- Then I should receive a Airbrake notification
103
- And I should see the Rails version
104
- And my Airbrake configuration should contain the following line:
105
- """
106
- config.api_key = ENV['HOPTOAD_API_KEY']
107
- """
97
+ # @wip
98
+ # Scenario: Support the --app option for the Heroku addon in the generator
99
+ # When I configure the Airbrake shim
100
+ # And I configure the Heroku shim with "myapikey" and multiple app support
101
+ # And I run `rails generate airbrake --heroku -a myapp -t`
102
+ # Then I should receive a Airbrake notification
103
+ # And I should see the Rails version
104
+ # And my Airbrake configuration should contain the following line:
105
+ # """
106
+ # config.api_key = 'myapikey'
107
+ # """
108
108
 
109
109
  Scenario: Filtering parameters in a controller
110
110
  When I configure the Airbrake shim
@@ -165,6 +165,25 @@ Feature: Install the Gem in a Rails application
165
165
  Then I should receive a Airbrake notification
166
166
  And the Airbrake notification should not contain any of the sensitive Rack variables
167
167
 
168
+ Scenario: Filtering vs symbols
169
+ When I configure the Airbrake shim
170
+ And I run `rails generate airbrake -k myapikey -t`
171
+ When I configure the notifier to use the following configuration lines:
172
+ """
173
+ config.api_key = "myapikey"
174
+ config.logger = Logger.new STDOUT
175
+ """
176
+ And I configure the application to filter parameter "block"
177
+ And I define a response for "TestController#index":
178
+ """
179
+ request.env["foo"] = {:foo => "bar"}
180
+ raise RuntimeError, "some message"
181
+ """
182
+ And I route "/test/index" to "test#index"
183
+ And I perform a request to "http://example.com:123/test/index" in the "production" environment
184
+ Then I should receive a Airbrake notification
185
+ And the Airbrake notification should contain "some message"
186
+
168
187
  Scenario: Notify airbrake within the controller
169
188
  When I configure the Airbrake shim
170
189
  And I run `rails generate airbrake -k myapikey -t`
@@ -27,7 +27,7 @@ Feature: Use the Gem to catch errors in a Rake application
27
27
  When I run rake with airbrake autodetect not from terminal
28
28
  Then Airbrake should catch the exception
29
29
 
30
- @wip
31
- Scenario: Airbrake should also send the command name
32
- When I run `rake airbrake_autodetect_not_from_terminal`
33
- Then command "airbrake_autodetect_not_from_terminal" should be reported
30
+ # @wip
31
+ # Scenario: Airbrake should also send the command name
32
+ # When I run `rake airbrake_autodetect_not_from_terminal`
33
+ # Then command "airbrake_autodetect_not_from_terminal" should be reported
@@ -184,8 +184,8 @@ When /^I configure the application to filter parameter "([^\"]*)"$/ do |paramete
184
184
  application_definition_line = application_lines.detect { |line| line =~ /Application/ }
185
185
  application_definition_line_index = application_lines.index(application_definition_line)
186
186
 
187
- application_lines.insert(application_definition_line_index + 1,
188
- " config.filter_parameters += [#{parameter.inspect}]")
187
+ parameter = (parameter == "block" ? "lambda { |x,y| x }" : parameter.inspect)
188
+ application_lines.insert(application_definition_line_index + 1, " config.filter_parameters += [#{parameter}]")
189
189
 
190
190
  File.open(application_filename, "w") do |file|
191
191
  file.puts application_lines.join("\n")
@@ -24,8 +24,8 @@ module RailsHelpers
24
24
  controller_filename = File.join(rails_root, 'app', 'controllers', "application_controller.rb")
25
25
  end
26
26
 
27
- def rails3?
28
- rails_version =~ /^3/
27
+ def rails_3_or_4?
28
+ rails_version =~ /\A[34]/
29
29
  end
30
30
 
31
31
  def rails_root
@@ -33,7 +33,7 @@ module RailsHelpers
33
33
  end
34
34
 
35
35
  def rails_uses_rack?
36
- rails3? || rails_version =~ /^2\.3/
36
+ rails_3_or_4? || rails_version =~ /^2\.3/
37
37
  end
38
38
 
39
39
  def rails_version
@@ -58,15 +58,15 @@ module RailsHelpers
58
58
  end
59
59
 
60
60
  def rails_manages_gems?
61
- rails_version =~ /^2\.[123]/
61
+ rails_version =~ /\A2\.[123]/
62
62
  end
63
63
 
64
64
  def rails_supports_initializers?
65
- rails3? || rails_version =~ /^2\./
65
+ rails_3_or_4? || rails_version =~ /\A2\./
66
66
  end
67
67
 
68
68
  def rails_finds_generators_in_gems?
69
- rails3? || rails_version =~ /^2\./
69
+ rails_3_or_4? || rails_version =~ /\A2\./
70
70
  end
71
71
 
72
72
  def version_string
@@ -71,13 +71,13 @@ module Airbrake
71
71
  - Run remotely so we use remote API keys, environment, etc.
72
72
  DESC
73
73
  task :deploy, :except => { :no_release => true } do
74
- rack_env = fetch(:rack_env, "production")
75
- rails_env = fetch(:rails_env, "production")
76
- airbrake_env = fetch(:airbrake_env, rack_env || rails_env)
74
+ rack_env = fetch(:rack_env, nil)
75
+ rails_env = fetch(:rails_env, nil)
76
+ airbrake_env = fetch(:airbrake_env, rack_env || rails_env || "production")
77
77
  local_user = ENV['USER'] || ENV['USERNAME']
78
78
  executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'bundle exec rake ')
79
79
  directory = configuration.release_path
80
- notify_command = "cd #{directory}; #{executable} RACK_ENV=#{rack_env} RAILS_ENV=#{rails_env} airbrake:deploy TO=#{airbrake_env} REVISION=#{current_revision} REPO=#{repository} USER=#{Airbrake::Capistrano::shellescape(local_user)}"
80
+ notify_command = "cd #{directory}; #{executable} #{'RACK_ENV='+rack_env if rack_env} #{'RAILS_ENV='+rails_env if rails_env} airbrake:deploy TO=#{airbrake_env} REVISION=#{current_revision} REPO=#{repository} USER=#{Airbrake::Capistrano::shellescape(local_user)}"
81
81
  notify_command << " DRY_RUN=true" if dry_run
82
82
  notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
83
83
  logger.info "Notifying Airbrake of Deploy (#{notify_command})"
@@ -130,11 +130,8 @@ module Airbrake
130
130
  },
131
131
  lambda { |line| line.gsub(/^\.\//, "") },
132
132
  lambda { |line|
133
- if defined?(Gem)
134
- Gem.path.inject(line) do |l, path|
135
- l.gsub(/#{path}/, "[GEM_ROOT]")
136
- end
137
- end
133
+ Gem.path.each{ |path| line.sub!(/#{path}/, "[GEM_ROOT]") unless path.to_s.strip.empty? } if defined?(Gem)
134
+ line
138
135
  },
139
136
  lambda { |line| line if line !~ %r{lib/airbrake} }
140
137
  ].freeze
@@ -259,7 +256,7 @@ module Airbrake
259
256
  # Determines if the notifier will send notices.
260
257
  # @return [Boolean] Returns +false+ if in a development environment, +true+ otherwise.
261
258
  def public?
262
- !development_environments.include?(environment_name)
259
+ @public ||= !development_environments.include?(environment_name)
263
260
  end
264
261
 
265
262
  def port
@@ -116,7 +116,7 @@ module Airbrake
116
116
  @action = args[:action] || parameters['action']
117
117
 
118
118
  @environment_name = args[:environment_name]
119
- @cgi_data = (args[:cgi_data] && args[:cgi_data].dup) || args[:rack_env] || {}
119
+ @cgi_data = (args[:cgi_data].respond_to?(:to_hash) && args[:cgi_data].to_hash.dup) || args[:rack_env] || {}
120
120
  @backtrace = Backtrace.parse(exception_attribute(:backtrace, caller), :filters => @backtrace_filters)
121
121
  @error_class = exception_attribute(:error_class) {|exception| exception.class.name }
122
122
  @error_message = exception_attribute(:error_message, 'Notification') do |exception|
@@ -10,7 +10,7 @@ module Airbrake
10
10
  :action => params[:action],
11
11
  :url => airbrake_request_url,
12
12
  :cgi_data => airbrake_filter_if_filtering(request.env),
13
- :user => airbrake_current_user
13
+ :user => airbrake_current_user || {}
14
14
  }
15
15
  end
16
16
 
@@ -44,20 +44,31 @@ module Airbrake
44
44
 
45
45
  if respond_to?(:filter_parameters) # Rails 2
46
46
  filter_parameters(hash)
47
- elsif rails3?
47
+ elsif rails_3_or_4?
48
48
  filter_rails3_parameters(hash)
49
49
  else
50
50
  hash
51
51
  end
52
52
  end
53
53
 
54
- def rails3?
55
- defined?(::Rails.version) && ::Rails.version =~ /\A3/
54
+ def rails_3_or_4?
55
+ defined?(::Rails.version) && ::Rails.version =~ /\A[34]/
56
56
  end
57
57
 
58
58
  def filter_rails3_parameters(hash)
59
59
  ActionDispatch::Http::ParameterFilter.new(
60
- ::Rails.application.config.filter_parameters).filter(hash)
60
+ ::Rails.application.config.filter_parameters
61
+ ).filter(recursive_stringify_keys(hash))
62
+ end
63
+
64
+ def recursive_stringify_keys(hash)
65
+ hash = hash.stringify_keys
66
+ hash.each do |k, v|
67
+ if v.is_a?(Hash)
68
+ hash[k] = v.respond_to?(:stringify_keys) ? recursive_stringify_keys(v) : nil # Rack::Session::Abstract::SessionHash has a stringify_keys method we should not call
69
+ end
70
+ end
71
+ hash
61
72
  end
62
73
 
63
74
  def airbrake_session_data
@@ -79,20 +90,34 @@ module Airbrake
79
90
  url << ":#{request.port}"
80
91
  end
81
92
 
82
- url << request.fullpath
83
- url
93
+ URI.join(url, request.fullpath).to_s
84
94
  end
85
95
 
86
96
  def airbrake_current_user
87
- user = begin current_user rescue current_member end
88
- h = {}
89
- return h if user.nil?
90
- Airbrake.configuration.user_attributes.map(&:to_sym).each do |attr|
91
- h[attr.to_sym] = user.send(attr) if user.respond_to? attr
97
+ user = fetch_user
98
+
99
+ if user
100
+ Airbrake.configuration.user_attributes.map(&:to_sym).inject({}) do |hsh, attr|
101
+ hsh[attr.to_sym] = user.send(attr) if user.respond_to? attr
102
+ hsh
103
+ end
104
+ end
105
+ end
106
+
107
+ def fetch_user
108
+ if defined?(current_user)
109
+ current_user
110
+ elsif defined?(current_member)
111
+ current_member
112
+ else
113
+ nil
114
+ end
115
+ ensure
116
+ # The Airbrake middleware is first in the chain, before ActiveRecord::ConnectionAdapters::ConnectionManagement
117
+ # kicks in to do its thing. This can cause the connection pool to run out of connections.
118
+ if defined?(ActiveRecord) && ActiveRecord::Base.respond_to?(:connection_pool)
119
+ ActiveRecord::Base.connection_pool.release_connection
92
120
  end
93
- h
94
- rescue NoMethodError, NameError
95
- {}
96
121
  end
97
122
  end
98
123
  end