appsignal 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmExMjg1NjdlMjdlZGQ5MWViMGUwYjI3ZDc5OTViYTgyNTcwYWExZQ==
4
+ NGQ3NjM0YzRiNjRhZmI0NTY1YmE3OThmZmJkMDE2YzljNDRmZjc4YQ==
5
5
  data.tar.gz: !binary |-
6
- YmYzOTA3NmQ0NDRiMDEzNjVlMmNiZTFhN2U2M2VjODhmODRmNzY3Ng==
6
+ ZGM3MmU0NGZlMDk4OTAyNGFkNGMxYTMwN2Y3ZTQyMTMzMmZkNWZkZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjcwNDg1NmU2MDc1NGEwNTc5ZmM5ZjQwNDI5Njk1M2Y0NWNhOTVlY2FkMDBl
10
- NDkwZDYwZGE1NDBhNGU3MjBmNDI2NjBiMjk3NGM0OGFjNWJiM2VkNGNmNjkx
11
- OTE5ZGJjZjYxMTI4ZGFkYjNiN2U1ODJjYzFiYzRlYWZmOGRhNDI=
9
+ MjRmNTY5YThmNzRlZGRjNWM3ZTA1MmFhMzE5NTEzZWRjOWY2ZDk0ZWYyMjlm
10
+ MWFlNDkxMzIzYmI5ZTI2MzVhNjE4Njk4OWJmYmRjMWUwZWQ2ODZmYjk3Y2Rh
11
+ NjE5NjdhMWY1ZjAzMWQ5NjJiYzFmYjFiMzYyYWQ0YWMyNmViNGQ=
12
12
  data.tar.gz: !binary |-
13
- OWI3NTI4NWEwZWI5MzhhODM1OTQ3NGMwZDM1YTU2NTk3ZjQyZDEyNDIyNTcw
14
- N2I3OGYyMDM0Y2FmOGU1Y2VmMGZjZGM4MzVmOGVhNGI1NzUyZjhiYjYzYTEz
15
- NzIzYzQwYzc3ZGFmYzNhMmNlZDAxNTk4Yzg0NGE5OGU0MTNmMDg=
13
+ YWM4NGIzOGVmMDlkZjBjYzgwNGZkYjEyMjU3YWZmNDM0YWRmNzU4OTJmNjYy
14
+ YWJmYWY4MDY0Zjc5ZjI3OTE0MjMwNzNkMGQ0MjhjY2U4MmJlODUxZTMwZmI5
15
+ MzhhNWVkNmQwZmVlYzFiMjAxMWM4YzJkMzVmNGZmNWE0YjkzNGY=
@@ -1,3 +1,6 @@
1
+ # 0.6.6
2
+ * Add Appsignal.add_exception
3
+
1
4
  # 0.6.5
2
5
  * Fix bug where fast requests are tracked with wrong action
3
6
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 80beans
1
+ Copyright (c) 2012-2013 AppSignal
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.summary = 'Logs performance and exception data from your app to'\
15
15
  'appsignal.com'
16
16
  gem.homepage = 'http://github.com/appsignal/appsignal'
17
+ gem.license = 'MIT'
17
18
 
18
19
  gem.files = `git ls-files`.split($\)
19
20
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -27,14 +27,17 @@ module Appsignal
27
27
  end
28
28
 
29
29
  def send_exception(exception)
30
- unless is_ignored_exception?(exception)
31
- Appsignal.agent
32
- env = ENV.to_hash
30
+ return if is_ignored_exception?(exception)
31
+ transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV.to_hash)
32
+ transaction.add_exception(exception)
33
+ transaction.complete!
34
+ Appsignal.agent.send_queue
35
+ end
33
36
 
34
- transaction = Appsignal::Transaction.create(SecureRandom.uuid, env)
35
- transaction.add_exception(exception)
36
- transaction.complete!
37
- Appsignal.agent.send_queue
37
+ def add_exception(exception)
38
+ return if Appsignal::Transaction.current.nil? || exception.nil?
39
+ unless is_ignored_exception?(exception)
40
+ Appsignal::Transaction.current.add_exception(exception)
38
41
  end
39
42
  end
40
43
 
@@ -12,7 +12,6 @@ module Appsignal
12
12
  end
13
13
 
14
14
  def to_hash
15
-
16
15
  merge_process_action_event_with_log_entry! if process_action_event
17
16
  if exception?
18
17
  add_exception_to_hash!
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
3
3
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Appsignal do
4
4
  it { should respond_to :subscriber }
5
+ let(:transaction) { regular_transaction }
5
6
 
6
7
  describe ".enqueue" do
7
- let(:transaction) { regular_transaction }
8
8
  subject { Appsignal.enqueue(transaction) }
9
9
 
10
10
  it "forwards the call to the agent" do
@@ -126,14 +126,21 @@ describe Appsignal do
126
126
  end
127
127
 
128
128
  describe ".send_exception" do
129
- it "should raise exception" do
129
+ it "should send the exception to AppSignal" do
130
130
  agent = double
131
- Appsignal.should_receive(:agent).exactly(3).times.and_return(agent)
131
+ Appsignal.stub(:agent).and_return(agent)
132
132
  agent.should_receive(:send_queue)
133
133
  agent.should_receive(:enqueue).with(kind_of(Appsignal::Transaction))
134
134
 
135
135
  Appsignal::Transaction.should_receive(:create).and_call_original
136
+ end
137
+
138
+ it "should not send the exception if it's in the ignored list" do
139
+ Appsignal.stub(:is_ignored_exception? => true)
140
+ Appsignal::Transaction.should_not_receive(:create)
141
+ end
136
142
 
143
+ after do
137
144
  begin
138
145
  raise "I am an exception"
139
146
  rescue Exception => e
@@ -143,7 +150,7 @@ describe Appsignal do
143
150
  end
144
151
 
145
152
  describe ".listen_for_exception" do
146
- it "should raise exception" do
153
+ it "should call send_exception and re-raise" do
147
154
  Appsignal.should_receive(:send_exception).with(kind_of(Exception))
148
155
  lambda {
149
156
  Appsignal.listen_for_exception do
@@ -152,4 +159,37 @@ describe Appsignal do
152
159
  }.should raise_error(RuntimeError, "I am an exception")
153
160
  end
154
161
  end
162
+
163
+ describe ".add_exception" do
164
+ before { Appsignal::Transaction.stub(:current => transaction) }
165
+ let(:exception) { RuntimeError.new('I am an exception') }
166
+
167
+ it "should add the exception to the current transaction" do
168
+ transaction.should_receive(:add_exception).with(exception)
169
+
170
+ Appsignal.add_exception(exception)
171
+ end
172
+
173
+ it "should do nothing if there is no current transaction" do
174
+ Appsignal::Transaction.stub(:current => nil)
175
+
176
+ transaction.should_not_receive(:add_exception).with(exception)
177
+
178
+ Appsignal.add_exception(exception)
179
+ end
180
+
181
+ it "should not add the exception if it's in the ignored list" do
182
+ Appsignal.stub(:is_ignored_exception? => true)
183
+
184
+ transaction.should_not_receive(:add_exception).with(exception)
185
+
186
+ Appsignal.add_exception(exception)
187
+ end
188
+
189
+ it "should do nothing if the exception is nil" do
190
+ transaction.should_not_receive(:add_exception)
191
+
192
+ Appsignal.add_exception(nil)
193
+ end
194
+ end
155
195
  end
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: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-09-27 00:00:00.000000000 Z
15
+ date: 2013-10-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -192,7 +192,8 @@ files:
192
192
  - spec/support/helpers/notification_helpers.rb
193
193
  - spec/support/helpers/transaction_helpers.rb
194
194
  homepage: http://github.com/appsignal/appsignal
195
- licenses: []
195
+ licenses:
196
+ - MIT
196
197
  metadata: {}
197
198
  post_install_message:
198
199
  rdoc_options: []