appsignal 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/CHANGELOG.md +5 -1
- data/README.md +21 -6
- data/Rakefile +7 -3
- data/ext/extconf.rb +3 -3
- data/lib/appsignal.rb +15 -4
- data/lib/appsignal/cli.rb +2 -1
- data/lib/appsignal/cli/diagnose.rb +2 -2
- data/lib/appsignal/cli/install.rb +1 -1
- data/lib/appsignal/config.rb +1 -1
- data/lib/appsignal/hooks.rb +5 -1
- data/lib/appsignal/transaction.rb +18 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +3 -6
- data/spec/lib/appsignal/cli/install_spec.rb +4 -4
- data/spec/lib/appsignal/config_spec.rb +37 -37
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +3 -3
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +7 -7
- data/spec/lib/appsignal/event_formatter_spec.rb +4 -4
- data/spec/lib/appsignal/hooks/redis_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/hooks_spec.rb +13 -13
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/railtie_spec.rb +6 -6
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +1 -1
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -2
- data/spec/lib/appsignal/subscriber_spec.rb +4 -4
- data/spec/lib/appsignal/transaction_spec.rb +44 -25
- data/spec/lib/appsignal/transmitter_spec.rb +9 -9
- data/spec/lib/appsignal/utils_spec.rb +2 -2
- data/spec/lib/appsignal_spec.rb +14 -15
- metadata +2 -2
@@ -14,7 +14,7 @@ if rails_present?
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#root_path" do
|
17
|
-
its(:root_path) { should
|
17
|
+
its(:root_path) { should eq '/var/www/app/20130101/' }
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#format" do
|
@@ -23,13 +23,13 @@ if rails_present?
|
|
23
23
|
context "with an identifier" do
|
24
24
|
let(:payload) { {:identifier => '/var/www/app/20130101/app/views/home/index/html.erb'} }
|
25
25
|
|
26
|
-
it { should
|
26
|
+
it { should eq ['app/views/home/index/html.erb', nil] }
|
27
27
|
end
|
28
28
|
|
29
29
|
context "with a frozen identifier" do
|
30
30
|
let(:payload) { {:identifier => '/var/www/app/20130101/app/views/home/index/html.erb'.freeze} }
|
31
31
|
|
32
|
-
it { should
|
32
|
+
it { should eq ['app/views/home/index/html.erb', nil] }
|
33
33
|
end
|
34
34
|
|
35
35
|
context "without an identifier" do
|
@@ -18,6 +18,6 @@ describe Appsignal::EventFormatter::Faraday::RequestFormatter do
|
|
18
18
|
|
19
19
|
subject { formatter.format(payload) }
|
20
20
|
|
21
|
-
it { should
|
21
|
+
it { should eq ['GET http://example.org', 'GET http://example.org/hello/world'] }
|
22
22
|
end
|
23
23
|
end
|
@@ -27,7 +27,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
-
it { should
|
30
|
+
it { should eq ['Command', '{:database=>"database.collection", :selector=>{"query"=>"?"}}'] }
|
31
31
|
end
|
32
32
|
|
33
33
|
context "Moped::Protocol::Query" do
|
@@ -43,7 +43,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
46
|
-
it { should
|
46
|
+
it { should eq ['Query', '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[], :limit=>0, :skip=>0, :fields=>nil}'] }
|
47
47
|
end
|
48
48
|
|
49
49
|
context "Moped::Protocol::Delete" do
|
@@ -56,7 +56,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
56
56
|
)
|
57
57
|
end
|
58
58
|
|
59
|
-
it { should
|
59
|
+
it { should eq ['Delete', '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[]}'] }
|
60
60
|
end
|
61
61
|
|
62
62
|
context "Moped::Protocol::Insert" do
|
@@ -72,7 +72,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
|
-
it { should
|
75
|
+
it { should eq ['Insert', '{:database=>"database.collection", :documents=>{"_id"=>"?", "events"=>"?"}, :count=>2, :flags=>[]}'] }
|
76
76
|
end
|
77
77
|
|
78
78
|
context "Moped::Protocol::Update" do
|
@@ -86,7 +86,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
86
86
|
)
|
87
87
|
end
|
88
88
|
|
89
|
-
it { should
|
89
|
+
it { should eq ['Update', '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :update=>{"user.?"=>"?"}, :flags=>[]}'] }
|
90
90
|
end
|
91
91
|
|
92
92
|
context "Moped::Protocol::KillCursors" do
|
@@ -97,7 +97,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
97
97
|
)
|
98
98
|
end
|
99
99
|
|
100
|
-
it { should
|
100
|
+
it { should eq ['KillCursors', '{:number_of_cursor_ids=>2}'] }
|
101
101
|
end
|
102
102
|
|
103
103
|
context "Moped::Protocol::Other" do
|
@@ -108,7 +108,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
108
108
|
)
|
109
109
|
end
|
110
110
|
|
111
|
-
it { should
|
111
|
+
it { should eq ['Other', '{:database=>"database.collection"}'] }
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -69,10 +69,10 @@ describe Appsignal::EventFormatter do
|
|
69
69
|
klass.register('mock.specific', MockFormatter)
|
70
70
|
Appsignal::EventFormatter.initialize_formatters
|
71
71
|
|
72
|
-
klass.formatter_classes['mock.specific'].should
|
72
|
+
klass.formatter_classes['mock.specific'].should eq MockFormatter
|
73
73
|
klass.registered?('mock.specific').should be_true
|
74
74
|
klass.formatters['mock.specific'].should be_instance_of(MockFormatter)
|
75
|
-
klass.formatters['mock.specific'].body.should
|
75
|
+
klass.formatters['mock.specific'].body.should eq 'some value'
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should not have a formatter that's not registered" do
|
@@ -92,11 +92,11 @@ describe Appsignal::EventFormatter do
|
|
92
92
|
|
93
93
|
context "calling formatters" do
|
94
94
|
it "should return nil if there is no formatter registered" do
|
95
|
-
klass.format('nonsense', {}).should
|
95
|
+
klass.format('nonsense', {}).should be_nil
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should call the formatter if it is registered and use a value set in the initializer" do
|
99
|
-
klass.format('mock', {}).should
|
99
|
+
klass.format('mock', {}).should eq ['title', 'some value']
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
@@ -105,7 +105,7 @@ describe Appsignal::Hooks::SidekiqPlugin do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should only add items to the hash that do not appear in JOB_KEYS" do
|
108
|
-
plugin.formatted_metadata(item).should
|
108
|
+
plugin.formatted_metadata(item).should eq({'foo' => 'bar'})
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -87,20 +87,20 @@ describe Appsignal::Hooks::Helpers do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should truncate the text to 200 chars max" do
|
90
|
-
with_helpers.truncate(very_long_text).should
|
90
|
+
with_helpers.truncate(very_long_text).should eq "#{'a' * 197}..."
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
describe "#string_or_inspect" do
|
95
95
|
context "when string" do
|
96
96
|
it "should return the string" do
|
97
|
-
with_helpers.string_or_inspect('foo').should
|
97
|
+
with_helpers.string_or_inspect('foo').should eq 'foo'
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
context "when integer" do
|
102
102
|
it "should return the string" do
|
103
|
-
with_helpers.string_or_inspect(1).should
|
103
|
+
with_helpers.string_or_inspect(1).should eq '1'
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -108,7 +108,7 @@ describe Appsignal::Hooks::Helpers do
|
|
108
108
|
let(:object) { Object.new }
|
109
109
|
|
110
110
|
it "should return the string" do
|
111
|
-
with_helpers.string_or_inspect(object).should
|
111
|
+
with_helpers.string_or_inspect(object).should eq object.inspect
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -120,7 +120,7 @@ describe Appsignal::Hooks::Helpers do
|
|
120
120
|
context "when the key exists" do
|
121
121
|
subject { with_helpers.extract_value(hash, :key) }
|
122
122
|
|
123
|
-
it { should
|
123
|
+
it { should eq 'value' }
|
124
124
|
end
|
125
125
|
|
126
126
|
context "when the key does not exist" do
|
@@ -131,7 +131,7 @@ describe Appsignal::Hooks::Helpers do
|
|
131
131
|
context "with a default value" do
|
132
132
|
subject { with_helpers.extract_value(hash, :nonexistent_key, 1) }
|
133
133
|
|
134
|
-
it { should
|
134
|
+
it { should eq 1 }
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -145,7 +145,7 @@ describe Appsignal::Hooks::Helpers do
|
|
145
145
|
context "when the key exists" do
|
146
146
|
subject { with_helpers.extract_value(struct, :key) }
|
147
147
|
|
148
|
-
it { should
|
148
|
+
it { should eq 'value' }
|
149
149
|
end
|
150
150
|
|
151
151
|
context "when the key does not exist" do
|
@@ -156,7 +156,7 @@ describe Appsignal::Hooks::Helpers do
|
|
156
156
|
context "with a default value" do
|
157
157
|
subject { with_helpers.extract_value(struct, :nonexistent_key, 1) }
|
158
158
|
|
159
|
-
it { should
|
159
|
+
it { should eq 1 }
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
@@ -167,7 +167,7 @@ describe Appsignal::Hooks::Helpers do
|
|
167
167
|
context "when the method exists" do
|
168
168
|
subject { with_helpers.extract_value(object, :existing_method) }
|
169
169
|
|
170
|
-
it { should
|
170
|
+
it { should eq 'value' }
|
171
171
|
end
|
172
172
|
|
173
173
|
context "when the method does not exist" do
|
@@ -178,7 +178,7 @@ describe Appsignal::Hooks::Helpers do
|
|
178
178
|
context "and there is a default value" do
|
179
179
|
subject { with_helpers.extract_value(object, :nonexistent_method, 1) }
|
180
180
|
|
181
|
-
it { should
|
181
|
+
it { should eq 1 }
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
@@ -189,7 +189,7 @@ describe Appsignal::Hooks::Helpers do
|
|
189
189
|
|
190
190
|
subject { with_helpers.extract_value(object, :existing_method, nil, true) }
|
191
191
|
|
192
|
-
it { should
|
192
|
+
it { should eq '1' }
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
@@ -205,12 +205,12 @@ describe Appsignal::Hooks::Helpers do
|
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should format the arguments" do
|
208
|
-
with_helpers.format_args(args).should
|
208
|
+
with_helpers.format_args(args).should eq([
|
209
209
|
'Model',
|
210
210
|
'1',
|
211
211
|
object.inspect,
|
212
212
|
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ...'
|
213
|
-
]
|
213
|
+
])
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
@@ -27,7 +27,7 @@ describe Appsignal::Hooks::MongoMonitorSubscriber do
|
|
27
27
|
it "should store command on the transaction" do
|
28
28
|
subscriber.started(event)
|
29
29
|
|
30
|
-
transaction.store('mongo_driver').should
|
30
|
+
transaction.store('mongo_driver').should eq({1 => {'foo' => '?'}})
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should start an event in the extension" do
|
@@ -29,17 +29,17 @@ if rails_present?
|
|
29
29
|
|
30
30
|
it { should be_a(Appsignal::Config) }
|
31
31
|
|
32
|
-
its(:root_path) { should
|
33
|
-
its(:env) { should
|
34
|
-
its([:name]) { should
|
35
|
-
its([:log_path]) { should
|
32
|
+
its(:root_path) { should eq Pathname.new(project_fixture_path) }
|
33
|
+
its(:env) { should eq 'test' }
|
34
|
+
its([:name]) { should eq 'TestApp' }
|
35
|
+
its([:log_path]) { should eq Pathname.new(File.join(project_fixture_path, 'log')) }
|
36
36
|
end
|
37
37
|
|
38
38
|
context "initial config" do
|
39
39
|
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
40
40
|
subject { Appsignal.config.initial_config }
|
41
41
|
|
42
|
-
its([:name]) { should
|
42
|
+
its([:name]) { should eq 'MyApp' }
|
43
43
|
end
|
44
44
|
|
45
45
|
context "with APPSIGNAL_APP_ENV ENV var set" do
|
@@ -48,7 +48,7 @@ if rails_present?
|
|
48
48
|
Appsignal::Integrations::Railtie.initialize_appsignal(app)
|
49
49
|
end
|
50
50
|
|
51
|
-
its(:env) { should
|
51
|
+
its(:env) { should eq 'env_test' }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -99,13 +99,13 @@ if defined?(::Rails)
|
|
99
99
|
context "with request id set" do
|
100
100
|
let(:env) { {'action_dispatch.request_id' => 'id'} }
|
101
101
|
|
102
|
-
it { should
|
102
|
+
it { should eq 'id' }
|
103
103
|
end
|
104
104
|
|
105
105
|
context "with request id not set" do
|
106
106
|
let(:env) { {} }
|
107
107
|
|
108
|
-
its(:length) { should
|
108
|
+
its(:length) { should eq 36 }
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -21,7 +21,7 @@ describe Appsignal::Subscriber do
|
|
21
21
|
it "should be in the subscriber list" do
|
22
22
|
ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers).select do |s|
|
23
23
|
s.instance_variable_get(:@delegate).is_a?(Appsignal::Subscriber)
|
24
|
-
end.count.should
|
24
|
+
end.count.should eq 1
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -33,7 +33,7 @@ describe Appsignal::Subscriber do
|
|
33
33
|
|
34
34
|
ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers).select do |s|
|
35
35
|
s.instance_variable_get(:@delegate).is_a?(Appsignal::Subscriber)
|
36
|
-
end.count.should
|
36
|
+
end.count.should eq 2
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -44,7 +44,7 @@ describe Appsignal::Subscriber do
|
|
44
44
|
|
45
45
|
ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers).select do |s|
|
46
46
|
s.instance_variable_get(:@delegate).is_a?(Appsignal::Subscriber)
|
47
|
-
end.count.should
|
47
|
+
end.count.should eq 0
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -55,7 +55,7 @@ describe Appsignal::Subscriber do
|
|
55
55
|
|
56
56
|
ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers).select do |s|
|
57
57
|
s.instance_variable_get(:@delegate).is_a?(Appsignal::Subscriber)
|
58
|
-
end.count.should
|
58
|
+
end.count.should eq 1
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -29,15 +29,15 @@ describe Appsignal::Transaction do
|
|
29
29
|
|
30
30
|
created_transaction = Appsignal::Transaction.create('1', namespace, request, options)
|
31
31
|
|
32
|
-
Thread.current[:appsignal_transaction].should
|
32
|
+
Thread.current[:appsignal_transaction].should eq created_transaction
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should create a transaction" do
|
36
36
|
created_transaction = Appsignal::Transaction.create('1', namespace, request, options)
|
37
37
|
|
38
38
|
created_transaction.should be_a Appsignal::Transaction
|
39
|
-
created_transaction.transaction_id.should
|
40
|
-
created_transaction.namespace.should
|
39
|
+
created_transaction.transaction_id.should eq '1'
|
40
|
+
created_transaction.namespace.should eq 'http_request'
|
41
41
|
end
|
42
42
|
|
43
43
|
context "when a transaction is already running" do
|
@@ -78,7 +78,7 @@ describe Appsignal::Transaction do
|
|
78
78
|
before { Appsignal::Transaction.create('1', namespace, request, options) }
|
79
79
|
|
80
80
|
it "should return the correct transaction" do
|
81
|
-
should
|
81
|
+
should eq transaction
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should indicate it's not a nil transaction" do
|
@@ -119,6 +119,25 @@ describe Appsignal::Transaction do
|
|
119
119
|
|
120
120
|
Thread.current[:appsignal_transaction].should be_nil
|
121
121
|
end
|
122
|
+
|
123
|
+
context "if a transaction is discarded" do
|
124
|
+
it "should not complete the transaction" do
|
125
|
+
Appsignal::Transaction.current.should_not_receive(:complete)
|
126
|
+
|
127
|
+
Appsignal::Transaction.current.discard!
|
128
|
+
expect(Appsignal::Transaction.current.discarded?).to be_true
|
129
|
+
Appsignal::Transaction.complete_current!
|
130
|
+
|
131
|
+
Thread.current[:appsignal_transaction].should be_nil
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should not be discarded when restore! is called" do
|
135
|
+
Appsignal::Transaction.current.discard!
|
136
|
+
expect(Appsignal::Transaction.current.discarded?).to be_true
|
137
|
+
Appsignal::Transaction.current.restore!
|
138
|
+
expect(Appsignal::Transaction.current.discarded?).to be_false
|
139
|
+
end
|
140
|
+
end
|
122
141
|
end
|
123
142
|
end
|
124
143
|
|
@@ -180,21 +199,21 @@ describe Appsignal::Transaction do
|
|
180
199
|
subject { transaction }
|
181
200
|
|
182
201
|
its(:ext) { should_not be_nil }
|
183
|
-
its(:transaction_id) { should
|
184
|
-
its(:namespace) { should
|
202
|
+
its(:transaction_id) { should eq '1' }
|
203
|
+
its(:namespace) { should eq 'http_request' }
|
185
204
|
its(:request) { should_not be_nil }
|
186
205
|
its(:paused) { should be_false }
|
187
|
-
its(:tags) { should
|
206
|
+
its(:tags) { should eq({}) }
|
188
207
|
|
189
208
|
context "options" do
|
190
209
|
subject { transaction.options }
|
191
210
|
|
192
|
-
its([:params_method]) { should
|
211
|
+
its([:params_method]) { should eq :params }
|
193
212
|
|
194
213
|
context "with overridden options" do
|
195
214
|
let(:options) { {:params_method => :filtered_params} }
|
196
215
|
|
197
|
-
its([:params_method]) { should
|
216
|
+
its([:params_method]) { should eq :filtered_params }
|
198
217
|
end
|
199
218
|
end
|
200
219
|
end
|
@@ -553,8 +572,8 @@ describe Appsignal::Transaction do
|
|
553
572
|
}
|
554
573
|
end
|
555
574
|
|
556
|
-
its(:env) { should
|
557
|
-
its(:params) { should
|
575
|
+
its(:env) { should eq env }
|
576
|
+
its(:params) { should eq({:id => 1}) }
|
558
577
|
end
|
559
578
|
end
|
560
579
|
|
@@ -564,13 +583,13 @@ describe Appsignal::Transaction do
|
|
564
583
|
subject { transaction.send(:background_queue_start) }
|
565
584
|
|
566
585
|
context "when queue start is nil" do
|
567
|
-
it { should
|
586
|
+
it { should eq nil }
|
568
587
|
end
|
569
588
|
|
570
589
|
context "when queue start is set" do
|
571
590
|
let(:env) { background_env_with_data }
|
572
591
|
|
573
|
-
it { should
|
592
|
+
it { should eq 1389783590000 }
|
574
593
|
end
|
575
594
|
end
|
576
595
|
|
@@ -595,7 +614,7 @@ describe Appsignal::Transaction do
|
|
595
614
|
context "with the HTTP_X_REQUEST_START header set" do
|
596
615
|
let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_value}"} }
|
597
616
|
|
598
|
-
it { should
|
617
|
+
it { should eq 1389783599600 }
|
599
618
|
|
600
619
|
context "with unparsable content" do
|
601
620
|
let(:env) { {'HTTP_X_REQUEST_START' => 'something'} }
|
@@ -606,7 +625,7 @@ describe Appsignal::Transaction do
|
|
606
625
|
context "with some cruft" do
|
607
626
|
let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_value}aaaa"} }
|
608
627
|
|
609
|
-
it { should
|
628
|
+
it { should eq 1389783599600 }
|
610
629
|
end
|
611
630
|
|
612
631
|
context "with a really low number" do
|
@@ -618,7 +637,7 @@ describe Appsignal::Transaction do
|
|
618
637
|
context "with the alternate HTTP_X_QUEUE_START header set" do
|
619
638
|
let(:env) { {'HTTP_X_QUEUE_START' => "t=#{slightly_earlier_time_value}"} }
|
620
639
|
|
621
|
-
it { should
|
640
|
+
it { should eq 1389783599600 }
|
622
641
|
end
|
623
642
|
end
|
624
643
|
end
|
@@ -669,13 +688,13 @@ describe Appsignal::Transaction do
|
|
669
688
|
Appsignal::Transaction::GenericRequest.new(background_env_with_data(:params => ['arg1', 'arg2']))
|
670
689
|
end
|
671
690
|
|
672
|
-
it { should
|
691
|
+
it { should eq ['arg1', 'arg2'] }
|
673
692
|
|
674
693
|
context "with AppSignal filtering" do
|
675
694
|
before { Appsignal.config.config_hash[:filter_parameters] = %w(foo) }
|
676
695
|
after { Appsignal.config.config_hash[:filter_parameters] = [] }
|
677
696
|
|
678
|
-
it { should
|
697
|
+
it { should eq ['arg1', 'arg2'] }
|
679
698
|
end
|
680
699
|
end
|
681
700
|
|
@@ -688,7 +707,7 @@ describe Appsignal::Transaction do
|
|
688
707
|
|
689
708
|
it "should call the params sanitizer" do
|
690
709
|
puts Appsignal.config.config_hash[:filter_parameters].inspect
|
691
|
-
subject.should
|
710
|
+
subject.should eq({:foo => :bar })
|
692
711
|
end
|
693
712
|
end
|
694
713
|
|
@@ -701,10 +720,10 @@ describe Appsignal::Transaction do
|
|
701
720
|
after { Appsignal.config.config_hash[:filter_parameters] = [] }
|
702
721
|
|
703
722
|
it "should call the params sanitizer with filtering" do
|
704
|
-
subject.should
|
723
|
+
subject.should eq({
|
705
724
|
:foo => '[FILTERED]',
|
706
725
|
:baz => :bat
|
707
|
-
}
|
726
|
+
})
|
708
727
|
end
|
709
728
|
end
|
710
729
|
end
|
@@ -746,7 +765,7 @@ describe Appsignal::Transaction do
|
|
746
765
|
context "when env is empty" do
|
747
766
|
before { transaction.request.stub(:session => {}) }
|
748
767
|
|
749
|
-
it { should
|
768
|
+
it { should eq({}) }
|
750
769
|
end
|
751
770
|
|
752
771
|
context "when request class does not have a session method" do
|
@@ -765,7 +784,7 @@ describe Appsignal::Transaction do
|
|
765
784
|
it "passes the session data into the params sanitizer" do
|
766
785
|
Appsignal::Utils::ParamsSanitizer.should_receive(:sanitize).with({:foo => :bar}).
|
767
786
|
and_return(:sanitized_foo)
|
768
|
-
subject.should
|
787
|
+
subject.should eq :sanitized_foo
|
769
788
|
end
|
770
789
|
|
771
790
|
if defined? ActionDispatch::Request::Session
|
@@ -817,7 +836,7 @@ describe Appsignal::Transaction do
|
|
817
836
|
context "when env is present" do
|
818
837
|
let(:env) { {:metadata => {:key => 'value'}} }
|
819
838
|
|
820
|
-
it { should
|
839
|
+
it { should eq env[:metadata] }
|
821
840
|
end
|
822
841
|
end
|
823
842
|
|
@@ -852,7 +871,7 @@ describe Appsignal::Transaction do
|
|
852
871
|
describe "#cleaned_backtrace" do
|
853
872
|
subject { transaction.send(:cleaned_backtrace, ['line 1']) }
|
854
873
|
|
855
|
-
it { should
|
874
|
+
it { should eq ['line 1'] }
|
856
875
|
|
857
876
|
pending "calls Rails backtrace cleaner if Rails is present"
|
858
877
|
end
|