appsignal 2.10.7-java → 2.11.0.alpha.2-java
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.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +45 -53
- data/CHANGELOG.md +18 -0
- data/build_matrix.yml +13 -6
- data/ext/agent.yml +19 -19
- data/ext/appsignal_extension.c +10 -1
- data/ext/base.rb +15 -4
- data/gemfiles/padrino.gemfile +2 -2
- data/lib/appsignal.rb +21 -1
- data/lib/appsignal/capistrano.rb +2 -0
- data/lib/appsignal/config.rb +6 -2
- data/lib/appsignal/environment.rb +126 -0
- data/lib/appsignal/extension/jruby.rb +10 -0
- data/lib/appsignal/hooks/net_http.rb +2 -0
- data/lib/appsignal/hooks/puma.rb +2 -58
- data/lib/appsignal/hooks/redis.rb +2 -0
- data/lib/appsignal/hooks/sequel.rb +2 -0
- data/lib/appsignal/hooks/sidekiq.rb +2 -99
- data/lib/appsignal/integrations/delayed_job_plugin.rb +16 -3
- data/lib/appsignal/integrations/object.rb +4 -0
- data/lib/appsignal/integrations/resque_active_job.rb +12 -4
- data/lib/appsignal/probes/puma.rb +61 -0
- data/lib/appsignal/probes/sidekiq.rb +102 -0
- data/lib/appsignal/rack/js_exception_catcher.rb +5 -2
- data/lib/appsignal/transaction.rb +22 -7
- data/lib/appsignal/version.rb +1 -1
- data/lib/puma/plugin/appsignal.rb +2 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +2 -1
- data/spec/lib/appsignal/config_spec.rb +6 -1
- data/spec/lib/appsignal/environment_spec.rb +167 -0
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +198 -166
- data/spec/lib/appsignal/hooks/puma_spec.rb +2 -181
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +256 -462
- data/spec/lib/appsignal/integrations/padrino_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +55 -13
- data/spec/lib/appsignal/probes/puma_spec.rb +180 -0
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +201 -0
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +9 -4
- data/spec/lib/appsignal/transaction_spec.rb +30 -13
- data/spec/lib/appsignal_spec.rb +22 -0
- data/spec/lib/puma/appsignal_spec.rb +1 -1
- data/spec/support/helpers/dependency_helper.rb +5 -0
- data/spec/support/helpers/env_helpers.rb +1 -1
- data/spec/support/helpers/environment_metdata_helper.rb +16 -0
- data/spec/support/stubs/sidekiq/api.rb +1 -1
- metadata +19 -8
@@ -4,9 +4,12 @@ describe Appsignal::Rack::JSExceptionCatcher do
|
|
4
4
|
let(:config_options) { { :enable_frontend_error_catching => true } }
|
5
5
|
let(:config) { project_fixture_config("production", config_options) }
|
6
6
|
let(:deprecation_message) do
|
7
|
-
"The Appsignal::Rack::JSExceptionCatcher is
|
8
|
-
"
|
9
|
-
"
|
7
|
+
"The Appsignal::Rack::JSExceptionCatcher is " \
|
8
|
+
"deprecated and will be removed in a future version. Please use " \
|
9
|
+
"the official AppSignal JavaScript integration by disabling " \
|
10
|
+
"`enable_frontend_error_catching` in your configuration and " \
|
11
|
+
"installing AppSignal for JavaScript instead. " \
|
12
|
+
"(https://docs.appsignal.com/front-end/)"
|
10
13
|
end
|
11
14
|
before { Appsignal.config = config }
|
12
15
|
|
@@ -32,7 +35,9 @@ describe Appsignal::Rack::JSExceptionCatcher do
|
|
32
35
|
|
33
36
|
describe "#call" do
|
34
37
|
let(:catcher) do
|
35
|
-
silence
|
38
|
+
silence :allowed => ["enable_frontend_error_catching"] do
|
39
|
+
Appsignal::Rack::JSExceptionCatcher.new(app, options)
|
40
|
+
end
|
36
41
|
end
|
37
42
|
after { catcher.call(env) }
|
38
43
|
|
@@ -500,23 +500,40 @@ describe Appsignal::Transaction do
|
|
500
500
|
end
|
501
501
|
|
502
502
|
describe "#set_http_or_background_queue_start" do
|
503
|
-
|
504
|
-
|
505
|
-
let(:env) { { "HTTP_X_REQUEST_START" => (fixed_time * 1000).to_s } }
|
503
|
+
let(:header_factor) { 1_000 }
|
504
|
+
let(:env_queue_start) { fixed_time + 20 } # in seconds
|
506
505
|
|
507
|
-
|
508
|
-
|
506
|
+
context "when a queue time is found in a request header" do
|
507
|
+
let(:header_time) { ((fixed_time + 10) * header_factor).to_i } # in milliseconds
|
508
|
+
let(:env) { { "HTTP_X_REQUEST_START" => "t=#{header_time}" } }
|
509
|
+
|
510
|
+
it "sets the http header value in milliseconds on the transaction" do
|
511
|
+
expect(transaction).to receive(:set_queue_start).with(1_389_783_610_000)
|
509
512
|
|
510
513
|
transaction.set_http_or_background_queue_start
|
511
514
|
end
|
515
|
+
|
516
|
+
context "when a :queue_start key is found in the transaction environment" do
|
517
|
+
let(:env) do
|
518
|
+
{
|
519
|
+
"HTTP_X_REQUEST_START" => "t=#{header_time}",
|
520
|
+
:queue_start => env_queue_start
|
521
|
+
}
|
522
|
+
end
|
523
|
+
|
524
|
+
it "sets the http header value in milliseconds on the transaction" do
|
525
|
+
expect(transaction).to receive(:set_queue_start).with(1_389_783_610_000)
|
526
|
+
|
527
|
+
transaction.set_http_or_background_queue_start
|
528
|
+
end
|
529
|
+
end
|
512
530
|
end
|
513
531
|
|
514
|
-
context "
|
515
|
-
let(:
|
516
|
-
let(:env) { { :queue_start => fixed_time } }
|
532
|
+
context "when a :queue_start key is found in the transaction environment" do
|
533
|
+
let(:env) { { :queue_start => env_queue_start } } # in seconds
|
517
534
|
|
518
|
-
it "
|
519
|
-
expect(transaction).to receive(:set_queue_start).with(
|
535
|
+
it "sets the :queue_start value in milliseconds on the transaction" do
|
536
|
+
expect(transaction).to receive(:set_queue_start).with(1_389_783_620_000)
|
520
537
|
|
521
538
|
transaction.set_http_or_background_queue_start
|
522
539
|
end
|
@@ -910,7 +927,7 @@ describe Appsignal::Transaction do
|
|
910
927
|
context "when queue start is set" do
|
911
928
|
let(:env) { background_env_with_data }
|
912
929
|
|
913
|
-
it { is_expected.to eq
|
930
|
+
it { is_expected.to eq 1_389_783_600_000 }
|
914
931
|
end
|
915
932
|
end
|
916
933
|
|
@@ -949,7 +966,7 @@ describe Appsignal::Transaction do
|
|
949
966
|
it { is_expected.to be_nil }
|
950
967
|
end
|
951
968
|
|
952
|
-
context "with
|
969
|
+
context "with unparsable content at the end" do
|
953
970
|
let(:env) { { "HTTP_X_REQUEST_START" => "t=#{slightly_earlier_time_value}aaaa" } }
|
954
971
|
|
955
972
|
it { is_expected.to eq 1_389_783_599_600 }
|
@@ -969,7 +986,7 @@ describe Appsignal::Transaction do
|
|
969
986
|
end
|
970
987
|
end
|
971
988
|
|
972
|
-
context "time in
|
989
|
+
context "time in milliseconds" do
|
973
990
|
let(:factor) { 1_000 }
|
974
991
|
|
975
992
|
it_should_behave_like "http queue start"
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
describe Appsignal do
|
2
|
+
include EnvironmentMetadataHelper
|
3
|
+
|
2
4
|
before do
|
3
5
|
# Make sure we have a clean state because we want to test
|
4
6
|
# initialization here.
|
@@ -80,18 +82,22 @@ describe Appsignal do
|
|
80
82
|
allow(GC::Profiler).to receive(:enable)
|
81
83
|
Appsignal.config.config_hash[:enable_allocation_tracking] = true
|
82
84
|
Appsignal.config.config_hash[:enable_gc_instrumentation] = true
|
85
|
+
capture_environment_metadata_report_calls
|
83
86
|
end
|
84
87
|
|
85
88
|
it "should enable Ruby's GC::Profiler" do
|
86
89
|
expect(GC::Profiler).to receive(:enable)
|
87
90
|
Appsignal.start
|
91
|
+
expect_environment_metadata("ruby_gc_instrumentation_enabled", "true")
|
88
92
|
end
|
89
93
|
|
90
94
|
unless Appsignal::System.jruby?
|
95
|
+
|
91
96
|
it "installs the allocation event hook" do
|
92
97
|
expect(Appsignal::Extension).to receive(:install_allocation_event_hook)
|
93
98
|
.and_call_original
|
94
99
|
Appsignal.start
|
100
|
+
expect_environment_metadata("ruby_allocation_tracking_enabled", "true")
|
95
101
|
end
|
96
102
|
end
|
97
103
|
end
|
@@ -100,6 +106,7 @@ describe Appsignal do
|
|
100
106
|
before do
|
101
107
|
Appsignal.config.config_hash[:enable_allocation_tracking] = false
|
102
108
|
Appsignal.config.config_hash[:enable_gc_instrumentation] = false
|
109
|
+
capture_environment_metadata_report_calls
|
103
110
|
end
|
104
111
|
|
105
112
|
it "should not enable Ruby's GC::Profiler" do
|
@@ -110,11 +117,13 @@ describe Appsignal do
|
|
110
117
|
it "should not install the allocation event hook" do
|
111
118
|
expect(Appsignal::Minutely).not_to receive(:install_allocation_event_hook)
|
112
119
|
Appsignal.start
|
120
|
+
expect_not_environment_metadata("ruby_allocation_tracking_enabled")
|
113
121
|
end
|
114
122
|
|
115
123
|
it "should not add the gc probe to minutely" do
|
116
124
|
expect(Appsignal::Minutely).not_to receive(:register_garbage_collection_probe)
|
117
125
|
Appsignal.start
|
126
|
+
expect_not_environment_metadata("ruby_gc_instrumentation_enabled")
|
118
127
|
end
|
119
128
|
end
|
120
129
|
|
@@ -139,6 +148,19 @@ describe Appsignal do
|
|
139
148
|
Appsignal.start
|
140
149
|
end
|
141
150
|
end
|
151
|
+
|
152
|
+
describe "environment metadata" do
|
153
|
+
before { capture_environment_metadata_report_calls }
|
154
|
+
|
155
|
+
it "collects and reports environment metadata" do
|
156
|
+
Appsignal.start
|
157
|
+
expect_environment_metadata("ruby_version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}")
|
158
|
+
expect_environment_metadata("ruby_engine", RUBY_ENGINE)
|
159
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3.0")
|
160
|
+
expect_environment_metadata("ruby_engine_version", RUBY_ENGINE_VERSION)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
142
164
|
end
|
143
165
|
|
144
166
|
context "with debug logging" do
|
@@ -62,7 +62,7 @@ RSpec.describe "Puma plugin" do
|
|
62
62
|
expect(launcher.events.on_booted).to_not be_nil
|
63
63
|
|
64
64
|
launcher.events.on_booted.call
|
65
|
-
expect(Appsignal::Minutely.probes[:puma]).to eql(Appsignal::
|
65
|
+
expect(Appsignal::Minutely.probes[:puma]).to eql(Appsignal::Probes::PumaProbe)
|
66
66
|
|
67
67
|
# Minutely probes started and called
|
68
68
|
wait_for("enough probe calls") { probe.calls >= 2 }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module EnvironmentMetadataHelper
|
2
|
+
def capture_environment_metadata_report_calls
|
3
|
+
allow(Appsignal::Extension).to receive(:set_environment_metadata)
|
4
|
+
.and_call_original
|
5
|
+
end
|
6
|
+
|
7
|
+
def expect_environment_metadata(key, value)
|
8
|
+
expect(Appsignal::Extension).to have_received(:set_environment_metadata)
|
9
|
+
.with(key, value)
|
10
|
+
end
|
11
|
+
|
12
|
+
def expect_not_environment_metadata(key)
|
13
|
+
expect(Appsignal::Extension).to_not have_received(:set_environment_metadata)
|
14
|
+
.with(key, anything)
|
15
|
+
end
|
16
|
+
end
|
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.
|
4
|
+
version: 2.11.0.alpha.2
|
5
5
|
platform: java
|
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: 2020-
|
13
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- lib/appsignal/cli/notify_of_deploy.rb
|
205
205
|
- lib/appsignal/config.rb
|
206
206
|
- lib/appsignal/demo.rb
|
207
|
+
- lib/appsignal/environment.rb
|
207
208
|
- lib/appsignal/event_formatter.rb
|
208
209
|
- lib/appsignal/event_formatter/action_view/render_formatter.rb
|
209
210
|
- lib/appsignal/event_formatter/active_record/instantiation_formatter.rb
|
@@ -254,6 +255,8 @@ files:
|
|
254
255
|
- lib/appsignal/logger.rb
|
255
256
|
- lib/appsignal/marker.rb
|
256
257
|
- lib/appsignal/minutely.rb
|
258
|
+
- lib/appsignal/probes/puma.rb
|
259
|
+
- lib/appsignal/probes/sidekiq.rb
|
257
260
|
- lib/appsignal/rack/generic_instrumentation.rb
|
258
261
|
- lib/appsignal/rack/js_exception_catcher.rb
|
259
262
|
- lib/appsignal/rack/rails_instrumentation.rb
|
@@ -288,6 +291,7 @@ files:
|
|
288
291
|
- spec/lib/appsignal/cli_spec.rb
|
289
292
|
- spec/lib/appsignal/config_spec.rb
|
290
293
|
- spec/lib/appsignal/demo_spec.rb
|
294
|
+
- spec/lib/appsignal/environment_spec.rb
|
291
295
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
292
296
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
293
297
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
@@ -332,6 +336,8 @@ files:
|
|
332
336
|
- spec/lib/appsignal/logger_spec.rb
|
333
337
|
- spec/lib/appsignal/marker_spec.rb
|
334
338
|
- spec/lib/appsignal/minutely_spec.rb
|
339
|
+
- spec/lib/appsignal/probes/puma_spec.rb
|
340
|
+
- spec/lib/appsignal/probes/sidekiq_spec.rb
|
335
341
|
- spec/lib/appsignal/rack/generic_instrumentation_spec.rb
|
336
342
|
- spec/lib/appsignal/rack/js_exception_catcher_spec.rb
|
337
343
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
@@ -362,6 +368,7 @@ files:
|
|
362
368
|
- spec/support/helpers/dependency_helper.rb
|
363
369
|
- spec/support/helpers/directory_helper.rb
|
364
370
|
- spec/support/helpers/env_helpers.rb
|
371
|
+
- spec/support/helpers/environment_metdata_helper.rb
|
365
372
|
- spec/support/helpers/example_exception.rb
|
366
373
|
- spec/support/helpers/example_standard_error.rb
|
367
374
|
- spec/support/helpers/log_helpers.rb
|
@@ -393,7 +400,7 @@ metadata:
|
|
393
400
|
documentation_uri: https://docs.appsignal.com/ruby/
|
394
401
|
homepage_uri: https://docs.appsignal.com/ruby/
|
395
402
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
396
|
-
post_install_message:
|
403
|
+
post_install_message:
|
397
404
|
rdoc_options: []
|
398
405
|
require_paths:
|
399
406
|
- lib
|
@@ -405,12 +412,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
405
412
|
version: '1.9'
|
406
413
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
407
414
|
requirements:
|
408
|
-
- - "
|
415
|
+
- - ">"
|
409
416
|
- !ruby/object:Gem::Version
|
410
|
-
version:
|
417
|
+
version: 1.3.1
|
411
418
|
requirements: []
|
412
|
-
rubygems_version: 3.1.
|
413
|
-
signing_key:
|
419
|
+
rubygems_version: 3.1.4
|
420
|
+
signing_key:
|
414
421
|
specification_version: 4
|
415
422
|
summary: Logs performance and exception data from your app to appsignal.com
|
416
423
|
test_files:
|
@@ -428,6 +435,7 @@ test_files:
|
|
428
435
|
- spec/lib/appsignal/cli_spec.rb
|
429
436
|
- spec/lib/appsignal/config_spec.rb
|
430
437
|
- spec/lib/appsignal/demo_spec.rb
|
438
|
+
- spec/lib/appsignal/environment_spec.rb
|
431
439
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
432
440
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
433
441
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
@@ -472,6 +480,8 @@ test_files:
|
|
472
480
|
- spec/lib/appsignal/logger_spec.rb
|
473
481
|
- spec/lib/appsignal/marker_spec.rb
|
474
482
|
- spec/lib/appsignal/minutely_spec.rb
|
483
|
+
- spec/lib/appsignal/probes/puma_spec.rb
|
484
|
+
- spec/lib/appsignal/probes/sidekiq_spec.rb
|
475
485
|
- spec/lib/appsignal/rack/generic_instrumentation_spec.rb
|
476
486
|
- spec/lib/appsignal/rack/js_exception_catcher_spec.rb
|
477
487
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
@@ -502,6 +512,7 @@ test_files:
|
|
502
512
|
- spec/support/helpers/dependency_helper.rb
|
503
513
|
- spec/support/helpers/directory_helper.rb
|
504
514
|
- spec/support/helpers/env_helpers.rb
|
515
|
+
- spec/support/helpers/environment_metdata_helper.rb
|
505
516
|
- spec/support/helpers/example_exception.rb
|
506
517
|
- spec/support/helpers/example_standard_error.rb
|
507
518
|
- spec/support/helpers/log_helpers.rb
|