appsignal 2.10.12-java → 2.11.0.alpha.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +1 -1
- data/CHANGELOG.md +3 -12
- data/README.md +4 -4
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +2 -2
- data/ext/agent.yml +19 -19
- data/ext/appsignal_extension.c +10 -1
- data/lib/appsignal.rb +21 -1
- data/lib/appsignal/capistrano.rb +2 -0
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +8 -38
- 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/redis.rb +2 -0
- data/lib/appsignal/hooks/sequel.rb +2 -0
- data/lib/appsignal/integrations/object.rb +4 -0
- data/lib/appsignal/integrations/resque_active_job.rb +2 -0
- data/lib/appsignal/rack/js_exception_catcher.rb +2 -5
- data/lib/appsignal/transaction.rb +22 -7
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
- data/spec/lib/appsignal/capistrano3_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +0 -42
- data/spec/lib/appsignal/config_spec.rb +5 -24
- data/spec/lib/appsignal/environment_spec.rb +167 -0
- data/spec/lib/appsignal/marker_spec.rb +1 -1
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +4 -9
- data/spec/lib/appsignal/transaction_spec.rb +30 -13
- data/spec/lib/appsignal_spec.rb +22 -0
- data/spec/support/helpers/config_helpers.rb +2 -3
- data/spec/support/helpers/env_helpers.rb +1 -1
- data/spec/support/helpers/environment_metdata_helper.rb +16 -0
- metadata +10 -5
@@ -4,12 +4,9 @@ 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
|
-
"
|
10
|
-
"`enable_frontend_error_catching` in your configuration and " \
|
11
|
-
"installing AppSignal for JavaScript instead. " \
|
12
|
-
"(https://docs.appsignal.com/front-end/)"
|
7
|
+
"The Appsignal::Rack::JSExceptionCatcher is deprecated. " \
|
8
|
+
"Please use the official AppSignal JavaScript integration instead. " \
|
9
|
+
"https://docs.appsignal.com/front-end/"
|
13
10
|
end
|
14
11
|
before { Appsignal.config = config }
|
15
12
|
|
@@ -35,9 +32,7 @@ describe Appsignal::Rack::JSExceptionCatcher do
|
|
35
32
|
|
36
33
|
describe "#call" do
|
37
34
|
let(:catcher) do
|
38
|
-
silence
|
39
|
-
Appsignal::Rack::JSExceptionCatcher.new(app, options)
|
40
|
-
end
|
35
|
+
silence { Appsignal::Rack::JSExceptionCatcher.new(app, options) }
|
41
36
|
end
|
42
37
|
after { catcher.call(env) }
|
43
38
|
|
@@ -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
|
@@ -5,13 +5,12 @@ module ConfigHelpers
|
|
5
5
|
)
|
6
6
|
end
|
7
7
|
|
8
|
-
def project_fixture_config(env = "production", initial_config = {}, logger = Appsignal.logger
|
8
|
+
def project_fixture_config(env = "production", initial_config = {}, logger = Appsignal.logger)
|
9
9
|
Appsignal::Config.new(
|
10
10
|
project_fixture_path,
|
11
11
|
env,
|
12
12
|
initial_config,
|
13
|
-
logger
|
14
|
-
config_file
|
13
|
+
logger
|
15
14
|
)
|
16
15
|
end
|
17
16
|
|
@@ -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,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-06-29 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
|
@@ -288,6 +289,7 @@ files:
|
|
288
289
|
- spec/lib/appsignal/cli_spec.rb
|
289
290
|
- spec/lib/appsignal/config_spec.rb
|
290
291
|
- spec/lib/appsignal/demo_spec.rb
|
292
|
+
- spec/lib/appsignal/environment_spec.rb
|
291
293
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
292
294
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
293
295
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
@@ -362,6 +364,7 @@ files:
|
|
362
364
|
- spec/support/helpers/dependency_helper.rb
|
363
365
|
- spec/support/helpers/directory_helper.rb
|
364
366
|
- spec/support/helpers/env_helpers.rb
|
367
|
+
- spec/support/helpers/environment_metdata_helper.rb
|
365
368
|
- spec/support/helpers/example_exception.rb
|
366
369
|
- spec/support/helpers/example_standard_error.rb
|
367
370
|
- spec/support/helpers/log_helpers.rb
|
@@ -389,7 +392,7 @@ licenses:
|
|
389
392
|
- MIT
|
390
393
|
metadata:
|
391
394
|
bug_tracker_uri: https://github.com/appsignal/appsignal-ruby/issues
|
392
|
-
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/
|
395
|
+
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/master/CHANGELOG.md
|
393
396
|
documentation_uri: https://docs.appsignal.com/ruby/
|
394
397
|
homepage_uri: https://docs.appsignal.com/ruby/
|
395
398
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
@@ -405,9 +408,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
405
408
|
version: '1.9'
|
406
409
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
407
410
|
requirements:
|
408
|
-
- - "
|
411
|
+
- - ">"
|
409
412
|
- !ruby/object:Gem::Version
|
410
|
-
version:
|
413
|
+
version: 1.3.1
|
411
414
|
requirements: []
|
412
415
|
rubygems_version: 3.1.4
|
413
416
|
signing_key:
|
@@ -428,6 +431,7 @@ test_files:
|
|
428
431
|
- spec/lib/appsignal/cli_spec.rb
|
429
432
|
- spec/lib/appsignal/config_spec.rb
|
430
433
|
- spec/lib/appsignal/demo_spec.rb
|
434
|
+
- spec/lib/appsignal/environment_spec.rb
|
431
435
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
432
436
|
- spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb
|
433
437
|
- spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb
|
@@ -502,6 +506,7 @@ test_files:
|
|
502
506
|
- spec/support/helpers/dependency_helper.rb
|
503
507
|
- spec/support/helpers/directory_helper.rb
|
504
508
|
- spec/support/helpers/env_helpers.rb
|
509
|
+
- spec/support/helpers/environment_metdata_helper.rb
|
505
510
|
- spec/support/helpers/example_exception.rb
|
506
511
|
- spec/support/helpers/example_standard_error.rb
|
507
512
|
- spec/support/helpers/log_helpers.rb
|