appsignal 2.11.0.beta.2 → 2.11.1.beta.2
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 +57 -1
- data/CHANGELOG.md +28 -0
- data/README.md +11 -5
- data/Rakefile +27 -9
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +2 -2
- data/ext/Rakefile +2 -0
- data/ext/agent.yml +17 -25
- data/ext/appsignal_extension.c +1 -1
- data/ext/base.rb +7 -0
- data/ext/extconf.rb +2 -0
- data/lib/appsignal.rb +1 -0
- data/lib/appsignal/auth_check.rb +4 -2
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +82 -17
- data/lib/appsignal/extension.rb +6 -5
- data/lib/appsignal/extension/jruby.rb +6 -5
- data/lib/appsignal/hooks.rb +24 -0
- data/lib/appsignal/hooks/action_mailer.rb +22 -0
- data/lib/appsignal/hooks/active_job.rb +53 -5
- data/lib/appsignal/hooks/active_support_notifications.rb +72 -0
- data/lib/appsignal/hooks/puma.rb +0 -1
- data/lib/appsignal/hooks/sidekiq.rb +1 -2
- data/lib/appsignal/integrations/delayed_job_plugin.rb +1 -1
- data/lib/appsignal/probes.rb +7 -0
- data/lib/appsignal/probes/puma.rb +1 -1
- data/lib/appsignal/probes/sidekiq.rb +3 -1
- data/lib/appsignal/utils/deprecation_message.rb +1 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +23 -0
- 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 +42 -0
- data/spec/lib/appsignal/config_spec.rb +39 -1
- data/spec/lib/appsignal/extension/jruby_spec.rb +31 -28
- data/spec/lib/appsignal/extension_install_failure_spec.rb +23 -0
- data/spec/lib/appsignal/hooks/action_mailer_spec.rb +54 -0
- data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +35 -0
- data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +145 -0
- data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +69 -0
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +9 -137
- data/spec/lib/appsignal/hooks/activejob_spec.rb +143 -10
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +3 -14
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +7 -5
- data/spec/lib/appsignal/hooks_spec.rb +57 -0
- data/spec/lib/appsignal/marker_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/support/helpers/config_helpers.rb +3 -2
- data/spec/support/helpers/dependency_helper.rb +4 -0
- data/spec/support/helpers/transaction_helpers.rb +1 -1
- data/spec/support/testing.rb +19 -19
- metadata +19 -7
@@ -78,6 +78,63 @@ describe Appsignal::Hooks do
|
|
78
78
|
expect(Appsignal::Hooks.hooks[:mock_error_hook].installed?).to be_falsy
|
79
79
|
Appsignal::Hooks.hooks.delete(:mock_error_hook)
|
80
80
|
end
|
81
|
+
|
82
|
+
describe "missing constants" do
|
83
|
+
let(:err_stream) { std_stream }
|
84
|
+
let(:stderr) { err_stream.read }
|
85
|
+
let(:log_stream) { std_stream }
|
86
|
+
let(:log) { log_contents(log_stream) }
|
87
|
+
before do
|
88
|
+
Appsignal.logger = test_logger(log_stream)
|
89
|
+
end
|
90
|
+
|
91
|
+
def call_constant(&block)
|
92
|
+
capture_std_streams(std_stream, err_stream, &block)
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "SidekiqProbe" do
|
96
|
+
it "logs a deprecation message and returns the new constant" do
|
97
|
+
constant = call_constant { Appsignal::Hooks::SidekiqProbe }
|
98
|
+
|
99
|
+
expect(constant).to eql(Appsignal::Probes::SidekiqProbe)
|
100
|
+
expect(constant.name).to eql("Appsignal::Probes::SidekiqProbe")
|
101
|
+
|
102
|
+
deprecation_message =
|
103
|
+
"The constant Appsignal::Hooks::SidekiqProbe has been deprecated. " \
|
104
|
+
"Please update the constant name to Appsignal::Probes::SidekiqProbe " \
|
105
|
+
"in the following file to remove this message.\n#{__FILE__}:"
|
106
|
+
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
107
|
+
expect(log).to contains_log :warn, deprecation_message
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "PumaProbe" do
|
112
|
+
it "logs a deprecation message and returns the new constant" do
|
113
|
+
constant = call_constant { Appsignal::Hooks::PumaProbe }
|
114
|
+
|
115
|
+
expect(constant).to eql(Appsignal::Probes::PumaProbe)
|
116
|
+
expect(constant.name).to eql("Appsignal::Probes::PumaProbe")
|
117
|
+
|
118
|
+
deprecation_message =
|
119
|
+
"The constant Appsignal::Hooks::PumaProbe has been deprecated. " \
|
120
|
+
"Please update the constant name to Appsignal::Probes::PumaProbe " \
|
121
|
+
"in the following file to remove this message.\n#{__FILE__}:"
|
122
|
+
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
123
|
+
expect(log).to contains_log :warn, deprecation_message
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "other constant" do
|
128
|
+
it "raises a NameError like Ruby normally does" do
|
129
|
+
expect do
|
130
|
+
call_constant { Appsignal::Hooks::Unknown }
|
131
|
+
end.to raise_error(NameError)
|
132
|
+
|
133
|
+
expect(stderr).to be_empty
|
134
|
+
expect(log).to be_empty
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
81
138
|
end
|
82
139
|
|
83
140
|
describe Appsignal::Hooks::Helpers do
|
data/spec/spec_helper.rb
CHANGED
@@ -65,6 +65,10 @@ RSpec.configure do |config|
|
|
65
65
|
|
66
66
|
config.example_status_persistence_file_path = "spec/examples.txt"
|
67
67
|
config.fail_if_no_examples = true
|
68
|
+
config.filter_run_excluding(
|
69
|
+
:extension_installation_failure => true,
|
70
|
+
:jruby => !DependencyHelper.running_jruby?
|
71
|
+
)
|
68
72
|
config.mock_with :rspec do |mocks|
|
69
73
|
mocks.syntax = :expect
|
70
74
|
end
|
@@ -111,6 +115,7 @@ RSpec.configure do |config|
|
|
111
115
|
# in the diagnose task, so add it manually to the list of to-be cleaned up
|
112
116
|
# keys.
|
113
117
|
env_keys << "_APPSIGNAL_DIAGNOSE"
|
118
|
+
env_keys << "_TEST_APPSIGNAL_EXTENSION_FAILURE"
|
114
119
|
env_keys.each do |key|
|
115
120
|
# First set the ENV var to an empty string and then delete the key from
|
116
121
|
# the env. We set the env var to an empty string first as JRuby doesn't
|
@@ -5,12 +5,13 @@ 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, config_file = nil)
|
9
9
|
Appsignal::Config.new(
|
10
10
|
project_fixture_path,
|
11
11
|
env,
|
12
12
|
initial_config,
|
13
|
-
logger
|
13
|
+
logger,
|
14
|
+
config_file
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
@@ -46,7 +46,7 @@ module TransactionHelpers
|
|
46
46
|
|
47
47
|
# Set current transaction manually.
|
48
48
|
# Cleared by {clear_current_transaction!}
|
49
|
-
def set_current_transaction(transaction) # rubocop:disable
|
49
|
+
def set_current_transaction(transaction) # rubocop:disable Naming/AccessorMethodName
|
50
50
|
Thread.current[:appsignal_transaction] = transaction
|
51
51
|
end
|
52
52
|
|
data/spec/support/testing.rb
CHANGED
@@ -38,25 +38,9 @@ module Appsignal
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
class Transaction
|
42
|
-
class << self
|
43
|
-
alias original_new new
|
44
|
-
|
45
|
-
# Override the {Appsignal::Transaction.new} method so we can track which
|
46
|
-
# transactions are created on the {Appsignal::Testing.transactions} list.
|
47
|
-
#
|
48
|
-
# @see TransactionHelpers#last_transaction
|
49
|
-
def new(*args)
|
50
|
-
transaction = original_new(*args)
|
51
|
-
Appsignal::Testing.transactions << transaction
|
52
|
-
transaction
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
41
|
class Extension
|
58
42
|
class Transaction
|
59
|
-
alias original_finish finish
|
43
|
+
alias original_finish finish if method_defined? :finish
|
60
44
|
|
61
45
|
# Override default {Extension::Transaction#finish} behavior to always
|
62
46
|
# return true, which tells the transaction to add its sample data (unless
|
@@ -72,7 +56,7 @@ module Appsignal
|
|
72
56
|
return_value
|
73
57
|
end
|
74
58
|
|
75
|
-
alias original_complete complete
|
59
|
+
alias original_complete complete if method_defined? :complete
|
76
60
|
|
77
61
|
# Override default {Extension::Transaction#complete} behavior to
|
78
62
|
# store the transaction JSON before the transaction is completed
|
@@ -94,7 +78,7 @@ module Appsignal
|
|
94
78
|
@completed || false
|
95
79
|
end
|
96
80
|
|
97
|
-
alias original_to_json to_json
|
81
|
+
alias original_to_json to_json if method_defined? :to_json
|
98
82
|
|
99
83
|
# Override default {Extension::Transaction#to_json} behavior to
|
100
84
|
# return the stored the transaction JSON when the transaction was
|
@@ -111,3 +95,19 @@ module Appsignal
|
|
111
95
|
end
|
112
96
|
end
|
113
97
|
end
|
98
|
+
|
99
|
+
module AppsignalTest
|
100
|
+
module Transaction
|
101
|
+
# Override the {Appsignal::Transaction.new} method so we can track which
|
102
|
+
# transactions are created on the {Appsignal::Testing.transactions} list.
|
103
|
+
#
|
104
|
+
# @see TransactionHelpers#last_transaction
|
105
|
+
def new(*_args)
|
106
|
+
transaction = super
|
107
|
+
Appsignal::Testing.transactions << transaction
|
108
|
+
transaction
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
Appsignal::Transaction.extend(AppsignalTest::Transaction)
|
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.1.beta.2
|
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: 2020-
|
13
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/appsignal/helpers/metrics.rb
|
208
208
|
- lib/appsignal/hooks.rb
|
209
209
|
- lib/appsignal/hooks/action_cable.rb
|
210
|
+
- lib/appsignal/hooks/action_mailer.rb
|
210
211
|
- lib/appsignal/hooks/active_job.rb
|
211
212
|
- lib/appsignal/hooks/active_support_notifications.rb
|
212
213
|
- lib/appsignal/hooks/celluloid.rb
|
@@ -244,6 +245,7 @@ files:
|
|
244
245
|
- lib/appsignal/logger.rb
|
245
246
|
- lib/appsignal/marker.rb
|
246
247
|
- lib/appsignal/minutely.rb
|
248
|
+
- lib/appsignal/probes.rb
|
247
249
|
- lib/appsignal/probes/puma.rb
|
248
250
|
- lib/appsignal/probes/sidekiq.rb
|
249
251
|
- lib/appsignal/rack/generic_instrumentation.rb
|
@@ -290,9 +292,14 @@ files:
|
|
290
292
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
291
293
|
- spec/lib/appsignal/event_formatter_spec.rb
|
292
294
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
295
|
+
- spec/lib/appsignal/extension_install_failure_spec.rb
|
293
296
|
- spec/lib/appsignal/extension_spec.rb
|
294
297
|
- spec/lib/appsignal/garbage_collection_profiler_spec.rb
|
295
298
|
- spec/lib/appsignal/hooks/action_cable_spec.rb
|
299
|
+
- spec/lib/appsignal/hooks/action_mailer_spec.rb
|
300
|
+
- spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
|
301
|
+
- spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb
|
302
|
+
- spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
|
296
303
|
- spec/lib/appsignal/hooks/active_support_notifications_spec.rb
|
297
304
|
- spec/lib/appsignal/hooks/activejob_spec.rb
|
298
305
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
@@ -388,11 +395,11 @@ licenses:
|
|
388
395
|
- MIT
|
389
396
|
metadata:
|
390
397
|
bug_tracker_uri: https://github.com/appsignal/appsignal-ruby/issues
|
391
|
-
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/
|
398
|
+
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md
|
392
399
|
documentation_uri: https://docs.appsignal.com/ruby/
|
393
400
|
homepage_uri: https://docs.appsignal.com/ruby/
|
394
401
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
395
|
-
post_install_message:
|
402
|
+
post_install_message:
|
396
403
|
rdoc_options: []
|
397
404
|
require_paths:
|
398
405
|
- lib
|
@@ -408,8 +415,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
408
415
|
- !ruby/object:Gem::Version
|
409
416
|
version: 1.3.1
|
410
417
|
requirements: []
|
411
|
-
rubygems_version: 3.1.
|
412
|
-
signing_key:
|
418
|
+
rubygems_version: 3.1.2
|
419
|
+
signing_key:
|
413
420
|
specification_version: 4
|
414
421
|
summary: Logs performance and exception data from your app to appsignal.com
|
415
422
|
test_files:
|
@@ -437,9 +444,14 @@ test_files:
|
|
437
444
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
438
445
|
- spec/lib/appsignal/event_formatter_spec.rb
|
439
446
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
447
|
+
- spec/lib/appsignal/extension_install_failure_spec.rb
|
440
448
|
- spec/lib/appsignal/extension_spec.rb
|
441
449
|
- spec/lib/appsignal/garbage_collection_profiler_spec.rb
|
442
450
|
- spec/lib/appsignal/hooks/action_cable_spec.rb
|
451
|
+
- spec/lib/appsignal/hooks/action_mailer_spec.rb
|
452
|
+
- spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
|
453
|
+
- spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb
|
454
|
+
- spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
|
443
455
|
- spec/lib/appsignal/hooks/active_support_notifications_spec.rb
|
444
456
|
- spec/lib/appsignal/hooks/activejob_spec.rb
|
445
457
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|