appsignal 0.11.13 → 0.11.14.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/appsignal/integrations/rake.rb +8 -0
- data/lib/appsignal/integrations/sidekiq.rb +1 -1
- data/lib/appsignal/params_sanitizer.rb +7 -1
- data/lib/appsignal/transmitter.rb +7 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/integrations/rake_spec.rb +23 -8
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +17 -0
- data/spec/lib/appsignal/params_sanitizer_spec.rb +16 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19f6aa00101f3a4629f9d5d7393ddace658ee343
|
4
|
+
data.tar.gz: 22377b463a085c914a89dd38635806f24ec97724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee40a6f511ac2bc1e4e3c439a99ac45a1f434538745e96bdd822ac85bdf7272dc5bd9d3458a6e6f3f96264beaa7772f2c995f5f1518376d57fe87a8e4e49413
|
7
|
+
data.tar.gz: d92cc1b8994f031eae4b088853ac59e205c6493e182592d98b25cfc841a968568d41d4b93f8a633079ded8c9ff3e583ea4d956d778ac55211d89844235bcc8b3
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@ module Rake
|
|
3
3
|
alias_method :invoke_without_appsignal, :invoke
|
4
4
|
|
5
5
|
def invoke(*args)
|
6
|
+
if Appsignal.active?
|
7
|
+
invoke_with_appsignal(*args)
|
8
|
+
else
|
9
|
+
invoke_without_appsignal(*args)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def invoke_with_appsignal(*args)
|
6
14
|
transaction = Appsignal::Transaction.create(
|
7
15
|
SecureRandom.uuid,
|
8
16
|
ENV,
|
@@ -15,7 +15,7 @@ if defined?(::Sidekiq)
|
|
15
15
|
def call(worker, item, queue)
|
16
16
|
Appsignal.monitor_transaction(
|
17
17
|
'perform_job.sidekiq',
|
18
|
-
:class => item['class'],
|
18
|
+
:class => item['wrapped'] || item['class'],
|
19
19
|
:method => 'perform',
|
20
20
|
:metadata => formatted_metadata(item),
|
21
21
|
:params => format_args(item['args']),
|
@@ -25,8 +25,10 @@ module Appsignal
|
|
25
25
|
sanitize_hash(value)
|
26
26
|
when Array
|
27
27
|
sanitize_array(value)
|
28
|
-
when Fixnum, String, Symbol
|
28
|
+
when Fixnum, String, Symbol, Float
|
29
29
|
unmodified(value)
|
30
|
+
when TrueClass, FalseClass
|
31
|
+
stringified(value)
|
30
32
|
else
|
31
33
|
inspected(value)
|
32
34
|
end
|
@@ -46,6 +48,10 @@ module Appsignal
|
|
46
48
|
target_array
|
47
49
|
end
|
48
50
|
|
51
|
+
def stringified(value)
|
52
|
+
value.to_s
|
53
|
+
end
|
54
|
+
|
49
55
|
def unmodified(value)
|
50
56
|
value
|
51
57
|
end
|
@@ -62,7 +62,13 @@ module Appsignal
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def http_client
|
65
|
-
|
65
|
+
client = if config[:http_proxy]
|
66
|
+
Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port)
|
67
|
+
else
|
68
|
+
Net::HTTP.new(uri.host, uri.port)
|
69
|
+
end
|
70
|
+
|
71
|
+
client.tap do |http|
|
66
72
|
if uri.scheme == 'https'
|
67
73
|
http.use_ssl = true
|
68
74
|
http.ssl_version = :TLSv1
|
data/lib/appsignal/version.rb
CHANGED
@@ -6,20 +6,35 @@ describe "Rack integration" do
|
|
6
6
|
let(:task) { Rake::Task.new('task', app) }
|
7
7
|
before do
|
8
8
|
load file
|
9
|
+
task.stub(
|
10
|
+
:name => 'task:name',
|
11
|
+
:invoke_without_appsignal => true
|
12
|
+
)
|
9
13
|
end
|
10
14
|
|
11
15
|
describe "#invoke" do
|
12
|
-
before
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
)
|
16
|
+
before { Appsignal.stub(:active? => true) }
|
17
|
+
|
18
|
+
it "should call with appsignal monitoring" do
|
19
|
+
expect( task ).to receive(:invoke_with_appsignal).with(['foo'])
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
context "when not active" do
|
23
|
+
before { Appsignal.stub(:active? => false) }
|
24
|
+
|
25
|
+
it "should NOT call with appsignal monitoring" do
|
26
|
+
expect( task ).to_not receive(:invoke_with_appsignal).with(['foo'])
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should call the original task" do
|
30
|
+
expect( task ).to receive(:invoke_without_appsignal).with(['foo'])
|
31
|
+
end
|
21
32
|
end
|
22
33
|
|
34
|
+
after { task.invoke(['foo']) }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#invoke_with_appsignal" do
|
23
38
|
context "with transaction" do
|
24
39
|
let!(:transaction) { Appsignal::Transaction.new('123', {}) }
|
25
40
|
let!(:agent) { double('Agent', :send_queue => true) }
|
@@ -81,6 +96,6 @@ describe "Rack integration" do
|
|
81
96
|
end
|
82
97
|
end
|
83
98
|
|
84
|
-
after { task.
|
99
|
+
after { task.invoke_with_appsignal('foo') rescue VerySpecificError }
|
85
100
|
end
|
86
101
|
end
|
@@ -47,6 +47,23 @@ describe "Sidekiq integration" do
|
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
50
|
+
it "reports the correct job class for a ActiveJob wrapped job" do
|
51
|
+
item['wrapped'] = 'ActiveJobClass'
|
52
|
+
Appsignal.should_receive(:monitor_transaction).with(
|
53
|
+
'perform_job.sidekiq',
|
54
|
+
:class => 'ActiveJobClass',
|
55
|
+
:method => 'perform',
|
56
|
+
:metadata => {
|
57
|
+
'retry_count' => "0",
|
58
|
+
'queue' => 'default',
|
59
|
+
'extra' => 'data',
|
60
|
+
'wrapped' => 'ActiveJobClass'
|
61
|
+
},
|
62
|
+
:params => ['Model', "1"],
|
63
|
+
:queue_start => Time.parse('01-01-2001 10:00:00UTC')
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
50
67
|
after do
|
51
68
|
Timecop.freeze(Time.parse('01-01-2001 10:01:00UTC')) do
|
52
69
|
Appsignal::Integrations::SidekiqPlugin.new.call(worker, item, queue) do
|
@@ -17,16 +17,20 @@ describe Appsignal::ParamsSanitizer do
|
|
17
17
|
let(:file) { uploaded_file }
|
18
18
|
let(:params) do
|
19
19
|
{
|
20
|
-
:text
|
21
|
-
:file
|
22
|
-
:
|
23
|
-
|
20
|
+
:text => 'string',
|
21
|
+
:file => file,
|
22
|
+
:float => 0.0,
|
23
|
+
:bool_true => true,
|
24
|
+
:bool_false => false,
|
25
|
+
:int => 1,
|
26
|
+
:hash => {
|
27
|
+
:nested_text => 'string',
|
24
28
|
:nested_array => [
|
25
29
|
'something',
|
26
30
|
'else',
|
27
31
|
file,
|
28
32
|
{
|
29
|
-
:key
|
33
|
+
:key => 'value',
|
30
34
|
:file => file,
|
31
35
|
},
|
32
36
|
ErrorOnInspect.new,
|
@@ -43,9 +47,13 @@ describe Appsignal::ParamsSanitizer do
|
|
43
47
|
before { klass.sanitize!(subject) }
|
44
48
|
|
45
49
|
it { should be_instance_of Hash }
|
46
|
-
its([:text])
|
47
|
-
its([:file])
|
48
|
-
its([:file])
|
50
|
+
its([:text]) { should == 'string' }
|
51
|
+
its([:file]) { should be_instance_of String }
|
52
|
+
its([:file]) { should include '::UploadedFile' }
|
53
|
+
its([:float]) { should == 0.0 }
|
54
|
+
its([:int]) { should == 1 }
|
55
|
+
its([:bool_true]) { should == 'true' }
|
56
|
+
its([:bool_false]) { should == 'false' }
|
49
57
|
|
50
58
|
context "hash" do
|
51
59
|
subject { params[:hash] }
|
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.11.
|
4
|
+
version: 0.11.14.beta.1
|
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-31 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -261,9 +261,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '1.9'
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
|
-
- - "
|
264
|
+
- - ">"
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
266
|
+
version: 1.3.1
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
269
|
rubygems_version: 2.4.5
|