appsignal 1.0.7 → 1.1.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -21
- data/Rakefile +2 -0
- data/circle.yml +2 -1
- data/ext/agent.yml +7 -7
- data/ext/appsignal_extension.c +3 -5
- data/ext/extconf.rb +6 -15
- data/gemfiles/grape.gemfile +7 -0
- data/lib/appsignal/config.rb +2 -5
- data/lib/appsignal/event_formatter.rb +0 -2
- data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +47 -1
- data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +29 -0
- data/lib/appsignal/event_formatter/moped/query_formatter.rb +7 -6
- data/lib/appsignal/hooks.rb +33 -0
- data/lib/appsignal/hooks/net_http.rb +1 -1
- data/lib/appsignal/hooks/sequel.rb +7 -4
- data/lib/appsignal/hooks/sidekiq.rb +10 -19
- data/lib/appsignal/integrations/capistrano/appsignal.cap +1 -1
- data/lib/appsignal/integrations/delayed_job_plugin.rb +20 -11
- data/lib/appsignal/integrations/grape.rb +44 -0
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +5 -9
- data/lib/appsignal/integrations/railtie.rb +4 -0
- data/lib/appsignal/integrations/resque.rb +1 -1
- data/lib/appsignal/js_exception_transaction.rb +2 -3
- data/lib/appsignal/subscriber.rb +2 -3
- data/lib/appsignal/transaction.rb +2 -8
- data/lib/appsignal/transmitter.rb +1 -1
- data/lib/appsignal/utils.rb +7 -43
- data/lib/appsignal/version.rb +1 -1
- data/lib/tasks/diag.rake +75 -0
- data/spec/lib/appsignal/capistrano3_spec.rb +1 -21
- data/spec/lib/appsignal/config_spec.rb +0 -12
- 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 +186 -14
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +54 -0
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +4 -4
- data/spec/lib/appsignal/extension_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +49 -14
- data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +29 -62
- data/spec/lib/appsignal/hooks_spec.rb +115 -0
- data/spec/lib/appsignal/integrations/grape_spec.rb +94 -0
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +5 -8
- data/spec/lib/appsignal/integrations/resque_spec.rb +0 -1
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -1
- data/spec/lib/appsignal/subscriber_spec.rb +5 -23
- data/spec/lib/appsignal/transaction_spec.rb +0 -21
- data/spec/lib/appsignal/utils_spec.rb +1 -68
- data/spec/spec_helper.rb +16 -0
- data/spec/support/helpers/env_helpers.rb +0 -1
- data/spec/support/stubs/delayed_job.rb +0 -0
- metadata +15 -11
- data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +0 -88
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +0 -13
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +0 -115
- data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +0 -22
File without changes
|
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.0.
|
4
|
+
version: 1.1.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- ext/extconf.rb
|
136
136
|
- gemfiles/capistrano2.gemfile
|
137
137
|
- gemfiles/capistrano3.gemfile
|
138
|
+
- gemfiles/grape.gemfile
|
138
139
|
- gemfiles/no_dependencies.gemfile
|
139
140
|
- gemfiles/padrino.gemfile
|
140
141
|
- gemfiles/rails-3.2.gemfile
|
@@ -154,10 +155,9 @@ files:
|
|
154
155
|
- lib/appsignal/event_formatter/action_view/render_formatter.rb
|
155
156
|
- lib/appsignal/event_formatter/active_record/instantiation_formatter.rb
|
156
157
|
- lib/appsignal/event_formatter/active_record/sql_formatter.rb
|
157
|
-
- lib/appsignal/event_formatter/
|
158
|
+
- lib/appsignal/event_formatter/elastic_search/search_formatter.rb
|
158
159
|
- lib/appsignal/event_formatter/moped/query_formatter.rb
|
159
160
|
- lib/appsignal/event_formatter/net_http/request_formatter.rb
|
160
|
-
- lib/appsignal/event_formatter/sequel/sql_formatter.rb
|
161
161
|
- lib/appsignal/extension.rb
|
162
162
|
- lib/appsignal/hooks.rb
|
163
163
|
- lib/appsignal/hooks/celluloid.rb
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
176
176
|
- lib/appsignal/integrations/capistrano/careful_logger.rb
|
177
177
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
178
|
+
- lib/appsignal/integrations/grape.rb
|
178
179
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
179
180
|
- lib/appsignal/integrations/padrino.rb
|
180
181
|
- lib/appsignal/integrations/railtie.rb
|
@@ -198,6 +199,7 @@ files:
|
|
198
199
|
- lib/generators/appsignal/appsignal_generator.rb
|
199
200
|
- lib/generators/appsignal/templates/appsignal.yml
|
200
201
|
- lib/sequel/extensions/appsignal_integration.rb
|
202
|
+
- lib/tasks/diag.rake
|
201
203
|
- lib/vendor/active_support/notifications.rb
|
202
204
|
- lib/vendor/active_support/notifications/fanout.rb
|
203
205
|
- lib/vendor/active_support/notifications/instrumenter.rb
|
@@ -211,10 +213,9 @@ files:
|
|
211
213
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
212
214
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
213
215
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
214
|
-
- spec/lib/appsignal/event_formatter/
|
216
|
+
- spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb
|
215
217
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
216
218
|
- spec/lib/appsignal/event_formatter/net_http/request_formatter_spec.rb
|
217
|
-
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
218
219
|
- spec/lib/appsignal/event_formatter_spec.rb
|
219
220
|
- spec/lib/appsignal/extension_spec.rb
|
220
221
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
@@ -229,6 +230,7 @@ files:
|
|
229
230
|
- spec/lib/appsignal/hooks/sidekiq_spec.rb
|
230
231
|
- spec/lib/appsignal/hooks/unicorn_spec.rb
|
231
232
|
- spec/lib/appsignal/hooks_spec.rb
|
233
|
+
- spec/lib/appsignal/integrations/grape_spec.rb
|
232
234
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
233
235
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
234
236
|
- spec/lib/appsignal/integrations/railtie_spec.rb
|
@@ -262,6 +264,7 @@ files:
|
|
262
264
|
- spec/support/project_fixture/config/appsignal.yml
|
263
265
|
- spec/support/project_fixture/log/.gitkeep
|
264
266
|
- spec/support/rails/my_app.rb
|
267
|
+
- spec/support/stubs/delayed_job.rb
|
265
268
|
homepage: https://github.com/appsignal/appsignal
|
266
269
|
licenses:
|
267
270
|
- MIT
|
@@ -278,12 +281,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
281
|
version: '1.9'
|
279
282
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
283
|
requirements:
|
281
|
-
- - "
|
284
|
+
- - ">"
|
282
285
|
- !ruby/object:Gem::Version
|
283
|
-
version:
|
286
|
+
version: 1.3.1
|
284
287
|
requirements: []
|
285
288
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
289
|
+
rubygems_version: 2.2.5
|
287
290
|
signing_key:
|
288
291
|
specification_version: 4
|
289
292
|
summary: Logs performance and exception data from your app to appsignal.com
|
@@ -296,10 +299,9 @@ test_files:
|
|
296
299
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
297
300
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
298
301
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
299
|
-
- spec/lib/appsignal/event_formatter/
|
302
|
+
- spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb
|
300
303
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
301
304
|
- spec/lib/appsignal/event_formatter/net_http/request_formatter_spec.rb
|
302
|
-
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
303
305
|
- spec/lib/appsignal/event_formatter_spec.rb
|
304
306
|
- spec/lib/appsignal/extension_spec.rb
|
305
307
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
@@ -314,6 +316,7 @@ test_files:
|
|
314
316
|
- spec/lib/appsignal/hooks/sidekiq_spec.rb
|
315
317
|
- spec/lib/appsignal/hooks/unicorn_spec.rb
|
316
318
|
- spec/lib/appsignal/hooks_spec.rb
|
319
|
+
- spec/lib/appsignal/integrations/grape_spec.rb
|
317
320
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
318
321
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
319
322
|
- spec/lib/appsignal/integrations/railtie_spec.rb
|
@@ -347,3 +350,4 @@ test_files:
|
|
347
350
|
- spec/support/project_fixture/config/appsignal.yml
|
348
351
|
- spec/support/project_fixture/log/.gitkeep
|
349
352
|
- spec/support/rails/my_app.rb
|
353
|
+
- spec/support/stubs/delayed_job.rb
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Appsignal
|
2
|
-
class EventFormatter
|
3
|
-
module MongoRubyDriver
|
4
|
-
class QueryFormatter
|
5
|
-
ALLOWED = {
|
6
|
-
"find" => {
|
7
|
-
"find" => :allow,
|
8
|
-
"filter" => :sanitize_document
|
9
|
-
},
|
10
|
-
"count" => {
|
11
|
-
"count" => :allow,
|
12
|
-
"query" => :sanitize_document
|
13
|
-
},
|
14
|
-
"distinct" => {
|
15
|
-
"distinct" => :allow,
|
16
|
-
"key" => :allow,
|
17
|
-
"query" => :sanitize_document
|
18
|
-
},
|
19
|
-
"insert" => {
|
20
|
-
"insert" => :allow,
|
21
|
-
"documents" => :deny_array,
|
22
|
-
"ordered" => :allow
|
23
|
-
},
|
24
|
-
"update" => {
|
25
|
-
"update" => :allow,
|
26
|
-
"updates" => :sanitize_bulk,
|
27
|
-
"ordered" => :allow
|
28
|
-
},
|
29
|
-
"findandmodify" => {
|
30
|
-
"findandmodify" => :allow,
|
31
|
-
"query" => :sanitize_document,
|
32
|
-
"update" => :deny_array,
|
33
|
-
"new" => :allow
|
34
|
-
},
|
35
|
-
"delete" => {
|
36
|
-
"delete" => :allow,
|
37
|
-
"deletes" => :sanitize_bulk,
|
38
|
-
"ordered" => :allow
|
39
|
-
},
|
40
|
-
"bulk" => {
|
41
|
-
"q" => :sanitize_document,
|
42
|
-
"u" => :deny_array,
|
43
|
-
"limit" => :allow,
|
44
|
-
"multi" => :allow,
|
45
|
-
"upsert" => :allow
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
# Format command based on given strategy
|
50
|
-
def self.format(strategy, command)
|
51
|
-
# Stop processing if command is not a hash
|
52
|
-
return {} unless command.is_a?(Hash)
|
53
|
-
|
54
|
-
# Get the strategy and stop if it's not present
|
55
|
-
strategies = ALLOWED[strategy.to_s]
|
56
|
-
return {} unless strategies
|
57
|
-
|
58
|
-
{}.tap do |hsh|
|
59
|
-
command.each do |key, val|
|
60
|
-
hsh[key] = self.apply_strategy(strategies[key], val)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Applies strategy on hash values based on keys
|
66
|
-
def self.apply_strategy(strategy, val)
|
67
|
-
case strategy
|
68
|
-
when :allow then val
|
69
|
-
when :deny then '?'
|
70
|
-
when :deny_array then '[?]'
|
71
|
-
when :sanitize_document
|
72
|
-
Appsignal::Utils.sanitize(val, true, :mongodb)
|
73
|
-
when :sanitize_bulk
|
74
|
-
if val.length > 1
|
75
|
-
[
|
76
|
-
self.format(:bulk, val.first),
|
77
|
-
"[...]"
|
78
|
-
]
|
79
|
-
else
|
80
|
-
val.map { |v| self.format(:bulk, v) }
|
81
|
-
end
|
82
|
-
else '?'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter do
|
4
|
-
let(:formatter) { Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter }
|
5
|
-
|
6
|
-
describe ".format" do
|
7
|
-
let(:strategy) { :find }
|
8
|
-
let(:command) do
|
9
|
-
{
|
10
|
-
"find" => "users",
|
11
|
-
"filter" => {"_id" => 1}
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should apply a strategy for each key" do
|
16
|
-
expect( formatter ).to receive(:apply_strategy)
|
17
|
-
.with(:sanitize_document, {"_id" => 1})
|
18
|
-
|
19
|
-
expect( formatter ).to receive(:apply_strategy)
|
20
|
-
.with(:allow, "users")
|
21
|
-
|
22
|
-
formatter.format(strategy, command)
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when strategy is unkown" do
|
26
|
-
let(:strategy) { :bananas }
|
27
|
-
|
28
|
-
it "should return an empty hash" do
|
29
|
-
expect( formatter.format(strategy, command) ).to eql({})
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "when command is not a hash " do
|
34
|
-
let(:command) { :bananas }
|
35
|
-
|
36
|
-
it "should return an empty hash" do
|
37
|
-
expect( formatter.format(strategy, command) ).to eql({})
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe ".apply_strategy" do
|
43
|
-
context "when strategy is allow" do
|
44
|
-
let(:strategy) { :allow }
|
45
|
-
let(:value) { {"_id" => 1} }
|
46
|
-
|
47
|
-
it "should return the given value" do
|
48
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql(value)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "when strategy is deny" do
|
53
|
-
let(:strategy) { :deny }
|
54
|
-
let(:value) { {"_id" => 1} }
|
55
|
-
|
56
|
-
it "should return a '?'" do
|
57
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql('?')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "when strategy is deny_array" do
|
62
|
-
let(:strategy) { :deny_array }
|
63
|
-
let(:value) { {"_id" => 1} }
|
64
|
-
|
65
|
-
it "should return a sanitized array string" do
|
66
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql("[?]")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "when strategy is sanitize_document" do
|
71
|
-
let(:strategy) { :sanitize_document }
|
72
|
-
let(:value) { {"_id" => 1} }
|
73
|
-
|
74
|
-
it "should return a sanitized document" do
|
75
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql({"_id" => '?'})
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context "when strategy is sanitize_bulk" do
|
80
|
-
let(:strategy) { :sanitize_bulk }
|
81
|
-
let(:value) { [{"q" => {"_id" => 1}, "u" => [{"foo" => "bar"}]}] }
|
82
|
-
|
83
|
-
it "should return an array of sanitized bulk documents" do
|
84
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql([
|
85
|
-
{"q" => {"_id" => '?'}, "u" => '[?]'}
|
86
|
-
])
|
87
|
-
end
|
88
|
-
|
89
|
-
context "when bulk has more than one update" do
|
90
|
-
let(:value) do
|
91
|
-
[
|
92
|
-
{"q" => {"_id" => 1}, "u" => [{"foo" => "bar"}]},
|
93
|
-
{"q" => {"_id" => 2}, "u" => [{"foo" => "baz"}]},
|
94
|
-
]
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should return only the first value of sanitized bulk documents" do
|
98
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql([
|
99
|
-
{"q" => {"_id" => '?'}, "u" => '[?]'},
|
100
|
-
"[...]"
|
101
|
-
])
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context "when strategy is missing" do
|
107
|
-
let(:strategy) { nil }
|
108
|
-
let(:value) { {"_id" => 1} }
|
109
|
-
|
110
|
-
it "should return a '?'" do
|
111
|
-
expect( formatter.apply_strategy(strategy, value) ).to eql('?')
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
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
|