appsignal 1.2.0.beta.1 → 1.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: 1961ed742869bc42f46731ae2886077fcbe51a8a
4
- data.tar.gz: 810e56cefb59bc34afaa86a1b00f0775dce15c80
3
+ metadata.gz: d44539c4d934bc6c75a61244bc52dcc2a67d75a5
4
+ data.tar.gz: a90fa4a59e8d2529aa5bfd67e8e80d0184d26792
5
5
  SHA512:
6
- metadata.gz: c5ea8ee5ce64e217f2ff6397f1c45a770738346d777b695cf4d6b435f8da1b691171e4992bf551a34a5f1de5295ff685607c49e817b7d67cf547b3b7d23027ca
7
- data.tar.gz: 17a3d405e94a611a88019045a7a4d1d7dd71b9ece5c1d4348a83234e85a5715c279efe84a6e2f855cd2490275f7e2438fe8ec250853cfee566165406eb567dc6
6
+ metadata.gz: a4714eeb4f848bd99460320f35dfcd9429462a49b178c1cb0dcf6e94bab432a4af261ecd68bf07975c4eb15699cd729539cd3f0b109789338405ef7096681c80
7
+ data.tar.gz: 66db0f2a4b0019a00b052ae6fde322c6fd4de6621ea7068a90e7f61e5f1740c281ba6817ae7d59ca54819136d44d001ce735b29940c40162928e1055e1c678db
@@ -2,6 +2,7 @@
2
2
  * Restart background thread when FD's are closed
3
3
  * Beta version of collecting host metrics (disabled by default)
4
4
  * Hooks for Shuryoken
5
+ * Don't add errors from env if raise_errors is off for Sinatra
5
6
 
6
7
  # 1.1.9
7
8
  * Fix for race condition when creating working dir exactly at the same time
@@ -3,9 +3,12 @@ require 'rack'
3
3
  module Appsignal
4
4
  module Rack
5
5
  class SinatraInstrumentation
6
+ attr_reader :raise_errors_on
7
+
6
8
  def initialize(app, options = {})
7
9
  Appsignal.logger.debug 'Initializing Appsignal::Rack::SinatraInstrumentation'
8
10
  @app, @options = app, options
11
+ @raise_errors_on = @app.settings.raise_errors
9
12
  end
10
13
 
11
14
  def call(env)
@@ -34,9 +37,9 @@ module Appsignal
34
37
  transaction.set_error(error)
35
38
  raise error
36
39
  ensure
37
- # In production newer versions of Sinatra don't raise errors, but store
40
+ # If raise_error is off versions of Sinatra don't raise errors, but store
38
41
  # them in the sinatra.error env var.
39
- transaction.set_error(env['sinatra.error']) if env['sinatra.error']
42
+ transaction.set_error(env['sinatra.error']) if !@raise_errors_on && env['sinatra.error']
40
43
  transaction.set_action(env['sinatra.route'])
41
44
  transaction.set_metadata('path', request.path)
42
45
  transaction.set_metadata('method', request.request_method)
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.2.0.beta.1'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -11,13 +11,13 @@ describe "Sequel integration", if: sequel_present? do
11
11
  before { Appsignal::Transaction.create('uuid', Appsignal::Transaction::HTTP_REQUEST, 'test') }
12
12
 
13
13
  it "should instrument queries" do
14
- expect( Appsignal::Extension ).to receive(:start_event)
14
+ expect( Appsignal::Transaction.current ).to receive(:start_event)
15
15
  .at_least(:once)
16
- expect( Appsignal::Extension ).to receive(:finish_event)
16
+ expect( Appsignal::Transaction.current ).to receive(:finish_event)
17
17
  .at_least(:once)
18
- .with(kind_of(Integer), "sql.sequel", "", kind_of(String), 1)
18
+ .with("sql.sequel", nil, kind_of(String), 1)
19
19
 
20
- db['SELECT 1'].all
20
+ db['SELECT 1'].all.to_a
21
21
  end
22
22
  end
23
23
  end
@@ -12,7 +12,8 @@ if defined?(::Sinatra)
12
12
  start_agent
13
13
  end
14
14
 
15
- let(:app) { double(:call => true) }
15
+ let(:settings) { double(:raise_errors => false) }
16
+ let(:app) { double(:call => true, :settings => settings) }
16
17
  let(:env) { {'sinatra.route' => 'GET /', :path => '/', :method => 'GET'} }
17
18
  let(:options) { {} }
18
19
  let(:middleware) { Appsignal::Rack::SinatraInstrumentation.new(app, options) }
@@ -63,6 +64,7 @@ if defined?(::Sinatra)
63
64
  let(:app) do
64
65
  double.tap do |d|
65
66
  d.stub(:call).and_raise(error)
67
+ d.stub(:settings => settings)
66
68
  end
67
69
  end
68
70
 
@@ -78,6 +80,14 @@ if defined?(::Sinatra)
78
80
  it "should set the error" do
79
81
  Appsignal::Transaction.any_instance.should_receive(:set_error).with(error)
80
82
  end
83
+
84
+ context "if raise_errors is on" do
85
+ let(:settings) { double(:raise_errors => true) }
86
+
87
+ it "should not set the error" do
88
+ Appsignal::Transaction.any_instance.should_not_receive(:set_error)
89
+ end
90
+ end
81
91
  end
82
92
 
83
93
  it "should set the action" do
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: 1.2.0.beta.1
4
+ version: 1.2.0
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: 2016-06-13 00:00:00.000000000 Z
12
+ date: 2016-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -299,9 +299,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
299
  version: '1.9'
300
300
  required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  requirements:
302
- - - ">"
302
+ - - ">="
303
303
  - !ruby/object:Gem::Version
304
- version: 1.3.1
304
+ version: '0'
305
305
  requirements: []
306
306
  rubyforge_project:
307
307
  rubygems_version: 2.4.5