appsignal 0.12.beta.27 → 0.12.beta.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/appsignal_extension.c +10 -3
- data/lib/appsignal.rb +8 -2
- data/lib/appsignal/integrations/celluloid.rb +18 -0
- data/lib/appsignal/version.rb +2 -2
- data/spec/lib/appsignal/integrations/celluloid_spec.rb +32 -0
- data/spec/lib/appsignal_spec.rb +13 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b75976d688e1bcc018a9ff67eb4a9e8e077f2ed
|
4
|
+
data.tar.gz: 9abe6a6341d43db08c129532f41d7f9f790e6e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9907f3b3b77ba7b755e25e5a927a60db029794da307bc6e3a71d311c3afd31b9bbc321e25d839d244ed775784a925d1ea318d32e1409cf3ad8350890eac5c0a6
|
7
|
+
data.tar.gz: 27084e35e9f1054bce5a062ede800e2d885b731a70c72d36ad5164ceb63c8c21f0e18f95a57e609b172d6abe886acdfbf8ab5a199c0891dc6784684f181379bf
|
data/ext/appsignal_extension.c
CHANGED
@@ -7,8 +7,14 @@ static VALUE start(VALUE self) {
|
|
7
7
|
return Qnil;
|
8
8
|
}
|
9
9
|
|
10
|
-
static VALUE
|
11
|
-
|
10
|
+
static VALUE stop_agent(VALUE self) {
|
11
|
+
appsignal_stop_agent();
|
12
|
+
|
13
|
+
return Qnil;
|
14
|
+
}
|
15
|
+
|
16
|
+
static VALUE stop_extension(VALUE self) {
|
17
|
+
appsignal_stop_extension();
|
12
18
|
|
13
19
|
return Qnil;
|
14
20
|
}
|
@@ -209,7 +215,8 @@ void Init_appsignal_extension(void) {
|
|
209
215
|
|
210
216
|
// Transaction monitoring
|
211
217
|
rb_define_singleton_method(Extension, "start", start, 0);
|
212
|
-
rb_define_singleton_method(Extension, "
|
218
|
+
rb_define_singleton_method(Extension, "stop_agent", stop_agent, 0);
|
219
|
+
rb_define_singleton_method(Extension, "stop_extension", stop_extension, 0);
|
213
220
|
rb_define_singleton_method(Extension, "start_transaction", start_transaction, 1);
|
214
221
|
rb_define_singleton_method(Extension, "start_event", start_event, 1);
|
215
222
|
rb_define_singleton_method(Extension, "finish_event", finish_event, 4);
|
data/lib/appsignal.rb
CHANGED
@@ -13,6 +13,7 @@ module Appsignal
|
|
13
13
|
attr_accessor :config, :subscriber, :logger, :agent, :in_memory_log
|
14
14
|
|
15
15
|
def load_integrations
|
16
|
+
require 'appsignal/integrations/celluloid'
|
16
17
|
require 'appsignal/integrations/delayed_job'
|
17
18
|
require 'appsignal/integrations/sidekiq'
|
18
19
|
require 'appsignal/integrations/resque'
|
@@ -59,10 +60,15 @@ module Appsignal
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
62
|
-
def
|
63
|
-
Appsignal::Extension.
|
63
|
+
def stop_agent
|
64
|
+
Appsignal::Extension.stop_agent
|
64
65
|
end
|
65
66
|
|
67
|
+
def stop_extension
|
68
|
+
Appsignal::Extension.stop_extension
|
69
|
+
end
|
70
|
+
|
71
|
+
|
66
72
|
def monitor_transaction(name, payload={})
|
67
73
|
unless active?
|
68
74
|
yield
|
@@ -0,0 +1,18 @@
|
|
1
|
+
if defined?(::Celluloid)
|
2
|
+
Appsignal.logger.info('Loading Celluloid integration')
|
3
|
+
|
4
|
+
# Some versions of Celluloid have race conditions while exiting
|
5
|
+
# that can result in a dead lock. We stop appsignal before shutting
|
6
|
+
# down Celluloid so we're sure our thread does not aggravate this situation.
|
7
|
+
|
8
|
+
::Celluloid.class_eval do
|
9
|
+
class << self
|
10
|
+
alias shutdown_without_appsignal shutdown
|
11
|
+
|
12
|
+
def shutdown
|
13
|
+
Appsignal.stop_extension
|
14
|
+
shutdown_without_appsignal
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Celluloid integration" do
|
4
|
+
let(:file) { File.expand_path('lib/appsignal/integrations/celluloid.rb') }
|
5
|
+
|
6
|
+
context "with celluloid" do
|
7
|
+
before(:all) do
|
8
|
+
module Celluloid
|
9
|
+
def self.shutdown
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before do
|
15
|
+
load file
|
16
|
+
end
|
17
|
+
|
18
|
+
specify { expect(Appsignal).to receive(:stop_extension) }
|
19
|
+
|
20
|
+
specify { expect(Celluloid).to receive(:shutdown_without_appsignal) }
|
21
|
+
after do
|
22
|
+
Celluloid.shutdown
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "without celluloid" do
|
27
|
+
before(:all) { Object.send(:remove_const, :Celluloid) }
|
28
|
+
|
29
|
+
specify { expect { ::Celluloid }.to raise_error(NameError) }
|
30
|
+
specify { expect { load file }.to_not raise_error }
|
31
|
+
end
|
32
|
+
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -135,10 +135,18 @@ describe Appsignal do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
describe ".
|
139
|
-
it "should call
|
140
|
-
Appsignal::Extension.should_receive(:
|
141
|
-
Appsignal.
|
138
|
+
describe ".stop_agent" do
|
139
|
+
it "should call stop_agent on the extension" do
|
140
|
+
Appsignal::Extension.should_receive(:stop_agent)
|
141
|
+
Appsignal.stop_agent
|
142
|
+
Appsignal.active?.should be_false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe ".stop_extension" do
|
147
|
+
it "should call stop_extension on the extension" do
|
148
|
+
Appsignal::Extension.should_receive(:stop_extension)
|
149
|
+
Appsignal.stop_extension
|
142
150
|
Appsignal.active?.should be_false
|
143
151
|
end
|
144
152
|
end
|
@@ -409,7 +417,7 @@ describe Appsignal do
|
|
409
417
|
it "should format a log line" do
|
410
418
|
Process.stub(:pid => 100)
|
411
419
|
subject.call('Debug', Time.parse('2015-07-08'), nil, 'log line').should ==
|
412
|
-
|
420
|
+
"[2015-07-08T00:00:00 (process) #100][Debug] log line\n"
|
413
421
|
end
|
414
422
|
end
|
415
423
|
|
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.12.beta.
|
4
|
+
version: 0.12.beta.28
|
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: 2015-08-
|
15
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/appsignal/integrations/capistrano/appsignal.cap
|
160
160
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
161
161
|
- lib/appsignal/integrations/capistrano/careful_logger.rb
|
162
|
+
- lib/appsignal/integrations/celluloid.rb
|
162
163
|
- lib/appsignal/integrations/delayed_job.rb
|
163
164
|
- lib/appsignal/integrations/rails.rb
|
164
165
|
- lib/appsignal/integrations/resque.rb
|
@@ -197,6 +198,7 @@ files:
|
|
197
198
|
- spec/lib/appsignal/instrumentations/net_http_spec.rb
|
198
199
|
- spec/lib/appsignal/integrations/capistrano2_spec.rb
|
199
200
|
- spec/lib/appsignal/integrations/capistrano3_spec.rb
|
201
|
+
- spec/lib/appsignal/integrations/celluloid_spec.rb
|
200
202
|
- spec/lib/appsignal/integrations/delayed_job_spec.rb
|
201
203
|
- spec/lib/appsignal/integrations/rails_spec.rb
|
202
204
|
- spec/lib/appsignal/integrations/resque_spec.rb
|
@@ -266,6 +268,7 @@ test_files:
|
|
266
268
|
- spec/lib/appsignal/instrumentations/net_http_spec.rb
|
267
269
|
- spec/lib/appsignal/integrations/capistrano2_spec.rb
|
268
270
|
- spec/lib/appsignal/integrations/capistrano3_spec.rb
|
271
|
+
- spec/lib/appsignal/integrations/celluloid_spec.rb
|
269
272
|
- spec/lib/appsignal/integrations/delayed_job_spec.rb
|
270
273
|
- spec/lib/appsignal/integrations/rails_spec.rb
|
271
274
|
- spec/lib/appsignal/integrations/resque_spec.rb
|