appsignal 2.3.7 → 2.4.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +10 -23
  3. data/.travis.yml +5 -9
  4. data/CHANGELOG.md +12 -0
  5. data/Rakefile +2 -0
  6. data/ext/agent.yml +29 -14
  7. data/ext/extconf.rb +10 -1
  8. data/lib/appsignal.rb +2 -2
  9. data/lib/appsignal/hooks/action_cable.rb +3 -3
  10. data/lib/appsignal/hooks/rake.rb +1 -1
  11. data/lib/appsignal/integrations/grape.rb +1 -1
  12. data/lib/appsignal/integrations/padrino.rb +1 -1
  13. data/lib/appsignal/integrations/webmachine.rb +1 -1
  14. data/lib/appsignal/minutely.rb +1 -1
  15. data/lib/appsignal/rack/generic_instrumentation.rb +1 -1
  16. data/lib/appsignal/rack/rails_instrumentation.rb +1 -1
  17. data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -1
  18. data/lib/appsignal/rack/streaming_listener.rb +3 -3
  19. data/lib/appsignal/version.rb +1 -1
  20. data/resources/appsignal.yml.erb +16 -0
  21. data/spec/lib/appsignal/config_spec.rb +4 -4
  22. data/spec/lib/appsignal/hooks/action_cable_spec.rb +9 -9
  23. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +2 -2
  24. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +1 -1
  25. data/spec/lib/appsignal/hooks/rake_spec.rb +2 -2
  26. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +3 -3
  27. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -2
  28. data/spec/lib/appsignal/integrations/grape_spec.rb +3 -3
  29. data/spec/lib/appsignal/integrations/padrino_spec.rb +3 -3
  30. data/spec/lib/appsignal/integrations/resque_spec.rb +3 -3
  31. data/spec/lib/appsignal/integrations/webmachine_spec.rb +1 -1
  32. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +4 -4
  33. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +4 -4
  34. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +8 -8
  35. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +10 -11
  36. data/spec/lib/appsignal/transaction_spec.rb +2 -2
  37. data/spec/lib/appsignal_spec.rb +3 -3
  38. data/spec/support/helpers/example_exception.rb +13 -0
  39. data/spec/support/helpers/example_standard_error.rb +13 -0
  40. data/spec/support/shared_examples/instrument.rb +2 -2
  41. metadata +8 -6
  42. data/spec/support/helpers/very_specific_error.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed63c49d1dfc2fc2760647e86a0721f9a1476d8b
4
- data.tar.gz: 5af04584576a18ea0c42e2fb2a2188d0361b826b
3
+ metadata.gz: d33d7ecbdd7ba0817888cd6b6347f2e9289a627b
4
+ data.tar.gz: f9c435c47c4403295da1ff78f89d9c1ac45b67f9
5
5
  SHA512:
6
- metadata.gz: 799f054a927e0dd89a7c8775f34b91d271075c25838826589959223be286bbf6ccc8297b0ad97eac00bd1cd6bae52573380ed7b69abd87037ad70ce87552856c
7
- data.tar.gz: 719aaed0e8e4e9cc6e398f6ad7a509073e65c19d959b678221e026bc4d15bc478f7fda4541878561bf146c53668c8f8cfc657763a2c54806db2b8214662307af
6
+ metadata.gz: 957c20fa113f260bbd401e3eb95f9266b4edd03f7986a555046e86cb2266e274939691ddd8cc8583406241a06bb3cbf0201b811dbfb0f65990f8972137f8cea8
7
+ data.tar.gz: be4355279b8fffbfd45ebaf86f0b180e0311887f37051e9aed6ee69137f71c99fdb79907f18a45fc36404127f652daad51a9ee21a537a8f2e701c253dfbeb24b
@@ -1,30 +1,21 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-04-06 22:15:48 +0200 using RuboCop version 0.46.0.
3
+ # on 2017-08-15 12:46:37 +0200 using RuboCop version 0.46.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 7
9
+ # Offense count: 4
10
10
  Lint/HandleExceptions:
11
11
  Exclude:
12
12
  - 'lib/appsignal/cli/install.rb'
13
- - 'spec/lib/appsignal/hooks/shoryuken_spec.rb'
14
- - 'spec/lib/appsignal/hooks/sidekiq_spec.rb'
15
- - 'spec/lib/appsignal/integrations/resque_spec.rb'
16
-
17
- # Offense count: 4
18
- Lint/RescueException:
19
- Exclude:
20
- - 'lib/appsignal/minutely.rb'
21
- - 'lib/appsignal/rack/streaming_listener.rb'
22
13
 
23
- # Offense count: 38
14
+ # Offense count: 41
24
15
  Metrics/AbcSize:
25
- Max: 61
16
+ Max: 59
26
17
 
27
- # Offense count: 3
18
+ # Offense count: 5
28
19
  # Configuration parameters: CountComments.
29
20
  Metrics/BlockLength:
30
21
  Max: 31
@@ -42,13 +33,13 @@ Metrics/ClassLength:
42
33
  Metrics/CyclomaticComplexity:
43
34
  Max: 11
44
35
 
45
- # Offense count: 437
36
+ # Offense count: 471
46
37
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
47
38
  # URISchemes: http, https
48
39
  Metrics/LineLength:
49
- Max: 456
40
+ Max: 152
50
41
 
51
- # Offense count: 79
42
+ # Offense count: 88
52
43
  # Configuration parameters: CountComments.
53
44
  Metrics/MethodLength:
54
45
  Max: 60
@@ -63,14 +54,14 @@ Metrics/ModuleLength:
63
54
  Metrics/PerceivedComplexity:
64
55
  Max: 14
65
56
 
66
- # Offense count: 11
57
+ # Offense count: 10
67
58
  Style/AccessorMethodName:
68
59
  Exclude:
69
60
  - 'lib/appsignal.rb'
70
61
  - 'lib/appsignal/transaction.rb'
71
62
  - 'spec/support/helpers/cli_helpers.rb'
72
63
 
73
- # Offense count: 19
64
+ # Offense count: 20
74
65
  # Cop supports --auto-correct.
75
66
  # Configuration parameters: EnforcedStyle, SupportedStyles.
76
67
  # SupportedStyles: prefer_alias, prefer_alias_method
@@ -128,7 +119,3 @@ Style/IfUnlessModifier:
128
119
  Style/NonNilCheck:
129
120
  Exclude:
130
121
  - 'lib/appsignal/transaction.rb'
131
-
132
- Style/WordArray:
133
- Exclude:
134
- - 'spec/lib/appsignal/hooks/shoryuken_spec.rb'
@@ -42,6 +42,10 @@ matrix:
42
42
  gemfile: "gemfiles/no_dependencies.gemfile"
43
43
  script: "bundle exec rubocop"
44
44
  exclude:
45
+ # We don't currently support jRuby
46
+ - rvm: "jruby-19mode"
47
+
48
+ # Rails 5 doesn't support Ruby < 2.2
45
49
  - rvm: "2.0.0"
46
50
  gemfile: "gemfiles/sidekiq.gemfile"
47
51
  - rvm: "2.1.8"
@@ -52,24 +56,16 @@ matrix:
52
56
  gemfile: "gemfiles/rails-5.0.gemfile"
53
57
  - rvm: "2.1.8"
54
58
  gemfile: "gemfiles/rails-5.0.gemfile"
55
- - rvm: "jruby-19mode"
56
- gemfile: "gemfiles/rails-5.0.gemfile"
57
59
  - rvm: "2.0.0"
58
60
  gemfile: "gemfiles/rails-5.1.gemfile"
59
61
  - rvm: "2.1.8"
60
62
  gemfile: "gemfiles/rails-5.1.gemfile"
61
- - rvm: "jruby-19mode"
62
- gemfile: "gemfiles/rails-5.1.gemfile"
63
+
63
64
  allow_failures:
64
- - rvm: "jruby-19mode"
65
65
  - rvm: "2.4.0"
66
66
  gemfile: "gemfiles/rails-4.0.gemfile"
67
67
  - rvm: "2.4.0"
68
68
  gemfile: "gemfiles/rails-4.1.gemfile"
69
- - rvm: "2.4.0"
70
- gemfile: "gemfiles/rails-4.2.gemfile"
71
- - rvm: "2.4.0"
72
- gemfile: "gemfiles/resque.gemfile"
73
69
 
74
70
  env:
75
71
  global: "RAILS_ENV=test"
@@ -1,3 +1,15 @@
1
+ # 2.4.0 (alpha)
2
+ - Add separate GNU linux build. PR #351 and
3
+ Commit d1763f4dcb685608468a73f3192226f60f66b217
4
+ - Add separate FreeBSD build
5
+ Commit d1763f4dcb685608468a73f3192226f60f66b217
6
+ - Fix crashes when using a transaction from multiple processes in an
7
+ unsupported way.
8
+ Commit d1763f4dcb685608468a73f3192226f60f66b217
9
+ - Auto restart agent when none is running
10
+ Commit d1763f4dcb685608468a73f3192226f60f66b217
11
+ - Track Exception-level exceptions. PR #356
12
+
1
13
  # 2.3.7
2
14
  * Support Sidekiq delayed extension job action names better. Now action names
3
15
  are reported as their class and class method name (`MyClass.method`), rather
data/Rakefile CHANGED
@@ -178,8 +178,10 @@ namespace :extension do
178
178
  appsignal-agent \
179
179
  appsignal.h \
180
180
  appsignal_extension.o \
181
+ appsignal_extension.bundle \
181
182
  install.log \
182
183
  libappsignal.a \
184
+ appsignal.version \
183
185
  Makefile \
184
186
  mkmf.log
185
187
  COMMAND
@@ -1,18 +1,33 @@
1
1
  ---
2
- version: aa306e5
2
+ version: bd1eb5f
3
3
  triples:
4
- x86_64-linux:
5
- checksum: e6bb0fad95403828195f5e186128b6e9389b07c625b3845b52768ab8dd57cbf5
6
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/aa306e5/appsignal-x86_64-linux-all-static.tar.gz
7
- i686-linux:
8
- checksum: 05d76d816303531b4aa1905f775a0d5b8fea4e3d15b9f3b99105f499c3c549cb
9
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/aa306e5/appsignal-i686-linux-all-static.tar.gz
10
- x86-linux:
11
- checksum: 05d76d816303531b4aa1905f775a0d5b8fea4e3d15b9f3b99105f499c3c549cb
12
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/aa306e5/appsignal-i686-linux-all-static.tar.gz
13
4
  x86_64-darwin:
14
- checksum: 3f4213164491604a1381b042404967ce11225f2c5193ffa31960552ae6451a34
15
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/aa306e5/appsignal-x86_64-darwin-all-static.tar.gz
5
+ checksum: c90ed7a396d0ab6f40c50ab0379ce66deda94e5be144dd89d146e37188b21f2b
6
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-darwin-all-static.tar.gz
16
7
  universal-darwin:
17
- checksum: 3f4213164491604a1381b042404967ce11225f2c5193ffa31960552ae6451a34
18
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/aa306e5/appsignal-x86_64-darwin-all-static.tar.gz
8
+ checksum: c90ed7a396d0ab6f40c50ab0379ce66deda94e5be144dd89d146e37188b21f2b
9
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-darwin-all-static.tar.gz
10
+ i686-linux:
11
+ checksum: a5ffc5558c6b051176a1943045f91399be4a325230e4f092ac0112ed63606a05
12
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-i686-linux-all-static.tar.gz
13
+ x86-linux:
14
+ checksum: a5ffc5558c6b051176a1943045f91399be4a325230e4f092ac0112ed63606a05
15
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-i686-linux-all-static.tar.gz
16
+ i686-linux-musl:
17
+ checksum: aaee5ccd80c8dc96401182238d39cc16f5dd9566b23e0395f316f294f08cfc73
18
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-i686-linux-musl-all-static.tar.gz
19
+ x86-linux-musl:
20
+ checksum: aaee5ccd80c8dc96401182238d39cc16f5dd9566b23e0395f316f294f08cfc73
21
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-i686-linux-musl-all-static.tar.gz
22
+ x86_64-linux:
23
+ checksum: e90af03dc243a4752137018ff92b8da2eb600c5074a841aa2d996484b9315c54
24
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-linux-all-static.tar.gz
25
+ x86_64-linux-musl:
26
+ checksum: 04b0b5abffbf6c7791866558e227044bb0b823bdef0a64c4c3d5aa99d3c482d4
27
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-linux-musl-all-static.tar.gz
28
+ x86_64-freebsd:
29
+ checksum: b7c5f81aebf371c956d90a6ce88396925d3b571a2731081eaf9011d23569f574
30
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-freebsd-all-static.tar.gz
31
+ amd64-freebsd:
32
+ checksum: b7c5f81aebf371c956d90a6ce88396925d3b571a2731081eaf9011d23569f574
33
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/bd1eb5f/appsignal-x86_64-freebsd-all-static.tar.gz
@@ -9,7 +9,16 @@ require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
9
9
 
10
10
  EXT_PATH = File.expand_path("..", __FILE__).freeze
11
11
  AGENT_CONFIG = YAML.load(File.read(File.join(EXT_PATH, "agent.yml"))).freeze
12
- ARCH = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}".freeze
12
+
13
+ local_os = Gem::Platform.local.os
14
+ chosen_os =
15
+ # Detect musl platforms
16
+ # Use `export APPSIGNAL_BUILD_FOR_MUSL=1` if the detection doesn't work.
17
+ if ENV["APPSIGNAL_BUILD_FOR_MUSL"] || (local_os =~ /linux/ && `ldd --version 2>&1` =~ /musl/)
18
+ "linux-musl"
19
+ end
20
+ OS = chosen_os || local_os
21
+ ARCH = "#{Gem::Platform.local.cpu}-#{OS}".freeze
13
22
  CA_CERT_PATH = File.join(EXT_PATH, "../resources/cacert.pem").freeze
14
23
 
15
24
  def ext_path(path)
@@ -196,7 +196,7 @@ module Appsignal
196
196
  Appsignal.instrument(name) do
197
197
  yield
198
198
  end
199
- rescue => error
199
+ rescue Exception => error # rubocop:disable Lint/RescueException
200
200
  transaction.set_error(error)
201
201
  raise error
202
202
  ensure
@@ -219,7 +219,7 @@ module Appsignal
219
219
 
220
220
  def listen_for_error
221
221
  yield
222
- rescue => error
222
+ rescue Exception => error # rubocop:disable Lint/RescueException
223
223
  send_error(error)
224
224
  raise error
225
225
  end
@@ -37,7 +37,7 @@ module Appsignal
37
37
 
38
38
  begin
39
39
  original_perform_action(*args, &block)
40
- rescue => exception
40
+ rescue Exception => exception # rubocop:disable Lint/RescueException
41
41
  transaction.set_error(exception)
42
42
  raise exception
43
43
  ensure
@@ -69,7 +69,7 @@ module Appsignal
69
69
  Appsignal.instrument "subscribed.action_cable" do
70
70
  inner.call
71
71
  end
72
- rescue => exception
72
+ rescue Exception => exception # rubocop:disable Lint/RescueException
73
73
  transaction.set_error(exception)
74
74
  raise exception
75
75
  ensure
@@ -97,7 +97,7 @@ module Appsignal
97
97
  Appsignal.instrument "unsubscribed.action_cable" do
98
98
  inner.call
99
99
  end
100
- rescue => exception
100
+ rescue Exception => exception # rubocop:disable Lint/RescueException
101
101
  transaction.set_error(exception)
102
102
  raise exception
103
103
  ensure
@@ -14,7 +14,7 @@ module Appsignal
14
14
 
15
15
  def execute(*args)
16
16
  execute_without_appsignal(*args)
17
- rescue => error
17
+ rescue Exception => error # rubocop:disable Lint/RescueException
18
18
  # Format given arguments and cast to hash if possible
19
19
  params, _ = args
20
20
  params = params.to_hash if params.respond_to?(:to_hash)
@@ -20,7 +20,7 @@ module Appsignal
20
20
  )
21
21
  begin
22
22
  app.call(env)
23
- rescue => error
23
+ rescue Exception => error # rubocop:disable Lint/RescueException
24
24
  transaction.set_error(error)
25
25
  raise error
26
26
  ensure
@@ -34,7 +34,7 @@ module Padrino::Routing::InstanceMethods
34
34
  Appsignal.instrument("process_action.padrino") do
35
35
  route_without_appsignal(base, pass_block)
36
36
  end
37
- rescue => error
37
+ rescue Exception => error # rubocop:disable Lint/RescueException
38
38
  transaction.set_error(error)
39
39
  raise error
40
40
  ensure
@@ -26,7 +26,7 @@ module Appsignal
26
26
  handle_exceptions_without_appsignal do
27
27
  begin
28
28
  yield
29
- rescue => e
29
+ rescue Exception => e # rubocop:disable Lint/RescueException
30
30
  Appsignal.set_error(e)
31
31
  raise e
32
32
  end
@@ -16,7 +16,7 @@ module Appsignal
16
16
  probes.each(&:call)
17
17
  sleep(wait_time)
18
18
  end
19
- rescue Exception => ex
19
+ rescue => ex
20
20
  Appsignal.logger.error("Error in minutely thread: #{ex}")
21
21
  end
22
22
  end
@@ -29,7 +29,7 @@ module Appsignal
29
29
  Appsignal.instrument("process_action.generic") do
30
30
  @app.call(env)
31
31
  end
32
- rescue => error
32
+ rescue Exception => error # rubocop:disable Lint/RescueException
33
33
  transaction.set_error(error)
34
34
  raise error
35
35
  ensure
@@ -28,7 +28,7 @@ module Appsignal
28
28
  )
29
29
  begin
30
30
  @app.call(env)
31
- rescue => error
31
+ rescue Exception => error # rubocop:disable Lint/RescueException
32
32
  transaction.set_error(error)
33
33
  raise error
34
34
  ensure
@@ -59,7 +59,7 @@ module Appsignal
59
59
  Appsignal.instrument("process_action.sinatra") do
60
60
  @app.call(env)
61
61
  end
62
- rescue => error
62
+ rescue Exception => error # rubocop:disable Lint/RescueException
63
63
  transaction.set_error(error)
64
64
  raise error
65
65
  ensure
@@ -31,7 +31,7 @@ module Appsignal
31
31
  Appsignal.instrument("process_action.rack") do
32
32
  begin
33
33
  @app.call(env)
34
- rescue Exception => e
34
+ rescue Exception => e # rubocop:disable Lint/RescueException
35
35
  transaction.set_error(e)
36
36
  raise e
37
37
  ensure
@@ -56,14 +56,14 @@ module Appsignal
56
56
 
57
57
  def each
58
58
  @stream.each { |c| yield(c) }
59
- rescue Exception => e
59
+ rescue Exception => e # rubocop:disable Lint/RescueException
60
60
  @transaction.set_error(e)
61
61
  raise e
62
62
  end
63
63
 
64
64
  def close
65
65
  @stream.close if @stream.respond_to?(:close)
66
- rescue Exception => e
66
+ rescue Exception => e # rubocop:disable Lint/RescueException
67
67
  @transaction.set_error(e)
68
68
  raise e
69
69
  ensure
@@ -1,5 +1,5 @@
1
1
  require "yaml"
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.3.7".freeze
4
+ VERSION = "2.4.0.alpha.1".freeze
5
5
  end
@@ -10,6 +10,22 @@ default: &defaults
10
10
  # ignore_actions:
11
11
  # - ApplicationController#isup
12
12
 
13
+ # Errors that should not be recorded by AppSignal
14
+ # For more information see our docs:
15
+ # https://docs.appsignal.com/ruby/configuration/ignore-errors.html
16
+ # ignore_errors:
17
+ # - Exception
18
+ # - NoMemoryError
19
+ # - ScriptError
20
+ # - LoadError
21
+ # - NotImplementedError
22
+ # - SyntaxError
23
+ # - SecurityError
24
+ # - SignalException
25
+ # - Interrupt
26
+ # - SystemExit
27
+ # - SystemStackError
28
+
13
29
  # See http://docs.appsignal.com/ruby/configuration/options.html for
14
30
  # all configuration options.
15
31
 
@@ -281,7 +281,7 @@ describe Appsignal::Config do
281
281
  ENV["APPSIGNAL_APP_NAME"] = "App name"
282
282
  ENV["APPSIGNAL_DEBUG"] = "true"
283
283
  ENV["APPSIGNAL_IGNORE_ACTIONS"] = "action1,action2"
284
- ENV["APPSIGNAL_IGNORE_ERRORS"] = "VerySpecificError,AnotherError"
284
+ ENV["APPSIGNAL_IGNORE_ERRORS"] = "ExampleStandardError,AnotherError"
285
285
  ENV["APPSIGNAL_IGNORE_NAMESPACES"] = "admin,private_namespace"
286
286
  ENV["APPSIGNAL_INSTRUMENT_NET_HTTP"] = "false"
287
287
  ENV["APPSIGNAL_INSTRUMENT_REDIS"] = "false"
@@ -299,7 +299,7 @@ describe Appsignal::Config do
299
299
  expect(config[:name]).to eq "App name"
300
300
  expect(config[:debug]).to eq(true)
301
301
  expect(config[:ignore_actions]).to eq %w(action1 action2)
302
- expect(config[:ignore_errors]).to eq %w(VerySpecificError AnotherError)
302
+ expect(config[:ignore_errors]).to eq %w(ExampleStandardError AnotherError)
303
303
  expect(config[:ignore_namespaces]).to eq %w(admin private_namespace)
304
304
  expect(config[:instrument_net_http]).to eq(false)
305
305
  expect(config[:instrument_redis]).to eq(false)
@@ -385,7 +385,7 @@ describe Appsignal::Config do
385
385
  before do
386
386
  config[:http_proxy] = "http://localhost"
387
387
  config[:ignore_actions] = %w(action1 action2)
388
- config[:ignore_errors] = %w(VerySpecificError AnotherError)
388
+ config[:ignore_errors] = %w(ExampleStandardError AnotherError)
389
389
  config[:ignore_namespaces] = %w(admin private_namespace)
390
390
  config[:log] = "stdout"
391
391
  config[:log_path] = "/tmp"
@@ -411,7 +411,7 @@ describe Appsignal::Config do
411
411
  expect(ENV["_APPSIGNAL_LANGUAGE_INTEGRATION_VERSION"]).to eq "ruby-#{Appsignal::VERSION}"
412
412
  expect(ENV["_APPSIGNAL_HTTP_PROXY"]).to eq "http://localhost"
413
413
  expect(ENV["_APPSIGNAL_IGNORE_ACTIONS"]).to eq "action1,action2"
414
- expect(ENV["_APPSIGNAL_IGNORE_ERRORS"]).to eq "VerySpecificError,AnotherError"
414
+ expect(ENV["_APPSIGNAL_IGNORE_ERRORS"]).to eq "ExampleStandardError,AnotherError"
415
415
  expect(ENV["_APPSIGNAL_IGNORE_NAMESPACES"]).to eq "admin,private_namespace"
416
416
  expect(ENV["_APPSIGNAL_FILTER_PARAMETERS"]).to eq "password,confirm_password"
417
417
  expect(ENV["_APPSIGNAL_SEND_PARAMS"]).to eq "true"
@@ -143,7 +143,7 @@ describe Appsignal::Hooks::ActionCableHook do
143
143
  let(:channel) do
144
144
  Class.new(ActionCable::Channel::Base) do
145
145
  def speak(_data)
146
- raise VerySpecificError, "oh no!"
146
+ raise ExampleException, "oh no!"
147
147
  end
148
148
 
149
149
  def self.to_s
@@ -155,7 +155,7 @@ describe Appsignal::Hooks::ActionCableHook do
155
155
  it "registers an error on the transaction" do
156
156
  expect do
157
157
  instance.perform_action("message" => "foo", "action" => "speak")
158
- end.to raise_error(VerySpecificError)
158
+ end.to raise_error(ExampleException)
159
159
 
160
160
  expect(subject).to include(
161
161
  "action" => "MyChannel#speak",
@@ -168,7 +168,7 @@ describe Appsignal::Hooks::ActionCableHook do
168
168
  )
169
169
  expect(subject["error"]).to include(
170
170
  "backtrace" => kind_of(String),
171
- "name" => "VerySpecificError",
171
+ "name" => "ExampleException",
172
172
  "message" => "oh no!"
173
173
  )
174
174
  expect(subject["sample_data"]).to include(
@@ -233,7 +233,7 @@ describe Appsignal::Hooks::ActionCableHook do
233
233
  let(:channel) do
234
234
  Class.new(ActionCable::Channel::Base) do
235
235
  def subscribed
236
- raise VerySpecificError, "oh no!"
236
+ raise ExampleException, "oh no!"
237
237
  end
238
238
 
239
239
  def self.to_s
@@ -245,7 +245,7 @@ describe Appsignal::Hooks::ActionCableHook do
245
245
  it "registers an error on the transaction" do
246
246
  expect do
247
247
  instance.subscribe_to_channel
248
- end.to raise_error(VerySpecificError)
248
+ end.to raise_error(ExampleException)
249
249
 
250
250
  expect(subject).to include(
251
251
  "action" => "MyChannel#subscribed",
@@ -258,7 +258,7 @@ describe Appsignal::Hooks::ActionCableHook do
258
258
  )
259
259
  expect(subject["error"]).to include(
260
260
  "backtrace" => kind_of(String),
261
- "name" => "VerySpecificError",
261
+ "name" => "ExampleException",
262
262
  "message" => "oh no!"
263
263
  )
264
264
  expect(subject["sample_data"]).to include(
@@ -320,7 +320,7 @@ describe Appsignal::Hooks::ActionCableHook do
320
320
  let(:channel) do
321
321
  Class.new(ActionCable::Channel::Base) do
322
322
  def unsubscribed
323
- raise VerySpecificError, "oh no!"
323
+ raise ExampleException, "oh no!"
324
324
  end
325
325
 
326
326
  def self.to_s
@@ -332,7 +332,7 @@ describe Appsignal::Hooks::ActionCableHook do
332
332
  it "registers an error on the transaction" do
333
333
  expect do
334
334
  instance.unsubscribe_from_channel
335
- end.to raise_error(VerySpecificError)
335
+ end.to raise_error(ExampleException)
336
336
 
337
337
  expect(subject).to include(
338
338
  "action" => "MyChannel#unsubscribed",
@@ -345,7 +345,7 @@ describe Appsignal::Hooks::ActionCableHook do
345
345
  )
346
346
  expect(subject["error"]).to include(
347
347
  "backtrace" => kind_of(String),
348
- "name" => "VerySpecificError",
348
+ "name" => "ExampleException",
349
349
  "message" => "oh no!"
350
350
  )
351
351
  expect(subject["sample_data"]).to include(
@@ -61,9 +61,9 @@ describe Appsignal::Hooks::ActiveSupportNotificationsHook do
61
61
 
62
62
  expect do
63
63
  as.instrument("sql.active_record", :sql => "SQL") do
64
- raise VerySpecificError, "foo"
64
+ raise ExampleException, "foo"
65
65
  end
66
- end.to raise_error(VerySpecificError, "foo")
66
+ end.to raise_error(ExampleException, "foo")
67
67
  end
68
68
  end
69
69
 
@@ -316,7 +316,7 @@ describe Appsignal::Hooks::DelayedJobHook do
316
316
  end
317
317
 
318
318
  context "with an erroring call" do
319
- let(:error) { VerySpecificError }
319
+ let(:error) { ExampleException }
320
320
  let(:transaction) do
321
321
  Appsignal::Transaction.new(
322
322
  SecureRandom.uuid,
@@ -24,7 +24,7 @@ describe Appsignal::Hooks::RakeHook do
24
24
  end
25
25
 
26
26
  context "with error" do
27
- let(:error) { VerySpecificError.new }
27
+ let(:error) { ExampleException }
28
28
  let(:transaction) { background_job_transaction }
29
29
  before do
30
30
  task.enhance { raise error }
@@ -66,7 +66,7 @@ describe Appsignal::Hooks::RakeHook do
66
66
  end
67
67
 
68
68
  after do
69
- expect { task.execute(arguments) }.to raise_error VerySpecificError
69
+ expect { task.execute(arguments) }.to raise_error ExampleException
70
70
  end
71
71
  end
72
72
  end
@@ -146,17 +146,17 @@ describe Appsignal::Hooks::ShoryukenMiddleware do
146
146
  end
147
147
 
148
148
  it "sets the exception on the transaction" do
149
- expect(transaction).to receive(:set_error).with(VerySpecificError)
149
+ expect(transaction).to receive(:set_error).with(ExampleException)
150
150
  end
151
151
 
152
152
  after do
153
153
  expect do
154
154
  Timecop.freeze(Time.parse("01-01-2001 10:01:00UTC")) do
155
155
  Appsignal::Hooks::ShoryukenMiddleware.new.call(worker_instance, queue, sqs_msg, body) do
156
- raise VerySpecificError
156
+ raise ExampleException
157
157
  end
158
158
  end
159
- end.to raise_error(VerySpecificError)
159
+ end.to raise_error(ExampleException)
160
160
  end
161
161
  end
162
162
  end
@@ -224,7 +224,7 @@ if DependencyHelper.sidekiq_present?
224
224
  end
225
225
 
226
226
  context "with an erroring job" do
227
- let(:error) { VerySpecificError }
227
+ let(:error) { ExampleException }
228
228
  before do
229
229
  expect do
230
230
  Timecop.freeze(Time.parse("01-01-2001 10:01:00UTC")) do
@@ -240,7 +240,7 @@ if DependencyHelper.sidekiq_present?
240
240
  # TODO: backtrace should be an Array of Strings
241
241
  # https://github.com/appsignal/appsignal-agent/issues/294
242
242
  expect(transaction_hash["error"]).to include(
243
- "name" => "VerySpecificError",
243
+ "name" => "ExampleException",
244
244
  "message" => "uh oh",
245
245
  "backtrace" => kind_of(String)
246
246
  )
@@ -77,7 +77,7 @@ if DependencyHelper.grape_present?
77
77
  Class.new(::Grape::API) do
78
78
  format :json
79
79
  post :ping do
80
- raise VerySpecificError
80
+ raise ExampleException
81
81
  end
82
82
  end
83
83
  end
@@ -90,11 +90,11 @@ if DependencyHelper.grape_present?
90
90
  end
91
91
 
92
92
  it "sets the error" do
93
- expect(transaction).to receive(:set_error).with(kind_of(VerySpecificError))
93
+ expect(transaction).to receive(:set_error).with(kind_of(ExampleException))
94
94
  end
95
95
 
96
96
  after do
97
- expect { middleware.call(env) }.to raise_error VerySpecificError
97
+ expect { middleware.call(env) }.to raise_error ExampleException
98
98
  end
99
99
  end
100
100
 
@@ -215,11 +215,11 @@ if DependencyHelper.padrino_present?
215
215
  context "with an exception in the controller" do
216
216
  let(:path) { "/exception" }
217
217
  before do
218
- app.controllers { get(:exception) { raise VerySpecificError } }
218
+ app.controllers { get(:exception) { raise ExampleException } }
219
219
  expect_a_transaction_to_be_created
220
220
  end
221
221
  after do
222
- expect { response }.to raise_error(VerySpecificError)
222
+ expect { response }.to raise_error(ExampleException)
223
223
  end
224
224
 
225
225
  it "sets the action name based on the app name and action name" do
@@ -227,7 +227,7 @@ if DependencyHelper.padrino_present?
227
227
  end
228
228
 
229
229
  it "sets the error on the transaction" do
230
- expect(transaction).to receive(:set_error).with(VerySpecificError)
230
+ expect(transaction).to receive(:set_error).with(ExampleException)
231
231
  end
232
232
  end
233
233
 
@@ -18,7 +18,7 @@ if DependencyHelper.resque_present?
18
18
  extend Appsignal::Integrations::ResquePlugin
19
19
 
20
20
  def self.perform
21
- raise VerySpecificError
21
+ raise ExampleException
22
22
  end
23
23
  end
24
24
  end
@@ -72,11 +72,11 @@ if DependencyHelper.resque_present?
72
72
  end
73
73
 
74
74
  it "sets the exception on the transaction" do
75
- expect(transaction).to receive(:set_error).with(VerySpecificError)
75
+ expect(transaction).to receive(:set_error).with(ExampleException)
76
76
  end
77
77
 
78
78
  after do
79
- expect { job.perform }.to raise_error(VerySpecificError)
79
+ expect { job.perform }.to raise_error(ExampleException)
80
80
  end
81
81
  end
82
82
  end
@@ -55,7 +55,7 @@ if DependencyHelper.webmachine_present?
55
55
  end
56
56
 
57
57
  describe "#handle_exceptions_with_appsignal" do
58
- let(:error) { VerySpecificError.new }
58
+ let(:error) { ExampleException }
59
59
 
60
60
  it "should catch the error and send it to AppSignal" do
61
61
  expect(Appsignal).to receive(:set_error).with(error)
@@ -49,15 +49,15 @@ describe Appsignal::Rack::GenericInstrumentation do
49
49
  expect(app).to receive(:call).with(env)
50
50
  end
51
51
 
52
- context "with an error", :error => true do
53
- let(:error) { VerySpecificError.new }
52
+ context "with an exception", :error => true do
53
+ let(:error) { ExampleException }
54
54
  let(:app) do
55
55
  double.tap do |d|
56
56
  allow(d).to receive(:call).and_raise(error)
57
57
  end
58
58
  end
59
59
 
60
- it "should set the error" do
60
+ it "records the exception" do
61
61
  expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
62
62
  end
63
63
  end
@@ -85,6 +85,6 @@ describe Appsignal::Rack::GenericInstrumentation do
85
85
  end
86
86
 
87
87
  after(:error => false) { middleware.call(env) }
88
- after(:error => true) { expect { middleware.call(env) }.to raise_error(VerySpecificError) }
88
+ after(:error => true) { expect { middleware.call(env) }.to raise_error(error) }
89
89
  end
90
90
  end
@@ -68,15 +68,15 @@ if DependencyHelper.rails_present?
68
68
  expect(app).to receive(:call).with(env)
69
69
  end
70
70
 
71
- context "with an error", :error => true do
72
- let(:error) { VerySpecificError }
71
+ context "with an exception", :error => true do
72
+ let(:error) { ExampleException }
73
73
  let(:app) do
74
74
  double.tap do |d|
75
75
  allow(d).to receive(:call).and_raise(error)
76
76
  end
77
77
  end
78
78
 
79
- it "should set the error" do
79
+ it "records the exception" do
80
80
  expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
81
81
  end
82
82
  end
@@ -91,7 +91,7 @@ if DependencyHelper.rails_present?
91
91
  end
92
92
 
93
93
  after(:error => false) { middleware.call(env) }
94
- after(:error => true) { expect { middleware.call(env) }.to raise_error(VerySpecificError) }
94
+ after(:error => true) { expect { middleware.call(env) }.to raise_error(error) }
95
95
  end
96
96
 
97
97
  describe "#request_id" do
@@ -118,7 +118,7 @@ if DependencyHelper.sinatra_present?
118
118
  end
119
119
 
120
120
  context "with an error", :error => true do
121
- let(:error) { VerySpecificError }
121
+ let(:error) { ExampleException }
122
122
  let(:app) do
123
123
  double.tap do |d|
124
124
  allow(d).to receive(:call).and_raise(error)
@@ -126,23 +126,23 @@ if DependencyHelper.sinatra_present?
126
126
  end
127
127
  end
128
128
 
129
- it "should set the error" do
129
+ it "records the exception" do
130
130
  expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
131
131
  end
132
132
  end
133
133
 
134
134
  context "with an error in sinatra.error" do
135
- let(:error) { VerySpecificError }
135
+ let(:error) { ExampleException }
136
136
  let(:env) { { "sinatra.error" => error } }
137
137
 
138
- it "should set the error" do
138
+ it "records the exception" do
139
139
  expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
140
140
  end
141
141
 
142
- context "if raise_errors is on" do
142
+ context "when raise_errors is on" do
143
143
  let(:settings) { double(:raise_errors => true) }
144
144
 
145
- it "should not set the error" do
145
+ it "does not record the error" do
146
146
  expect_any_instance_of(Appsignal::Transaction).to_not receive(:set_error)
147
147
  end
148
148
  end
@@ -150,7 +150,7 @@ if DependencyHelper.sinatra_present?
150
150
  context "if sinatra.skip_appsignal_error is set" do
151
151
  let(:env) { { "sinatra.error" => error, "sinatra.skip_appsignal_error" => true } }
152
152
 
153
- it "should not set the error" do
153
+ it "does not record the error" do
154
154
  expect_any_instance_of(Appsignal::Transaction).to_not receive(:set_error)
155
155
  end
156
156
  end
@@ -207,7 +207,7 @@ if DependencyHelper.sinatra_present?
207
207
  end
208
208
 
209
209
  after(:error => false) { middleware.call(env) }
210
- after(:error => true) { expect { middleware.call(env) }.to raise_error(VerySpecificError) }
210
+ after(:error => true) { expect { middleware.call(env) }.to raise_error(error) }
211
211
  end
212
212
  end
213
213
  end
@@ -87,7 +87,7 @@ describe Appsignal::Rack::StreamingListener do
87
87
  end
88
88
 
89
89
  context "with an exception in the instrumentation call" do
90
- let(:error) { VerySpecificError }
90
+ let(:error) { ExampleException }
91
91
 
92
92
  it "should add the exception to the transaction" do
93
93
  allow(app).to receive(:call).and_raise(error)
@@ -118,18 +118,17 @@ describe Appsignal::StreamWrapper do
118
118
  let(:wrapper) { Appsignal::StreamWrapper.new(stream, transaction) }
119
119
 
120
120
  describe "#each" do
121
- it "should call the original stream" do
121
+ it "calls the original stream" do
122
122
  expect(stream).to receive(:each)
123
123
 
124
124
  wrapper.each
125
125
  end
126
126
 
127
- context "when each raises an error" do
128
- let(:error) { VerySpecificError }
127
+ context "when #each raises an error" do
128
+ let(:error) { ExampleException }
129
129
 
130
- it "should add the exception to the transaction" do
131
- allow(stream).to receive(:each)
132
- .and_raise(error)
130
+ it "records the exception" do
131
+ allow(stream).to receive(:each).and_raise(error)
133
132
 
134
133
  expect(transaction).to receive(:set_error).with(error)
135
134
 
@@ -139,17 +138,17 @@ describe Appsignal::StreamWrapper do
139
138
  end
140
139
 
141
140
  describe "#close" do
142
- it "should call the original stream and close the transaction" do
141
+ it "closes the original stream and completes the transaction" do
143
142
  expect(stream).to receive(:close)
144
143
  expect(Appsignal::Transaction).to receive(:complete_current!)
145
144
 
146
145
  wrapper.close
147
146
  end
148
147
 
149
- context "when each raises an error" do
150
- let(:error) { VerySpecificError }
148
+ context "when #close raises an error" do
149
+ let(:error) { ExampleException }
151
150
 
152
- it "adds the exception to the transaction and close it" do
151
+ it "records the exception and completes the transaction" do
153
152
  allow(stream).to receive(:close).and_raise(error)
154
153
 
155
154
  expect(transaction).to receive(:set_error).with(error)
@@ -133,13 +133,13 @@ describe Appsignal::Transaction do
133
133
 
134
134
  context "when encountering an error while completing" do
135
135
  before do
136
- expect(transaction).to receive(:complete).and_raise VerySpecificError
136
+ expect(transaction).to receive(:complete).and_raise ExampleStandardError
137
137
  end
138
138
 
139
139
  it "logs an error message" do
140
140
  Appsignal::Transaction.complete_current!
141
141
  expect(log_contents(log)).to contains_log :error,
142
- "Failed to complete transaction ##{transaction.transaction_id}. VerySpecificError"
142
+ "Failed to complete transaction ##{transaction.transaction_id}. ExampleStandardError"
143
143
  end
144
144
 
145
145
  it "clears the current transaction" do
@@ -348,7 +348,7 @@ describe Appsignal do
348
348
  end
349
349
 
350
350
  context "with an erroring call" do
351
- let(:error) { VerySpecificError.new }
351
+ let(:error) { ExampleException.new }
352
352
 
353
353
  it "should add the error to the current transaction and complete" do
354
354
  expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
@@ -379,7 +379,7 @@ describe Appsignal do
379
379
  end
380
380
 
381
381
  context "with an erroring call" do
382
- let(:error) { VerySpecificError.new }
382
+ let(:error) { ExampleException.new }
383
383
 
384
384
  it "should call monitor_transaction and stop and then raise the error" do
385
385
  expect(Appsignal).to receive(:monitor_transaction).with(
@@ -719,7 +719,7 @@ describe Appsignal do
719
719
  Appsignal::Transaction::GenericRequest.new({})
720
720
  )
721
721
  end
722
- let(:error) { VerySpecificError.new }
722
+ let(:error) { ExampleException.new }
723
723
 
724
724
  it "sends the error to AppSignal" do
725
725
  expect(Appsignal::Transaction).to receive(:new).with(
@@ -0,0 +1,13 @@
1
+ # This ExampleException is used for throwing Exceptions in specs that are
2
+ # allowed or expected.
3
+ #
4
+ # For example, this error can be thrown to raise an exception in AppSignal's
5
+ # run, which should stop the program and the appsignal gem, but not crash the
6
+ # test suite.
7
+ #
8
+ # There's also {ExampleStandardError}, use this when you need to test against
9
+ # StandardError-level Ruby exceptions.
10
+ #
11
+ # @see ExampleStandardError
12
+ class ExampleException < Exception # rubocop:disable Lint/InheritException
13
+ end
@@ -0,0 +1,13 @@
1
+ # This ExampleStandardError is used for throwing errors in specs that are
2
+ # allowed or expected.
3
+ #
4
+ # For example, this error can be thrown to raise an exception in AppSignal's
5
+ # run, which should stop the program and the appsignal gem, but not crash the
6
+ # test suite.
7
+ #
8
+ # There's also {ExampleException}, use this when you need to test against
9
+ # Exception-level Ruby exceptions.
10
+ #
11
+ # @see ExampleException
12
+ class ExampleStandardError < StandardError
13
+ end
@@ -24,9 +24,9 @@ RSpec.shared_examples "instrument helper" do
24
24
  expect do
25
25
  instrumenter.instrument "name", "title", "body" do
26
26
  stub.method_call
27
- raise VerySpecificError, "foo"
27
+ raise ExampleException, "foo"
28
28
  end
29
- end.to raise_error(VerySpecificError, "foo")
29
+ end.to raise_error(ExampleException, "foo")
30
30
  end
31
31
  end
32
32
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.7
4
+ version: 2.4.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-10 00:00:00.000000000 Z
12
+ date: 2017-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -314,12 +314,13 @@ files:
314
314
  - spec/support/helpers/dependency_helper.rb
315
315
  - spec/support/helpers/directory_helper.rb
316
316
  - spec/support/helpers/env_helpers.rb
317
+ - spec/support/helpers/example_exception.rb
318
+ - spec/support/helpers/example_standard_error.rb
317
319
  - spec/support/helpers/log_helpers.rb
318
320
  - spec/support/helpers/std_streams_helper.rb
319
321
  - spec/support/helpers/system_helpers.rb
320
322
  - spec/support/helpers/time_helpers.rb
321
323
  - spec/support/helpers/transaction_helpers.rb
322
- - spec/support/helpers/very_specific_error.rb
323
324
  - spec/support/matchers/contains_log.rb
324
325
  - spec/support/mocks/fake_gc_profiler.rb
325
326
  - spec/support/mocks/mock_extension.rb
@@ -348,9 +349,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
349
  version: '1.9'
349
350
  required_rubygems_version: !ruby/object:Gem::Requirement
350
351
  requirements:
351
- - - ">="
352
+ - - ">"
352
353
  - !ruby/object:Gem::Version
353
- version: '0'
354
+ version: 1.3.1
354
355
  requirements: []
355
356
  rubyforge_project:
356
357
  rubygems_version: 2.5.2.1
@@ -436,12 +437,13 @@ test_files:
436
437
  - spec/support/helpers/dependency_helper.rb
437
438
  - spec/support/helpers/directory_helper.rb
438
439
  - spec/support/helpers/env_helpers.rb
440
+ - spec/support/helpers/example_exception.rb
441
+ - spec/support/helpers/example_standard_error.rb
439
442
  - spec/support/helpers/log_helpers.rb
440
443
  - spec/support/helpers/std_streams_helper.rb
441
444
  - spec/support/helpers/system_helpers.rb
442
445
  - spec/support/helpers/time_helpers.rb
443
446
  - spec/support/helpers/transaction_helpers.rb
444
- - spec/support/helpers/very_specific_error.rb
445
447
  - spec/support/matchers/contains_log.rb
446
448
  - spec/support/mocks/fake_gc_profiler.rb
447
449
  - spec/support/mocks/mock_extension.rb
@@ -1,8 +0,0 @@
1
- # This VerySpecificError is used for throwing errors in specs that are allowed
2
- # or expected.
3
- #
4
- # For example, this error can be thrown to raise an exception in AppSignal's
5
- # run, which should stop the program and the appsignal gem, but not crash the
6
- # test suite.
7
- class VerySpecificError < RuntimeError
8
- end