appsignal 1.2.5 → 1.3.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/circle.yml +4 -0
  4. data/ext/agent.yml +11 -11
  5. data/ext/appsignal_extension.c +105 -40
  6. data/lib/appsignal.rb +18 -6
  7. data/lib/appsignal/cli/install.rb +3 -3
  8. data/lib/appsignal/config.rb +19 -5
  9. data/lib/appsignal/event_formatter.rb +3 -2
  10. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +1 -1
  11. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +1 -1
  12. data/lib/appsignal/event_formatter/moped/query_formatter.rb +13 -6
  13. data/lib/appsignal/hooks/mongo_ruby_driver.rb +0 -1
  14. data/lib/appsignal/hooks/net_http.rb +2 -5
  15. data/lib/appsignal/hooks/redis.rb +1 -1
  16. data/lib/appsignal/hooks/sequel.rb +8 -4
  17. data/lib/appsignal/integrations/mongo_ruby_driver.rb +1 -1
  18. data/lib/appsignal/integrations/object.rb +35 -0
  19. data/lib/appsignal/integrations/resque.rb +5 -0
  20. data/lib/appsignal/integrations/sinatra.rb +2 -2
  21. data/lib/appsignal/minutely.rb +41 -0
  22. data/lib/appsignal/params_sanitizer.rb +4 -105
  23. data/lib/appsignal/rack/sinatra_instrumentation.rb +25 -2
  24. data/lib/appsignal/transaction.rb +41 -15
  25. data/lib/appsignal/transmitter.rb +1 -1
  26. data/lib/appsignal/utils.rb +42 -47
  27. data/lib/appsignal/utils/params_sanitizer.rb +58 -0
  28. data/lib/appsignal/utils/query_params_sanitizer.rb +54 -0
  29. data/lib/appsignal/version.rb +1 -1
  30. data/spec/lib/appsignal/config_spec.rb +12 -2
  31. data/spec/lib/appsignal/extension_spec.rb +4 -0
  32. data/spec/lib/appsignal/hooks/net_http_spec.rb +20 -28
  33. data/spec/lib/appsignal/hooks/redis_spec.rb +9 -11
  34. data/spec/lib/appsignal/integrations/object_spec.rb +211 -0
  35. data/spec/lib/appsignal/integrations/sinatra_spec.rb +2 -2
  36. data/spec/lib/appsignal/minutely_spec.rb +54 -0
  37. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +50 -10
  38. data/spec/lib/appsignal/subscriber_spec.rb +5 -6
  39. data/spec/lib/appsignal/transaction_spec.rb +102 -23
  40. data/spec/lib/appsignal/transmitter_spec.rb +1 -1
  41. data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +122 -0
  42. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +194 -0
  43. data/spec/lib/appsignal/utils_spec.rb +13 -76
  44. data/spec/lib/appsignal_spec.rb +82 -13
  45. metadata +15 -11
  46. data/lib/appsignal/event_formatter/net_http/request_formatter.rb +0 -13
  47. data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +0 -13
  48. data/spec/lib/appsignal/event_formatter/net_http/request_formatter_spec.rb +0 -26
  49. data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +0 -22
  50. data/spec/lib/appsignal/params_sanitizer_spec.rb +0 -200
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: 1.2.5
4
+ version: 1.3.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -163,8 +163,6 @@ files:
163
163
  - lib/appsignal/event_formatter/faraday/request_formatter.rb
164
164
  - lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb
165
165
  - lib/appsignal/event_formatter/moped/query_formatter.rb
166
- - lib/appsignal/event_formatter/net_http/request_formatter.rb
167
- - lib/appsignal/event_formatter/sequel/sql_formatter.rb
168
166
  - lib/appsignal/extension.rb
169
167
  - lib/appsignal/hooks.rb
170
168
  - lib/appsignal/hooks/celluloid.rb
@@ -184,6 +182,7 @@ files:
184
182
  - lib/appsignal/integrations/delayed_job_plugin.rb
185
183
  - lib/appsignal/integrations/grape.rb
186
184
  - lib/appsignal/integrations/mongo_ruby_driver.rb
185
+ - lib/appsignal/integrations/object.rb
187
186
  - lib/appsignal/integrations/padrino.rb
188
187
  - lib/appsignal/integrations/railtie.rb
189
188
  - lib/appsignal/integrations/rake.rb
@@ -192,6 +191,7 @@ files:
192
191
  - lib/appsignal/integrations/sinatra.rb
193
192
  - lib/appsignal/js_exception_transaction.rb
194
193
  - lib/appsignal/marker.rb
194
+ - lib/appsignal/minutely.rb
195
195
  - lib/appsignal/params_sanitizer.rb
196
196
  - lib/appsignal/rack/generic_instrumentation.rb
197
197
  - lib/appsignal/rack/js_exception_catcher.rb
@@ -203,6 +203,8 @@ files:
203
203
  - lib/appsignal/transmitter.rb
204
204
  - lib/appsignal/update_active_support.rb
205
205
  - lib/appsignal/utils.rb
206
+ - lib/appsignal/utils/params_sanitizer.rb
207
+ - lib/appsignal/utils/query_params_sanitizer.rb
206
208
  - lib/appsignal/version.rb
207
209
  - lib/sequel/extensions/appsignal_integration.rb
208
210
  - lib/tasks/diag.rake
@@ -227,8 +229,6 @@ files:
227
229
  - spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
228
230
  - spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
229
231
  - spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
230
- - spec/lib/appsignal/event_formatter/net_http/request_formatter_spec.rb
231
- - spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
232
232
  - spec/lib/appsignal/event_formatter_spec.rb
233
233
  - spec/lib/appsignal/extension_spec.rb
234
234
  - spec/lib/appsignal/hooks/celluloid_spec.rb
@@ -246,6 +246,7 @@ files:
246
246
  - spec/lib/appsignal/hooks_spec.rb
247
247
  - spec/lib/appsignal/integrations/grape_spec.rb
248
248
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
249
+ - spec/lib/appsignal/integrations/object_spec.rb
249
250
  - spec/lib/appsignal/integrations/padrino_spec.rb
250
251
  - spec/lib/appsignal/integrations/railtie_spec.rb
251
252
  - spec/lib/appsignal/integrations/resque_active_job_spec.rb
@@ -253,7 +254,7 @@ files:
253
254
  - spec/lib/appsignal/integrations/sinatra_spec.rb
254
255
  - spec/lib/appsignal/js_exception_transaction_spec.rb
255
256
  - spec/lib/appsignal/marker_spec.rb
256
- - spec/lib/appsignal/params_sanitizer_spec.rb
257
+ - spec/lib/appsignal/minutely_spec.rb
257
258
  - spec/lib/appsignal/rack/generic_instrumentation_spec.rb
258
259
  - spec/lib/appsignal/rack/js_exception_catcher_spec.rb
259
260
  - spec/lib/appsignal/rack/rails_instrumentation_spec.rb
@@ -263,6 +264,8 @@ files:
263
264
  - spec/lib/appsignal/transaction_spec.rb
264
265
  - spec/lib/appsignal/transmitter_spec.rb
265
266
  - spec/lib/appsignal/update_active_support_spec.rb
267
+ - spec/lib/appsignal/utils/params_sanitizer_spec.rb
268
+ - spec/lib/appsignal/utils/query_params_sanitizer_spec.rb
266
269
  - spec/lib/appsignal/utils_spec.rb
267
270
  - spec/lib/appsignal_spec.rb
268
271
  - spec/lib/tmp/config/appsignal.yml
@@ -300,9 +303,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
303
  version: '1.9'
301
304
  required_rubygems_version: !ruby/object:Gem::Requirement
302
305
  requirements:
303
- - - ">="
306
+ - - ">"
304
307
  - !ruby/object:Gem::Version
305
- version: '0'
308
+ version: 1.3.1
306
309
  requirements: []
307
310
  rubyforge_project:
308
311
  rubygems_version: 2.4.5
@@ -325,8 +328,6 @@ test_files:
325
328
  - spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
326
329
  - spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
327
330
  - spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
328
- - spec/lib/appsignal/event_formatter/net_http/request_formatter_spec.rb
329
- - spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
330
331
  - spec/lib/appsignal/event_formatter_spec.rb
331
332
  - spec/lib/appsignal/extension_spec.rb
332
333
  - spec/lib/appsignal/hooks/celluloid_spec.rb
@@ -344,6 +345,7 @@ test_files:
344
345
  - spec/lib/appsignal/hooks_spec.rb
345
346
  - spec/lib/appsignal/integrations/grape_spec.rb
346
347
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
348
+ - spec/lib/appsignal/integrations/object_spec.rb
347
349
  - spec/lib/appsignal/integrations/padrino_spec.rb
348
350
  - spec/lib/appsignal/integrations/railtie_spec.rb
349
351
  - spec/lib/appsignal/integrations/resque_active_job_spec.rb
@@ -351,7 +353,7 @@ test_files:
351
353
  - spec/lib/appsignal/integrations/sinatra_spec.rb
352
354
  - spec/lib/appsignal/js_exception_transaction_spec.rb
353
355
  - spec/lib/appsignal/marker_spec.rb
354
- - spec/lib/appsignal/params_sanitizer_spec.rb
356
+ - spec/lib/appsignal/minutely_spec.rb
355
357
  - spec/lib/appsignal/rack/generic_instrumentation_spec.rb
356
358
  - spec/lib/appsignal/rack/js_exception_catcher_spec.rb
357
359
  - spec/lib/appsignal/rack/rails_instrumentation_spec.rb
@@ -361,6 +363,8 @@ test_files:
361
363
  - spec/lib/appsignal/transaction_spec.rb
362
364
  - spec/lib/appsignal/transmitter_spec.rb
363
365
  - spec/lib/appsignal/update_active_support_spec.rb
366
+ - spec/lib/appsignal/utils/params_sanitizer_spec.rb
367
+ - spec/lib/appsignal/utils/query_params_sanitizer_spec.rb
364
368
  - spec/lib/appsignal/utils_spec.rb
365
369
  - spec/lib/appsignal_spec.rb
366
370
  - spec/lib/tmp/config/appsignal.yml
@@ -1,13 +0,0 @@
1
- module Appsignal
2
- class EventFormatter
3
- module NetHttp
4
- class RequestFormatter < Appsignal::EventFormatter
5
- register 'request.net_http'
6
-
7
- def format(payload)
8
- ["#{payload[:method]} #{payload[:protocol]}://#{payload[:domain]}", nil]
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- module Appsignal
2
- class EventFormatter
3
- module Sequel
4
- class SqlFormatter < Appsignal::EventFormatter
5
- register 'sql.sequel'
6
-
7
- def format(payload)
8
- [nil, payload[:sql], SQL_BODY_FORMAT]
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Appsignal::EventFormatter::NetHttp::RequestFormatter do
4
- let(:klass) { Appsignal::EventFormatter::NetHttp::RequestFormatter }
5
- let(:formatter) { klass.new }
6
-
7
- it "should register request.net_http" do
8
- Appsignal::EventFormatter.registered?('request.net_http', klass).should be_true
9
- end
10
-
11
- describe "#format" do
12
- let(:payload) do
13
- {
14
- :protocol => 'http',
15
- :url => 'appsignal.com',
16
- :domain => 'appsignal.com',
17
- :path => '/about',
18
- :method => 'GET'
19
- }
20
- end
21
-
22
- subject { formatter.format(payload) }
23
-
24
- it { should == ['GET http://appsignal.com', nil] }
25
- end
26
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Appsignal::EventFormatter::Sequel::SqlFormatter do
4
- let(:klass) { Appsignal::EventFormatter::Sequel::SqlFormatter }
5
- let(:formatter) { klass.new }
6
-
7
- it "should register sql.sequel" do
8
- Appsignal::EventFormatter.registered?('sql.sequel', klass).should be_true
9
- end
10
-
11
- describe "#format" do
12
- let(:payload) do
13
- {
14
- sql: 'SELECT * FROM users'
15
- }
16
- end
17
-
18
- subject { formatter.format(payload) }
19
-
20
- it { should == [nil, 'SELECT * FROM users', 1] }
21
- end
22
- end
@@ -1,200 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class ErrorOnInspect
4
- def inspect
5
- raise 'Error'
6
- end
7
- end
8
-
9
- class ClassWithInspect
10
- def inspect
11
- "#<ClassWithInspect foo=\"bar\"/>"
12
- end
13
- end
14
-
15
- describe Appsignal::ParamsSanitizer do
16
- let(:klass) { Appsignal::ParamsSanitizer }
17
- let(:file) { uploaded_file }
18
- let(:params) do
19
- {
20
- :text => 'string',
21
- :file => file,
22
- :float => 0.0,
23
- :bool_true => true,
24
- :bool_false => false,
25
- :nil => nil,
26
- :int => 1,
27
- :hash => {
28
- :nested_text => 'string',
29
- :nested_array => [
30
- 'something',
31
- 'else',
32
- file,
33
- {
34
- :key => 'value',
35
- :file => file,
36
- },
37
- ErrorOnInspect.new,
38
- ClassWithInspect.new
39
- ]
40
- }
41
- }
42
- end
43
- let(:sanitized_params) { klass.sanitize(params) }
44
- let(:scrubbed_params) { klass.scrub(params) }
45
-
46
- describe ".sanitize!" do
47
- subject { params }
48
- before { klass.sanitize!(subject) }
49
-
50
- it { should be_instance_of Hash }
51
- its([:text]) { should == 'string' }
52
- its([:file]) { should be_instance_of String }
53
- its([:file]) { should include '::UploadedFile' }
54
- its([:float]) { should == 0.0 }
55
- its([:int]) { should == 1 }
56
- its([:bool_true]) { should == true }
57
- its([:bool_false]) { should == false }
58
- its([:nil]) { should == nil }
59
-
60
- context "hash" do
61
- subject { params[:hash] }
62
-
63
- it { should be_instance_of Hash }
64
- its([:nested_text]) { should == 'string' }
65
-
66
- context "nested_array" do
67
- subject { params[:hash][:nested_array] }
68
-
69
- it { should be_instance_of Array }
70
- its([0]) { should == 'something' }
71
- its([1]) { should == 'else' }
72
- its([2]) { should be_instance_of String }
73
- its([2]) { should include '::UploadedFile' }
74
- its([4]) { should == '#<ErrorOnInspect>' }
75
- its([5]) { should == '#<ClassWithInspect>' }
76
-
77
- context "nested hash" do
78
- subject { params[:hash][:nested_array][3] }
79
-
80
- it { should be_instance_of Hash }
81
- its([:key]) { should == 'value' }
82
- its([:file]) { should be_instance_of String }
83
- its([:file]) { should include '::UploadedFile' }
84
- end
85
- end
86
- end
87
- end
88
-
89
- describe ".sanitize" do
90
- subject { sanitized_params }
91
-
92
- it { should be_instance_of Hash }
93
- its([:text]) { should == 'string' }
94
- its([:file]) { should be_instance_of String }
95
- its([:file]) { should include '::UploadedFile' }
96
-
97
- it "does not change the original params" do
98
- subject
99
- params[:file].should == file
100
- params[:hash][:nested_array][2].should == file
101
- end
102
-
103
- context "hash" do
104
- subject { sanitized_params[:hash] }
105
-
106
- it { should be_instance_of Hash }
107
- its([:nested_text]) { should == 'string' }
108
-
109
- context "nested_array" do
110
- subject { sanitized_params[:hash][:nested_array] }
111
-
112
- it { should be_instance_of Array }
113
- its([0]) { should == 'something' }
114
- its([1]) { should == 'else' }
115
- its([2]) { should be_instance_of String }
116
- its([2]) { should include '::UploadedFile' }
117
-
118
- context "nested hash" do
119
- subject { sanitized_params[:hash][:nested_array][3] }
120
-
121
- it { should be_instance_of Hash }
122
- its([:key]) { should == 'value' }
123
- its([:file]) { should be_instance_of String }
124
- its([:file]) { should include '::UploadedFile' }
125
- end
126
- end
127
- end
128
- end
129
-
130
- describe ".scrub!" do
131
- subject { params }
132
- before { klass.scrub!(subject) }
133
-
134
- it { should be_instance_of Hash }
135
- its([:text]) { should == '?' }
136
- its([:file]) { should == '?' }
137
-
138
- context "hash" do
139
- subject { params[:hash] }
140
-
141
- it { should be_instance_of Hash }
142
- its([:nested_text]) { should == '?' }
143
-
144
- context "nested_array" do
145
- subject { params[:hash][:nested_array] }
146
-
147
- it { should be_instance_of Array }
148
- its([0]) { should == '?' }
149
- its([1]) { should == '?' }
150
- its([2]) { should == '?' }
151
-
152
- context "nested hash" do
153
- subject { params[:hash][:nested_array][3] }
154
-
155
- it { should be_instance_of Hash }
156
- its([:key]) { should == '?' }
157
- its([:file]) { should == '?' }
158
- end
159
- end
160
- end
161
- end
162
-
163
- describe ".scrub" do
164
- subject { scrubbed_params }
165
-
166
- it "does not change the original params" do
167
- subject
168
- params[:file].should == file
169
- params[:hash][:nested_array][2].should == file
170
- end
171
-
172
- it { should be_instance_of Hash }
173
- its([:text]) { should == '?' }
174
- its([:file]) { should == '?' }
175
-
176
- context "hash" do
177
- subject { scrubbed_params[:hash] }
178
-
179
- it { should be_instance_of Hash }
180
- its([:nested_text]) { should == '?' }
181
-
182
- context "nested_array" do
183
- subject { scrubbed_params[:hash][:nested_array] }
184
-
185
- it { should be_instance_of Array }
186
- its([0]) { should == '?' }
187
- its([1]) { should == '?' }
188
- its([2]) { should == '?' }
189
-
190
- context "nested hash" do
191
- subject { scrubbed_params[:hash][:nested_array][3] }
192
-
193
- it { should be_instance_of Hash }
194
- its([:key]) { should == '?' }
195
- its([:file]) { should == '?' }
196
- end
197
- end
198
- end
199
- end
200
- end