appsignal 2.11.1.beta.2 → 2.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.semaphore/semaphore.yml +197 -0
- data/CHANGELOG.md +19 -0
- data/README.md +9 -0
- data/Rakefile +9 -6
- data/build_matrix.yml +13 -0
- data/ext/agent.yml +17 -17
- data/ext/base.rb +12 -9
- data/gemfiles/no_dependencies.gemfile +7 -0
- data/gemfiles/resque-2.gemfile +0 -1
- data/gemfiles/webmachine.gemfile +1 -0
- data/lib/appsignal/cli/diagnose/utils.rb +8 -11
- data/lib/appsignal/cli/install.rb +5 -8
- data/lib/appsignal/helpers/instrumentation.rb +32 -0
- data/lib/appsignal/hooks/shoryuken.rb +43 -4
- data/lib/appsignal/integrations/object.rb +4 -34
- data/lib/appsignal/integrations/object_ruby_19.rb +37 -0
- data/lib/appsignal/integrations/object_ruby_modern.rb +64 -0
- data/lib/appsignal/system.rb +4 -0
- data/lib/appsignal/transaction.rb +30 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/hooks/resque_spec.rb +10 -2
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +151 -104
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +4 -2
- data/spec/lib/appsignal/integrations/object_19_spec.rb +266 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +29 -10
- data/spec/lib/appsignal/transaction_spec.rb +55 -0
- data/spec/lib/appsignal_spec.rb +30 -0
- metadata +12 -8
@@ -1,18 +1,30 @@
|
|
1
1
|
require "appsignal/integrations/object"
|
2
2
|
|
3
|
+
def is_ruby_19
|
4
|
+
RUBY_VERSION < "2.0"
|
5
|
+
end
|
6
|
+
|
3
7
|
describe Object do
|
4
8
|
describe "#instrument_method" do
|
5
9
|
context "with instance method" do
|
6
10
|
let(:klass) do
|
7
11
|
Class.new do
|
8
|
-
def foo
|
9
|
-
|
12
|
+
def foo(param1, options = {}, keyword_param: 1)
|
13
|
+
[param1, options, keyword_param]
|
10
14
|
end
|
11
15
|
appsignal_instrument_method :foo
|
12
16
|
end
|
13
17
|
end
|
14
18
|
let(:instance) { klass.new }
|
15
19
|
|
20
|
+
def call_with_arguments
|
21
|
+
instance.foo(
|
22
|
+
"abc",
|
23
|
+
{ :foo => "bar" },
|
24
|
+
:keyword_param => 2
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
16
28
|
context "when active" do
|
17
29
|
let(:transaction) { http_request_transaction }
|
18
30
|
before do
|
@@ -27,7 +39,7 @@ describe Object do
|
|
27
39
|
expect(transaction).to receive(:start_event)
|
28
40
|
expect(transaction).to receive(:finish_event).with \
|
29
41
|
"foo.AnonymousClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
|
30
|
-
expect(
|
42
|
+
expect(call_with_arguments).to eq(["abc", { :foo => "bar" }, 2])
|
31
43
|
end
|
32
44
|
end
|
33
45
|
|
@@ -116,10 +128,10 @@ describe Object do
|
|
116
128
|
context "when not active" do
|
117
129
|
let(:transaction) { Appsignal::Transaction.current }
|
118
130
|
|
119
|
-
it "
|
131
|
+
it "does not instrument, but still calls the method" do
|
120
132
|
expect(Appsignal.active?).to be_falsy
|
121
133
|
expect(transaction).to_not receive(:start_event)
|
122
|
-
expect(
|
134
|
+
expect(call_with_arguments).to eq(["abc", { :foo => "bar" }, 2])
|
123
135
|
end
|
124
136
|
end
|
125
137
|
end
|
@@ -127,12 +139,19 @@ describe Object do
|
|
127
139
|
context "with class method" do
|
128
140
|
let(:klass) do
|
129
141
|
Class.new do
|
130
|
-
def self.bar
|
131
|
-
|
142
|
+
def self.bar(param1, options = {}, keyword_param: 1)
|
143
|
+
[param1, options, keyword_param]
|
132
144
|
end
|
133
145
|
appsignal_instrument_class_method :bar
|
134
146
|
end
|
135
147
|
end
|
148
|
+
def call_with_arguments
|
149
|
+
klass.bar(
|
150
|
+
"abc",
|
151
|
+
{ :foo => "bar" },
|
152
|
+
:keyword_param => 2
|
153
|
+
)
|
154
|
+
end
|
136
155
|
|
137
156
|
context "when active" do
|
138
157
|
let(:transaction) { http_request_transaction }
|
@@ -149,7 +168,7 @@ describe Object do
|
|
149
168
|
expect(transaction).to receive(:start_event)
|
150
169
|
expect(transaction).to receive(:finish_event).with \
|
151
170
|
"bar.class_method.AnonymousClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
|
152
|
-
expect(
|
171
|
+
expect(call_with_arguments).to eq(["abc", { :foo => "bar" }, 2])
|
153
172
|
end
|
154
173
|
end
|
155
174
|
|
@@ -238,10 +257,10 @@ describe Object do
|
|
238
257
|
context "when not active" do
|
239
258
|
let(:transaction) { Appsignal::Transaction.current }
|
240
259
|
|
241
|
-
it "
|
260
|
+
it "does not instrument, but still call the method" do
|
242
261
|
expect(Appsignal.active?).to be_falsy
|
243
262
|
expect(transaction).to_not receive(:start_event)
|
244
|
-
expect(
|
263
|
+
expect(call_with_arguments).to eq(["abc", { :foo => "bar" }, 2])
|
245
264
|
end
|
246
265
|
end
|
247
266
|
end
|
@@ -356,6 +356,57 @@ describe Appsignal::Transaction do
|
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
359
|
+
describe "#add_breadcrumb" do
|
360
|
+
context "when over the limit" do
|
361
|
+
before do
|
362
|
+
22.times do |i|
|
363
|
+
transaction.add_breadcrumb(
|
364
|
+
"network",
|
365
|
+
"GET http://localhost",
|
366
|
+
"User made external network request",
|
367
|
+
{ :code => i + 1 },
|
368
|
+
Time.parse("10-10-2010 10:00:00 UTC")
|
369
|
+
)
|
370
|
+
end
|
371
|
+
transaction.sample_data
|
372
|
+
end
|
373
|
+
|
374
|
+
it "stores last <LIMIT> breadcrumbs on the transaction" do
|
375
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"].length).to eql(20)
|
376
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"][0]).to eq(
|
377
|
+
"action" => "GET http://localhost",
|
378
|
+
"category" => "network",
|
379
|
+
"message" => "User made external network request",
|
380
|
+
"metadata" => { "code" => 3 },
|
381
|
+
"time" => 1286704800 # rubocop:disable Style/NumericLiterals
|
382
|
+
)
|
383
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"][19]).to eq(
|
384
|
+
"action" => "GET http://localhost",
|
385
|
+
"category" => "network",
|
386
|
+
"message" => "User made external network request",
|
387
|
+
"metadata" => { "code" => 22 },
|
388
|
+
"time" => 1286704800 # rubocop:disable Style/NumericLiterals
|
389
|
+
)
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
context "with defaults" do
|
394
|
+
it "stores breadcrumb with defaults on transaction" do
|
395
|
+
timeframe_start = Time.now.utc.to_i
|
396
|
+
transaction.add_breadcrumb("user_action", "clicked HOME")
|
397
|
+
transaction.sample_data
|
398
|
+
timeframe_end = Time.now.utc.to_i
|
399
|
+
|
400
|
+
breadcrumb = transaction.to_h["sample_data"]["breadcrumbs"][0]
|
401
|
+
expect(breadcrumb["category"]).to eq("user_action")
|
402
|
+
expect(breadcrumb["action"]).to eq("clicked HOME")
|
403
|
+
expect(breadcrumb["message"]).to eq("")
|
404
|
+
expect(breadcrumb["time"]).to be_between(timeframe_start, timeframe_end)
|
405
|
+
expect(breadcrumb["metadata"]).to eq({})
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
359
410
|
describe "#set_action" do
|
360
411
|
context "when the action is set" do
|
361
412
|
it "updates the action name on the transaction" do
|
@@ -649,6 +700,10 @@ describe Appsignal::Transaction do
|
|
649
700
|
"tags",
|
650
701
|
Appsignal::Utils::Data.generate({})
|
651
702
|
).once
|
703
|
+
expect(transaction.ext).to receive(:set_sample_data).with(
|
704
|
+
"breadcrumbs",
|
705
|
+
Appsignal::Utils::Data.generate([])
|
706
|
+
).once
|
652
707
|
|
653
708
|
transaction.sample_data
|
654
709
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -491,6 +491,36 @@ describe Appsignal do
|
|
491
491
|
end
|
492
492
|
end
|
493
493
|
|
494
|
+
describe ".add_breadcrumb" do
|
495
|
+
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
496
|
+
|
497
|
+
context "with transaction" do
|
498
|
+
let(:transaction) { double }
|
499
|
+
it "should call add_breadcrumb on transaction" do
|
500
|
+
expect(transaction).to receive(:add_breadcrumb)
|
501
|
+
.with("Network", "http", "User made network request", { :response => 200 }, fixed_time)
|
502
|
+
end
|
503
|
+
|
504
|
+
after do
|
505
|
+
Appsignal.add_breadcrumb(
|
506
|
+
"Network",
|
507
|
+
"http",
|
508
|
+
"User made network request",
|
509
|
+
{ :response => 200 },
|
510
|
+
fixed_time
|
511
|
+
)
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
context "without transaction" do
|
516
|
+
let(:transaction) { nil }
|
517
|
+
|
518
|
+
it "should not call add_breadcrumb on transaction" do
|
519
|
+
expect(Appsignal.add_breadcrumb("Network", "http")).to be_falsy
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
494
524
|
describe "custom stats" do
|
495
525
|
let(:tags) { { :foo => "bar" } }
|
496
526
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
8
8
|
- Thijs Cadier
|
9
9
|
- Tom de Bruijn
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -233,6 +233,8 @@ files:
|
|
233
233
|
- lib/appsignal/integrations/grape.rb
|
234
234
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
235
235
|
- lib/appsignal/integrations/object.rb
|
236
|
+
- lib/appsignal/integrations/object_ruby_19.rb
|
237
|
+
- lib/appsignal/integrations/object_ruby_modern.rb
|
236
238
|
- lib/appsignal/integrations/padrino.rb
|
237
239
|
- lib/appsignal/integrations/que.rb
|
238
240
|
- lib/appsignal/integrations/railtie.rb
|
@@ -322,6 +324,7 @@ files:
|
|
322
324
|
- spec/lib/appsignal/integrations/data_mapper_spec.rb
|
323
325
|
- spec/lib/appsignal/integrations/grape_spec.rb
|
324
326
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
327
|
+
- spec/lib/appsignal/integrations/object_19_spec.rb
|
325
328
|
- spec/lib/appsignal/integrations/object_spec.rb
|
326
329
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
327
330
|
- spec/lib/appsignal/integrations/que_spec.rb
|
@@ -399,7 +402,7 @@ metadata:
|
|
399
402
|
documentation_uri: https://docs.appsignal.com/ruby/
|
400
403
|
homepage_uri: https://docs.appsignal.com/ruby/
|
401
404
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
402
|
-
post_install_message:
|
405
|
+
post_install_message:
|
403
406
|
rdoc_options: []
|
404
407
|
require_paths:
|
405
408
|
- lib
|
@@ -411,12 +414,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
411
414
|
version: '1.9'
|
412
415
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
413
416
|
requirements:
|
414
|
-
- - "
|
417
|
+
- - ">="
|
415
418
|
- !ruby/object:Gem::Version
|
416
|
-
version:
|
419
|
+
version: '0'
|
417
420
|
requirements: []
|
418
|
-
rubygems_version: 3.
|
419
|
-
signing_key:
|
421
|
+
rubygems_version: 3.2.6
|
422
|
+
signing_key:
|
420
423
|
specification_version: 4
|
421
424
|
summary: Logs performance and exception data from your app to appsignal.com
|
422
425
|
test_files:
|
@@ -474,6 +477,7 @@ test_files:
|
|
474
477
|
- spec/lib/appsignal/integrations/data_mapper_spec.rb
|
475
478
|
- spec/lib/appsignal/integrations/grape_spec.rb
|
476
479
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
480
|
+
- spec/lib/appsignal/integrations/object_19_spec.rb
|
477
481
|
- spec/lib/appsignal/integrations/object_spec.rb
|
478
482
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
479
483
|
- spec/lib/appsignal/integrations/que_spec.rb
|