appsignal 0.4.7 → 0.5.0
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.
- data/.ruby-version +1 -0
- data/README.md +20 -19
- data/appsignal.gemspec +2 -2
- data/lib/appsignal.rb +41 -18
- data/lib/appsignal/agent.rb +28 -54
- data/lib/appsignal/aggregator.rb +65 -0
- data/lib/appsignal/aggregator/post_processor.rb +27 -0
- data/lib/appsignal/config.rb +9 -4
- data/lib/appsignal/listener.rb +30 -0
- data/lib/appsignal/middleware.rb +4 -30
- data/lib/appsignal/middleware/action_view_sanitizer.rb +21 -0
- data/lib/appsignal/middleware/active_record_sanitizer.rb +60 -0
- data/lib/appsignal/middleware/chain.rb +99 -0
- data/lib/appsignal/middleware/delete_blanks.rb +12 -0
- data/lib/appsignal/railtie.rb +9 -1
- data/lib/appsignal/to_appsignal_hash.rb +23 -0
- data/lib/appsignal/transaction.rb +72 -16
- data/lib/appsignal/transaction/params_sanitizer.rb +91 -13
- data/lib/appsignal/transaction/transaction_formatter.rb +32 -68
- data/lib/appsignal/version.rb +1 -1
- data/spec/appsignal/agent_spec.rb +46 -156
- data/spec/appsignal/aggregator/post_processor_spec.rb +84 -0
- data/spec/appsignal/aggregator_spec.rb +182 -0
- data/spec/appsignal/inactive_railtie_spec.rb +2 -1
- data/spec/appsignal/{middleware_spec.rb → listener_spec.rb} +2 -2
- data/spec/appsignal/middleware/action_view_sanitizer_spec.rb +27 -0
- data/spec/appsignal/middleware/active_record_sanitizer_spec.rb +201 -0
- data/spec/appsignal/middleware/chain_spec.rb +168 -0
- data/spec/appsignal/middleware/delete_blanks_spec.rb +37 -0
- data/spec/appsignal/railtie_spec.rb +47 -34
- data/spec/appsignal/to_appsignal_hash_spec.rb +29 -0
- data/spec/appsignal/transaction/params_sanitizer_spec.rb +141 -36
- data/spec/appsignal/transaction/transaction_formatter_spec.rb +60 -155
- data/spec/appsignal/transaction_spec.rb +186 -53
- data/spec/appsignal/transmitter_spec.rb +11 -6
- data/spec/appsignal_spec.rb +33 -0
- data/spec/spec_helper.rb +9 -62
- data/spec/support/helpers/notification_helpers.rb +30 -0
- data/spec/support/helpers/transaction_helpers.rb +64 -0
- metadata +74 -63
- data/.rvmrc +0 -1
- data/lib/appsignal/transaction/faulty_request_formatter.rb +0 -30
- data/lib/appsignal/transaction/regular_request_formatter.rb +0 -11
- data/lib/appsignal/transaction/slow_request_formatter.rb +0 -34
- data/spec/appsignal/transaction/faulty_request_formatter_spec.rb +0 -49
- data/spec/appsignal/transaction/regular_request_formatter_spec.rb +0 -14
- data/spec/appsignal/transaction/slow_request_formatter_spec.rb +0 -76
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Appsignal::TransactionFormatter::FaultyRequestFormatter do
|
4
|
-
let(:parent) { Appsignal::TransactionFormatter }
|
5
|
-
let(:transaction) { transaction_with_exception }
|
6
|
-
let(:faulty) { parent::FaultyRequestFormatter.new(transaction) }
|
7
|
-
subject { faulty }
|
8
|
-
|
9
|
-
describe "#to_hash" do
|
10
|
-
it "can call #to_hash on its superclass" do
|
11
|
-
parent.new(transaction).respond_to?(:to_hash).should be_true
|
12
|
-
end
|
13
|
-
|
14
|
-
context "return value" do
|
15
|
-
subject { faulty.to_hash }
|
16
|
-
before { faulty.stub(:formatted_exception => :faulty_request) }
|
17
|
-
|
18
|
-
it "includes the exception" do
|
19
|
-
subject[:exception].should == :faulty_request
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# protected
|
25
|
-
|
26
|
-
it { should delegate(:backtrace).to(:exception) }
|
27
|
-
it { should delegate(:name).to(:exception) }
|
28
|
-
it { should delegate(:message).to(:exception) }
|
29
|
-
|
30
|
-
describe "#formatted_exception" do
|
31
|
-
subject { faulty.send(:formatted_exception) }
|
32
|
-
|
33
|
-
its(:keys) { should include :backtrace }
|
34
|
-
its(:keys) { should include :exception }
|
35
|
-
its(:keys) { should include :message }
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#basic_process_action_event" do
|
39
|
-
subject { faulty.send(:basic_process_action_event) }
|
40
|
-
|
41
|
-
it "should return a hash with extra keys" do
|
42
|
-
subject[:environment].should == {
|
43
|
-
"HTTP_USER_AGENT" => "IE6",
|
44
|
-
"SERVER_NAME" => "localhost"
|
45
|
-
}
|
46
|
-
subject[:session_data].should == {}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Appsignal::TransactionFormatter::RegularRequestFormatter do
|
4
|
-
let(:parent) { Appsignal::TransactionFormatter }
|
5
|
-
let(:transaction) { appsignal_transaction }
|
6
|
-
let(:klass) { parent::RegularRequestFormatter }
|
7
|
-
let(:regular) { klass.new(transaction) }
|
8
|
-
|
9
|
-
describe "#sanitized_event_payload" do
|
10
|
-
subject { regular.sanitized_event_payload(:whatever, :arguments) }
|
11
|
-
|
12
|
-
it { should == {} }
|
13
|
-
end
|
14
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
describe Appsignal::TransactionFormatter::SlowRequestFormatter do
|
5
|
-
let(:parent) { Appsignal::TransactionFormatter }
|
6
|
-
let(:transaction) { slow_transaction }
|
7
|
-
let(:klass) { parent::SlowRequestFormatter }
|
8
|
-
let(:slow) { klass.new(transaction) }
|
9
|
-
|
10
|
-
describe "#to_hash" do
|
11
|
-
subject { slow.to_hash }
|
12
|
-
before { slow.stub(:detailed_events => :startled) }
|
13
|
-
|
14
|
-
it "includes events" do
|
15
|
-
subject[:events].should == :startled
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# protected
|
20
|
-
|
21
|
-
context "with an event" do
|
22
|
-
let(:start_time) { Time.at(2.71828182) }
|
23
|
-
let(:end_time) { Time.at(3.141592654) }
|
24
|
-
let(:event) do
|
25
|
-
mock(
|
26
|
-
:event,
|
27
|
-
:name => 'Startled',
|
28
|
-
:duration => 2,
|
29
|
-
:time => start_time,
|
30
|
-
:end => end_time,
|
31
|
-
:payload => {
|
32
|
-
:controller => 'controller',
|
33
|
-
:action => 'action',
|
34
|
-
:sensitive => 'data'
|
35
|
-
}
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#detailed_events" do
|
40
|
-
subject { slow.send(:detailed_events) }
|
41
|
-
before do
|
42
|
-
slow.stub(
|
43
|
-
:events => [event],
|
44
|
-
:format => :foo
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
it { should == [:foo] }
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#format" do
|
52
|
-
subject { slow.send(:format, event) }
|
53
|
-
before { slow.stub(:sanitized_event_payload => :sanitized) }
|
54
|
-
|
55
|
-
it { should == {
|
56
|
-
:name => 'Startled',
|
57
|
-
:duration => 2,
|
58
|
-
:time => start_time.to_f,
|
59
|
-
:end => end_time.to_f,
|
60
|
-
:payload => :sanitized
|
61
|
-
} }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#basic_process_action_event" do
|
66
|
-
subject { slow.send(:basic_process_action_event) }
|
67
|
-
|
68
|
-
it "should return a hash with extra keys" do
|
69
|
-
subject[:environment].should == {
|
70
|
-
"HTTP_USER_AGENT" => "IE6",
|
71
|
-
"SERVER_NAME" => "localhost"
|
72
|
-
}
|
73
|
-
subject[:session_data].should == {}
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|