appsignal 2.10.5-java → 2.10.9.beta.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 +6 -0
- data/CHANGELOG.md +17 -0
- data/build_matrix.yml +5 -0
- data/ext/agent.yml +19 -19
- data/ext/base.rb +15 -4
- data/lib/appsignal.rb +6 -3
- data/lib/appsignal/cli/notify_of_deploy.rb +1 -1
- data/lib/appsignal/event_formatter.rb +1 -2
- data/lib/appsignal/hooks/net_http.rb +8 -13
- data/lib/appsignal/integrations/delayed_job_plugin.rb +16 -3
- data/lib/appsignal/minutely.rb +1 -2
- data/lib/appsignal/rack/js_exception_catcher.rb +3 -4
- data/lib/appsignal/system.rb +0 -6
- data/lib/appsignal/utils/deprecation_message.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +2 -1
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +4 -2
- data/spec/lib/appsignal/config_spec.rb +7 -7
- data/spec/lib/appsignal/event_formatter_spec.rb +5 -4
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +198 -166
- data/spec/lib/appsignal/minutely_spec.rb +4 -4
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +9 -5
- data/spec/lib/appsignal/system_spec.rb +0 -36
- data/spec/lib/appsignal_spec.rb +2 -2
- metadata +4 -5
- data/lib/appsignal/integrations/net_http.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bda1f3cc0e348c0eb1225daa9037738c1ed172160d841c0c5a2b94177aae323
|
4
|
+
data.tar.gz: 1f2547a66a52cfb860e7edee2bf687ccea4e01bd84f110fade1ca2e54a856a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c33b49887af22ef64a4810046e5aadb24d1b8e4e1aad6b885a86d08b93ac4c4f8045da29b0e2ffea2c2e06feece84d82fde28d70309f145557926684985177b4
|
7
|
+
data.tar.gz: 682e932a33c5b9945297519b6a9404670a1196a796303f4cdc7e7a48fd908bae580302a22aa926f491133d75317c4bc4cd7acb250004907789fa3a2bfd6f8f20
|
data/.semaphore/semaphore.yml
CHANGED
@@ -36,6 +36,7 @@ global_job_config:
|
|
36
36
|
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE),$_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET,$_BUNDLER_CACHE-bundler-$RUBY_VERSION
|
37
37
|
- cache restore $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE),$_GEMS_CACHE-gems-$RUBY_VERSION
|
38
38
|
- "./support/install_deps"
|
39
|
+
- bundle config set clean 'true'
|
39
40
|
- "./support/bundler_wrapper install --jobs=3 --retry=3"
|
40
41
|
epilogue:
|
41
42
|
on_pass:
|
@@ -43,6 +44,11 @@ global_job_config:
|
|
43
44
|
- cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
|
44
45
|
.bundle
|
45
46
|
- cache store $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) $HOME/.gem
|
47
|
+
on_fail:
|
48
|
+
commands:
|
49
|
+
- "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report
|
50
|
+
file found'"
|
51
|
+
- "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
|
46
52
|
blocks:
|
47
53
|
- name: Validation
|
48
54
|
dependencies: []
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 2.10.9
|
4
|
+
- Use http proxy if configured when downloading agent
|
5
|
+
- Clear event details cache every 48 hours
|
6
|
+
|
7
|
+
## 2.10.8
|
8
|
+
- Fix failed checksum error log. PR #609
|
9
|
+
- Fix DelayedJob action name detection for objects that listen to the `[]`
|
10
|
+
method and return a non-String value. #611
|
11
|
+
- CI test build improvements. PR #607, #608, #614
|
12
|
+
|
13
|
+
## 2.10.7
|
14
|
+
- Revert fix for compatibility with the `http_logger` gem. PR #604.
|
15
|
+
For more information, see issue #603 about our reasoning and discussion.
|
16
|
+
|
17
|
+
## 2.10.6
|
18
|
+
- Check if queued payloads are for correct app and not expired
|
19
|
+
|
3
20
|
## 2.10.5
|
4
21
|
- Improve Ruby 1.9 compatibility. PR #591
|
5
22
|
- Add grape.skip_appsignal_error request env. PR #588
|
data/build_matrix.yml
CHANGED
@@ -37,12 +37,17 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
37
37
|
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE),$_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET,$_BUNDLER_CACHE-bundler-$RUBY_VERSION
|
38
38
|
- cache restore $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE),$_GEMS_CACHE-gems-$RUBY_VERSION
|
39
39
|
- ./support/install_deps
|
40
|
+
- bundle config set clean 'true'
|
40
41
|
- ./support/bundler_wrapper install --jobs=3 --retry=3
|
41
42
|
epilogue:
|
42
43
|
on_pass:
|
43
44
|
commands:
|
44
45
|
- cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE) .bundle
|
45
46
|
- cache store $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) $HOME/.gem
|
47
|
+
on_fail:
|
48
|
+
commands:
|
49
|
+
- "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'"
|
50
|
+
- "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
|
46
51
|
|
47
52
|
blocks:
|
48
53
|
- name: Validation
|
data/ext/agent.yml
CHANGED
@@ -1,70 +1,70 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 6ced5a6
|
3
3
|
mirrors:
|
4
4
|
- https://appsignal-agent-releases.global.ssl.fastly.net
|
5
5
|
- https://d135dj0rjqvssy.cloudfront.net
|
6
6
|
triples:
|
7
7
|
x86_64-darwin:
|
8
8
|
static:
|
9
|
-
checksum:
|
9
|
+
checksum: dcc623a7eea18727c8628cf29d30e61379e543328a53d91bcf0c5751f3f9f313
|
10
10
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
11
11
|
dynamic:
|
12
|
-
checksum:
|
12
|
+
checksum: 63f2ba8289390df75b72f414ed026acca07f26ac52bd25cd679c6de776b53ca4
|
13
13
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
14
14
|
universal-darwin:
|
15
15
|
static:
|
16
|
-
checksum:
|
16
|
+
checksum: dcc623a7eea18727c8628cf29d30e61379e543328a53d91bcf0c5751f3f9f313
|
17
17
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
18
18
|
dynamic:
|
19
|
-
checksum:
|
19
|
+
checksum: 63f2ba8289390df75b72f414ed026acca07f26ac52bd25cd679c6de776b53ca4
|
20
20
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
21
21
|
i686-linux:
|
22
22
|
static:
|
23
|
-
checksum:
|
23
|
+
checksum: 8941c1d0a546da8f63bc65953afc439987616c62f2d5307856728ae4f2e0b2f5
|
24
24
|
filename: appsignal-i686-linux-all-static.tar.gz
|
25
25
|
dynamic:
|
26
|
-
checksum:
|
26
|
+
checksum: ccb59ee85f8ba8790482db9de29be6936e92c395bb6306f0fecefbc4de50f78d
|
27
27
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
28
28
|
x86-linux:
|
29
29
|
static:
|
30
|
-
checksum:
|
30
|
+
checksum: 8941c1d0a546da8f63bc65953afc439987616c62f2d5307856728ae4f2e0b2f5
|
31
31
|
filename: appsignal-i686-linux-all-static.tar.gz
|
32
32
|
dynamic:
|
33
|
-
checksum:
|
33
|
+
checksum: ccb59ee85f8ba8790482db9de29be6936e92c395bb6306f0fecefbc4de50f78d
|
34
34
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
35
35
|
i686-linux-musl:
|
36
36
|
static:
|
37
|
-
checksum:
|
37
|
+
checksum: 9cfe62cfd0559b900c37b256a2ffc95021007cf3f365152b62af74b55da465a9
|
38
38
|
filename: appsignal-i686-linux-musl-all-static.tar.gz
|
39
39
|
x86-linux-musl:
|
40
40
|
static:
|
41
|
-
checksum:
|
41
|
+
checksum: 9cfe62cfd0559b900c37b256a2ffc95021007cf3f365152b62af74b55da465a9
|
42
42
|
filename: appsignal-i686-linux-musl-all-static.tar.gz
|
43
43
|
x86_64-linux:
|
44
44
|
static:
|
45
|
-
checksum:
|
45
|
+
checksum: fe74119337cfb8353c64707e4689dc398df1adf2d4bb1bf7750e9a71cca39b3a
|
46
46
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
47
47
|
dynamic:
|
48
|
-
checksum:
|
48
|
+
checksum: 6816b709ca388421906b178ae592f565ebc433b59cc50223de8c914e44c75d7a
|
49
49
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
50
50
|
x86_64-linux-musl:
|
51
51
|
static:
|
52
|
-
checksum:
|
52
|
+
checksum: 5382a1b0933a2b4d8fae74f89c1af7a21176a1bc100bb245078a1b369b91caca
|
53
53
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
54
54
|
dynamic:
|
55
|
-
checksum:
|
55
|
+
checksum: e222dd4b09d5042e5315512353f987b1be0302c457285de0bfaeb911d72a8e3e
|
56
56
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
57
57
|
x86_64-freebsd:
|
58
58
|
static:
|
59
|
-
checksum:
|
59
|
+
checksum: b98fcf6490cb5d1485e96656992ee083f534ec43d67caf015f72b8f4cc6e8fa6
|
60
60
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
61
61
|
dynamic:
|
62
|
-
checksum:
|
62
|
+
checksum: 28e8cab256c3550e249e0768dc9cb0f352396e972186e1ccf9f2c02461a87345
|
63
63
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
64
64
|
amd64-freebsd:
|
65
65
|
static:
|
66
|
-
checksum:
|
66
|
+
checksum: b98fcf6490cb5d1485e96656992ee083f534ec43d67caf015f72b8f4cc6e8fa6
|
67
67
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
68
68
|
dynamic:
|
69
|
-
checksum:
|
69
|
+
checksum: 28e8cab256c3550e249e0768dc9cb0f352396e972186e1ccf9f2c02461a87345
|
70
70
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/base.rb
CHANGED
@@ -32,7 +32,8 @@ def report
|
|
32
32
|
"version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
|
33
33
|
},
|
34
34
|
"download" => {
|
35
|
-
"checksum" => "unverified"
|
35
|
+
"checksum" => "unverified",
|
36
|
+
"http_proxy" => http_proxy
|
36
37
|
},
|
37
38
|
"build" => {
|
38
39
|
"time" => Time.now.utc,
|
@@ -126,7 +127,11 @@ def download_archive(type)
|
|
126
127
|
report["download"]["download_url"] = download_url
|
127
128
|
|
128
129
|
begin
|
129
|
-
return open(
|
130
|
+
return open(
|
131
|
+
download_url,
|
132
|
+
:ssl_ca_cert => CA_CERT_PATH,
|
133
|
+
:proxy => http_proxy
|
134
|
+
)
|
130
135
|
rescue
|
131
136
|
next
|
132
137
|
end
|
@@ -142,14 +147,16 @@ def download_archive(type)
|
|
142
147
|
end
|
143
148
|
|
144
149
|
def verify_archive(archive, type)
|
145
|
-
|
150
|
+
expected_checksum = ARCH_CONFIG[type]["checksum"]
|
151
|
+
actual_checksum = Digest::SHA256.hexdigest(archive.read)
|
152
|
+
if actual_checksum == expected_checksum
|
146
153
|
report["download"]["checksum"] = "verified"
|
147
154
|
true
|
148
155
|
else
|
149
156
|
report["download"]["checksum"] = "invalid"
|
150
157
|
abort_installation(
|
151
158
|
"Checksum of downloaded archive could not be verified: " \
|
152
|
-
"Expected '#{
|
159
|
+
"Expected '#{expected_checksum}', got '#{actual_checksum}'."
|
153
160
|
)
|
154
161
|
end
|
155
162
|
end
|
@@ -172,3 +179,7 @@ def store_download_version_on_report
|
|
172
179
|
path = File.expand_path(File.join(File.dirname(__FILE__), "appsignal.version"))
|
173
180
|
report["build"]["agent_version"] = File.read(path).strip
|
174
181
|
end
|
182
|
+
|
183
|
+
def http_proxy
|
184
|
+
Gem.configuration[:http_proxy] || ENV["http_proxy"] || ENV["HTTP_PROXY"]
|
185
|
+
end
|
data/lib/appsignal.rb
CHANGED
@@ -6,6 +6,7 @@ require "securerandom"
|
|
6
6
|
require "appsignal/logger"
|
7
7
|
require "appsignal/helpers/instrumentation"
|
8
8
|
require "appsignal/helpers/metrics"
|
9
|
+
require "appsignal/utils/deprecation_message"
|
9
10
|
|
10
11
|
# AppSignal for Ruby gem's main module.
|
11
12
|
#
|
@@ -15,9 +16,9 @@ require "appsignal/helpers/metrics"
|
|
15
16
|
# {Appsignal::Helpers::Metrics}) for ease of use.
|
16
17
|
module Appsignal
|
17
18
|
class << self
|
18
|
-
extend Gem::Deprecate
|
19
19
|
include Helpers::Instrumentation
|
20
20
|
include Helpers::Metrics
|
21
|
+
include Utils::DeprecationMessage
|
21
22
|
|
22
23
|
# Accessor for the AppSignal configuration.
|
23
24
|
# Return the current AppSignal configuration.
|
@@ -280,16 +281,18 @@ module Appsignal
|
|
280
281
|
|
281
282
|
# @deprecated No replacement
|
282
283
|
def is_ignored_error?(error) # rubocop:disable Naming/PredicateName
|
284
|
+
deprecation_message "Appsignal.is_ignored_error? is deprecated " \
|
285
|
+
"with no replacement and will be removed in version 3.0."
|
283
286
|
Appsignal.config[:ignore_errors].include?(error.class.name)
|
284
287
|
end
|
285
288
|
alias :is_ignored_exception? :is_ignored_error?
|
286
|
-
deprecate :is_ignored_error?, :none, 2017, 3
|
287
289
|
|
288
290
|
# @deprecated No replacement
|
289
291
|
def is_ignored_action?(action) # rubocop:disable Naming/PredicateName
|
292
|
+
deprecation_message "Appsignal.is_ignored_action? is deprecated " \
|
293
|
+
"with no replacement and will be removed in version 3.0."
|
290
294
|
Appsignal.config[:ignore_actions].include?(action)
|
291
295
|
end
|
292
|
-
deprecate :is_ignored_action?, :none, 2017, 3
|
293
296
|
|
294
297
|
private
|
295
298
|
|
@@ -94,7 +94,7 @@ module Appsignal
|
|
94
94
|
"see our documentation for more information on the recommended " \
|
95
95
|
"method: " \
|
96
96
|
"https://docs.appsignal.com/application/markers/deploy-markers.html"
|
97
|
-
deprecation_message message
|
97
|
+
deprecation_message message
|
98
98
|
end
|
99
99
|
|
100
100
|
private
|
@@ -91,8 +91,7 @@ module Appsignal
|
|
91
91
|
"Formatter for '#{name}' is using a deprecated registration " \
|
92
92
|
"method. This event formatter will not be loaded. " \
|
93
93
|
"Please update the formatter according to the documentation at: " \
|
94
|
-
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
|
95
|
-
logger
|
94
|
+
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
|
96
95
|
|
97
96
|
EventFormatter.deprecated_formatter_classes[name] = self
|
98
97
|
end
|
@@ -13,20 +13,15 @@ module Appsignal
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def install
|
16
|
-
|
17
|
-
|
18
|
-
Net::HTTP.send(:prepend, Appsignal::Integrations::NetHttpIntegration)
|
19
|
-
else
|
20
|
-
Net::HTTP.class_eval do
|
21
|
-
alias request_without_appsignal request
|
16
|
+
Net::HTTP.class_eval do
|
17
|
+
alias request_without_appsignal request
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
19
|
+
def request(request, body = nil, &block)
|
20
|
+
Appsignal.instrument(
|
21
|
+
"request.net_http",
|
22
|
+
"#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
|
23
|
+
) do
|
24
|
+
request_without_appsignal(request, body, &block)
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|
@@ -27,9 +27,8 @@ module Appsignal
|
|
27
27
|
method_name = "perform"
|
28
28
|
else
|
29
29
|
# Delayed Job
|
30
|
-
args = extract_value(
|
31
|
-
|
32
|
-
class_name, method_name = class_and_method_name.split("#")
|
30
|
+
args = extract_value(payload, :args, {})
|
31
|
+
class_name, method_name = class_and_method_name_from_object_or_hash(payload, job.name)
|
33
32
|
end
|
34
33
|
|
35
34
|
params = Appsignal::Utils::HashSanitizer.sanitize(
|
@@ -54,6 +53,20 @@ module Appsignal
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
56
|
+
def self.class_and_method_name_from_object_or_hash(payload, default_name)
|
57
|
+
# Attempt to find appsignal_name override
|
58
|
+
class_and_method_name = extract_value(payload, :appsignal_name, nil)
|
59
|
+
return class_and_method_name.split("#") if class_and_method_name.is_a?(String)
|
60
|
+
|
61
|
+
pound_split = default_name.split("#")
|
62
|
+
return pound_split if pound_split.length == 2
|
63
|
+
|
64
|
+
dot_split = default_name.split(".")
|
65
|
+
return default_name if dot_split.length == 2
|
66
|
+
|
67
|
+
["unknown"]
|
68
|
+
end
|
69
|
+
|
57
70
|
def self.extract_value(object_or_hash, field, default_value = nil, convert_to_s = false)
|
58
71
|
value = nil
|
59
72
|
|
data/lib/appsignal/minutely.rb
CHANGED
@@ -33,8 +33,7 @@ module Appsignal
|
|
33
33
|
# @return [void]
|
34
34
|
def <<(probe)
|
35
35
|
deprecation_message "Deprecated `Appsignal::Minute.probes <<` " \
|
36
|
-
"call. Please use `Appsignal::Minutely.probes.register` instead."
|
37
|
-
logger
|
36
|
+
"call. Please use `Appsignal::Minutely.probes.register` instead."
|
38
37
|
register probe.object_id, probe
|
39
38
|
end
|
40
39
|
|
@@ -28,10 +28,9 @@ module Appsignal
|
|
28
28
|
def initialize(app, _options = nil)
|
29
29
|
Appsignal.logger.debug \
|
30
30
|
"Initializing Appsignal::Rack::JSExceptionCatcher"
|
31
|
-
|
32
|
-
"Please use the official AppSignal JavaScript
|
33
|
-
"https://docs.appsignal.com/front-end/"
|
34
|
-
deprecation_message message, Appsignal.logger
|
31
|
+
deprecation_message "The Appsignal::Rack::JSExceptionCatcher is " \
|
32
|
+
"deprecated. Please use the official AppSignal JavaScript " \
|
33
|
+
"integration instead. https://docs.appsignal.com/front-end/"
|
35
34
|
@app = app
|
36
35
|
end
|
37
36
|
|
data/lib/appsignal/system.rb
CHANGED
@@ -76,14 +76,8 @@ module Appsignal
|
|
76
76
|
ldd_version && ldd_version[0]
|
77
77
|
end
|
78
78
|
|
79
|
-
# @api private
|
80
79
|
def self.jruby?
|
81
80
|
RUBY_PLATFORM == "java"
|
82
81
|
end
|
83
|
-
|
84
|
-
# @api private
|
85
|
-
def self.ruby_2_or_up?
|
86
|
-
versionify(RUBY_VERSION) >= versionify("2.0")
|
87
|
-
end
|
88
82
|
end
|
89
83
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Appsignal
|
2
2
|
module Utils
|
3
3
|
module DeprecationMessage
|
4
|
-
def deprecation_message(message, logger)
|
5
|
-
$
|
4
|
+
def deprecation_message(message, logger = Appsignal.logger)
|
5
|
+
$stderr.puts "appsignal WARNING: #{message}"
|
6
6
|
logger.warn message
|
7
7
|
end
|
8
8
|
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -263,7 +263,8 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
263
263
|
},
|
264
264
|
"download" => {
|
265
265
|
"download_url" => kind_of(String),
|
266
|
-
"checksum" => "verified"
|
266
|
+
"checksum" => "verified",
|
267
|
+
"http_proxy" => nil
|
267
268
|
},
|
268
269
|
"build" => {
|
269
270
|
"time" => kind_of(String),
|
@@ -5,6 +5,8 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
5
5
|
|
6
6
|
let(:out_stream) { std_stream }
|
7
7
|
let(:output) { out_stream.read }
|
8
|
+
let(:err_stream) { std_stream }
|
9
|
+
let(:stderr) { err_stream.read }
|
8
10
|
|
9
11
|
define :include_deploy_notification do
|
10
12
|
match do |log|
|
@@ -32,7 +34,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def run
|
35
|
-
|
37
|
+
capture_std_streams(out_stream, err_stream) do
|
36
38
|
run_cli("notify_of_deploy", options)
|
37
39
|
end
|
38
40
|
end
|
@@ -130,7 +132,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
130
132
|
it "prints a deprecation message" do
|
131
133
|
run
|
132
134
|
deprecation_message = "This command (appsignal notify_of_deploy) has been deprecated"
|
133
|
-
expect(
|
135
|
+
expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
|
134
136
|
expect(log).to contains_log :warn, deprecation_message
|
135
137
|
end
|
136
138
|
|
@@ -323,11 +323,11 @@ describe Appsignal::Config do
|
|
323
323
|
end
|
324
324
|
|
325
325
|
describe "support for old config keys" do
|
326
|
-
let(:
|
327
|
-
let(:
|
326
|
+
let(:err_stream) { std_stream }
|
327
|
+
let(:stderr) { err_stream.read }
|
328
328
|
let(:config) { project_fixture_config(env, {}, test_logger(log)) }
|
329
329
|
let(:log) { StringIO.new }
|
330
|
-
before {
|
330
|
+
before { capture_std_streams(std_stream, err_stream) { config } }
|
331
331
|
|
332
332
|
describe ":api_key" do
|
333
333
|
context "without :push_api_key" do
|
@@ -338,7 +338,7 @@ describe Appsignal::Config do
|
|
338
338
|
expect(config.config_hash).to_not have_key :api_key
|
339
339
|
|
340
340
|
message = "Old configuration key found. Please update the 'api_key' to 'push_api_key'"
|
341
|
-
expect(
|
341
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
342
342
|
expect(log_contents(log)).to contains_log :warn, message
|
343
343
|
end
|
344
344
|
end
|
@@ -351,7 +351,7 @@ describe Appsignal::Config do
|
|
351
351
|
expect(config.config_hash).to_not have_key :api_key
|
352
352
|
|
353
353
|
message = "Old configuration key found. Please update the 'api_key' to 'push_api_key'"
|
354
|
-
expect(
|
354
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
355
355
|
expect(log_contents(log)).to contains_log :warn, message
|
356
356
|
end
|
357
357
|
end
|
@@ -366,7 +366,7 @@ describe Appsignal::Config do
|
|
366
366
|
expect(config.config_hash).to_not have_key :ignore_exceptions
|
367
367
|
|
368
368
|
message = "Old configuration key found. Please update the 'ignore_exceptions' to 'ignore_errors'"
|
369
|
-
expect(
|
369
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
370
370
|
expect(log_contents(log)).to contains_log :warn, message
|
371
371
|
end
|
372
372
|
end
|
@@ -379,7 +379,7 @@ describe Appsignal::Config do
|
|
379
379
|
expect(config.config_hash).to_not have_key :ignore_exceptions
|
380
380
|
|
381
381
|
message = "Old configuration key found. Please update the 'ignore_exceptions' to 'ignore_errors'"
|
382
|
-
expect(
|
382
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
383
383
|
expect(log_contents(log)).to contains_log :warn, message
|
384
384
|
end
|
385
385
|
end
|
@@ -116,7 +116,8 @@ describe Appsignal::EventFormatter do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
context "when registering deprecated formatters" do
|
119
|
-
let(:
|
119
|
+
let(:err_stream) { std_stream }
|
120
|
+
let(:stderr) { err_stream.read }
|
120
121
|
let(:deprecated_formatter) do
|
121
122
|
Class.new(Appsignal::EventFormatter) do
|
122
123
|
register "mock.deprecated"
|
@@ -133,16 +134,16 @@ describe Appsignal::EventFormatter do
|
|
133
134
|
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
|
134
135
|
|
135
136
|
logs = capture_logs do
|
136
|
-
|
137
|
+
capture_std_streams(std_stream, err_stream) { deprecated_formatter }
|
137
138
|
end
|
138
139
|
expect(logs).to contains_log :warn, message
|
139
|
-
expect(
|
140
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
140
141
|
|
141
142
|
expect(klass.deprecated_formatter_classes.keys).to include("mock.deprecated")
|
142
143
|
end
|
143
144
|
|
144
145
|
it "initializes deprecated formatters" do
|
145
|
-
|
146
|
+
capture_std_streams(std_stream, err_stream) { deprecated_formatter }
|
146
147
|
klass.initialize_deprecated_formatters
|
147
148
|
|
148
149
|
expect(klass.registered?("mock.deprecated")).to be_truthy
|
@@ -36,6 +36,7 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
36
36
|
let(:time) { Time.parse("01-01-2001 10:01:00UTC") }
|
37
37
|
let(:created_at) { time - 3600 }
|
38
38
|
let(:run_at) { time - 3600 }
|
39
|
+
let(:payload_object) { double(:args => args) }
|
39
40
|
let(:job_data) do
|
40
41
|
{
|
41
42
|
:id => 123,
|
@@ -45,38 +46,40 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
45
46
|
:queue => "default",
|
46
47
|
:created_at => created_at,
|
47
48
|
:run_at => run_at,
|
48
|
-
:payload_object =>
|
49
|
+
:payload_object => payload_object
|
49
50
|
}
|
50
51
|
end
|
51
52
|
let(:args) { ["argument"] }
|
52
53
|
let(:job) { double(job_data) }
|
53
54
|
let(:invoked_block) { proc {} }
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
:class => "TestClass",
|
59
|
-
:method => "perform",
|
60
|
-
:metadata => {
|
61
|
-
:priority => 1,
|
62
|
-
:attempts => 1,
|
63
|
-
:queue => "default",
|
64
|
-
:id => "123"
|
65
|
-
},
|
66
|
-
:params => args,
|
67
|
-
:queue_start => run_at
|
68
|
-
}
|
69
|
-
end
|
70
|
-
after do
|
71
|
-
Timecop.freeze(time) do
|
56
|
+
def perform
|
57
|
+
Timecop.freeze(time) do
|
58
|
+
keep_transactions do
|
72
59
|
plugin.invoke_with_instrumentation(job, invoked_block)
|
73
60
|
end
|
74
61
|
end
|
62
|
+
end
|
75
63
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
64
|
+
context "with a normal call" do
|
65
|
+
it "wraps it in a transaction" do
|
66
|
+
perform
|
67
|
+
transaction_data = last_transaction.to_h
|
68
|
+
expect(transaction_data).to include(
|
69
|
+
"action" => "TestClass#perform",
|
70
|
+
"namespace" => "background_job",
|
71
|
+
"error" => nil
|
72
|
+
)
|
73
|
+
expect(transaction_data["events"].map { |e| e["name"] })
|
74
|
+
.to eql(["perform_job.delayed_job"])
|
75
|
+
expect(transaction_data["sample_data"]).to include(
|
76
|
+
"metadata" => {
|
77
|
+
"priority" => 1,
|
78
|
+
"attempts" => 1,
|
79
|
+
"queue" => "default",
|
80
|
+
"id" => "123"
|
81
|
+
},
|
82
|
+
"params" => ["argument"]
|
80
83
|
)
|
81
84
|
end
|
82
85
|
|
@@ -89,14 +92,13 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
89
92
|
end
|
90
93
|
|
91
94
|
it "adds the more complex arguments" do
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
)
|
95
|
+
perform
|
96
|
+
transaction_data = last_transaction.to_h
|
97
|
+
expect(transaction_data["sample_data"]).to include(
|
98
|
+
"params" => {
|
99
|
+
"foo" => "Foo",
|
100
|
+
"bar" => "Bar"
|
101
|
+
}
|
100
102
|
)
|
101
103
|
end
|
102
104
|
|
@@ -107,14 +109,13 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
107
109
|
end
|
108
110
|
|
109
111
|
it "filters selected arguments" do
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
)
|
112
|
+
perform
|
113
|
+
transaction_data = last_transaction.to_h
|
114
|
+
expect(transaction_data["sample_data"]).to include(
|
115
|
+
"params" => {
|
116
|
+
"foo" => "[FILTERED]",
|
117
|
+
"bar" => "Bar"
|
118
|
+
}
|
118
119
|
)
|
119
120
|
end
|
120
121
|
end
|
@@ -124,98 +125,135 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
124
125
|
let(:run_at) { Time.parse("2017-01-01 10:01:00UTC") }
|
125
126
|
|
126
127
|
it "reports queue_start with run_at time" do
|
128
|
+
# TODO: Not available in transaction.to_h yet.
|
129
|
+
# https://github.com/appsignal/appsignal-agent/issues/293
|
127
130
|
expect(Appsignal).to receive(:monitor_transaction).with(
|
128
131
|
"perform_job.delayed_job",
|
129
|
-
|
130
|
-
)
|
132
|
+
a_hash_including(:queue_start => run_at)
|
133
|
+
).and_call_original
|
134
|
+
perform
|
131
135
|
end
|
132
136
|
end
|
133
137
|
|
134
|
-
context "with
|
138
|
+
context "with class method job" do
|
135
139
|
let(:job_data) do
|
136
|
-
{
|
137
|
-
:payload_object => double(
|
138
|
-
:appsignal_name => "CustomClass#perform",
|
139
|
-
:args => args
|
140
|
-
),
|
141
|
-
:id => "123",
|
142
|
-
:name => "TestClass#perform",
|
143
|
-
:priority => 1,
|
144
|
-
:attempts => 1,
|
145
|
-
:queue => "default",
|
146
|
-
:created_at => created_at,
|
147
|
-
:run_at => run_at
|
148
|
-
}
|
149
|
-
end
|
150
|
-
let(:default_params) do
|
151
|
-
{
|
152
|
-
:class => "CustomClass",
|
153
|
-
:method => "perform",
|
154
|
-
:metadata => {
|
155
|
-
:priority => 1,
|
156
|
-
:attempts => 1,
|
157
|
-
:queue => "default",
|
158
|
-
:id => "123"
|
159
|
-
},
|
160
|
-
:queue_start => run_at
|
161
|
-
}
|
140
|
+
{ :name => "CustomClassMethod.perform", :payload_object => payload_object }
|
162
141
|
end
|
163
142
|
|
164
|
-
it "wraps it in a transaction
|
165
|
-
|
166
|
-
|
167
|
-
default_params.merge(
|
168
|
-
:params => ["argument"]
|
169
|
-
)
|
170
|
-
)
|
143
|
+
it "wraps it in a transaction using the class method job name" do
|
144
|
+
perform
|
145
|
+
expect(last_transaction.to_h["action"]).to eql("CustomClassMethod.perform")
|
171
146
|
end
|
147
|
+
end
|
172
148
|
|
173
|
-
|
174
|
-
|
175
|
-
{
|
176
|
-
:foo => "Foo",
|
177
|
-
:bar => "Bar"
|
178
|
-
}
|
179
|
-
end
|
149
|
+
context "with custom name call" do
|
150
|
+
before { perform }
|
180
151
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
152
|
+
context "with appsignal_name defined" do
|
153
|
+
context "with payload_object being an object" do
|
154
|
+
context "with value" do
|
155
|
+
let(:payload_object) { double(:appsignal_name => "CustomClass#perform") }
|
156
|
+
|
157
|
+
it "wraps it in a transaction using the custom name" do
|
158
|
+
expect(last_transaction.to_h["action"]).to eql("CustomClass#perform")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
context "with non-String value" do
|
163
|
+
let(:payload_object) { double(:appsignal_name => Object.new) }
|
164
|
+
|
165
|
+
it "wraps it in a transaction using the original job name" do
|
166
|
+
expect(last_transaction.to_h["action"]).to eql("TestClass#perform")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context "with class method name as job" do
|
171
|
+
let(:payload_object) { double(:appsignal_name => "CustomClassMethod.perform") }
|
172
|
+
|
173
|
+
it "wraps it in a transaction using the custom name" do
|
174
|
+
perform
|
175
|
+
expect(last_transaction.to_h["action"]).to eql("CustomClassMethod.perform")
|
176
|
+
end
|
177
|
+
end
|
191
178
|
end
|
192
179
|
|
193
|
-
context "with
|
194
|
-
|
195
|
-
|
196
|
-
|
180
|
+
context "with payload_object being a Hash" do
|
181
|
+
context "with value" do
|
182
|
+
let(:payload_object) { double(:appsignal_name => "CustomClassHash#perform") }
|
183
|
+
|
184
|
+
it "wraps it in a transaction using the custom name" do
|
185
|
+
expect(last_transaction.to_h["action"]).to eql("CustomClassHash#perform")
|
186
|
+
end
|
197
187
|
end
|
198
188
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
)
|
189
|
+
context "with non-String value" do
|
190
|
+
let(:payload_object) { double(:appsignal_name => Object.new) }
|
191
|
+
|
192
|
+
it "wraps it in a transaction using the original job name" do
|
193
|
+
expect(last_transaction.to_h["action"]).to eql("TestClass#perform")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context "with class method name as job" do
|
198
|
+
let(:payload_object) { { :appsignal_name => "CustomClassMethod.perform" } }
|
199
|
+
|
200
|
+
it "wraps it in a transaction using the custom name" do
|
201
|
+
perform
|
202
|
+
expect(last_transaction.to_h["action"]).to eql("CustomClassMethod.perform")
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "with payload_object being acting like a Hash and returning a non-String value" do
|
208
|
+
class ClassActingAsHash
|
209
|
+
def self.[](_key)
|
210
|
+
Object.new
|
211
|
+
end
|
212
|
+
|
213
|
+
def self.appsignal_name
|
214
|
+
"ClassActingAsHash#perform"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
let(:payload_object) { ClassActingAsHash }
|
218
|
+
|
219
|
+
# We check for hash values before object values
|
220
|
+
# this means ClassActingAsHash returns `Object.new` instead
|
221
|
+
# of `self.appsignal_name`. Since this isn't a valid `String`
|
222
|
+
# we return the default job name as action name.
|
223
|
+
it "wraps it in a transaction using the original job name" do
|
224
|
+
expect(last_transaction.to_h["action"]).to eql("TestClass#perform")
|
209
225
|
end
|
210
226
|
end
|
211
227
|
end
|
212
228
|
end
|
213
229
|
|
230
|
+
context "without job name" do
|
231
|
+
let(:job_data) do
|
232
|
+
{ :name => "", :payload_object => payload_object }
|
233
|
+
end
|
234
|
+
|
235
|
+
it "wraps it in a transaction using the class method job name" do
|
236
|
+
perform
|
237
|
+
expect(last_transaction.to_h["action"]).to eql("unknown")
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
context "with invalid job name" do
|
242
|
+
let(:job_data) do
|
243
|
+
{ :name => "Banana", :payload_object => payload_object }
|
244
|
+
end
|
245
|
+
|
246
|
+
it "wraps it in a transaction using the class method job name" do
|
247
|
+
perform
|
248
|
+
expect(last_transaction.to_h["action"]).to eql("unknown")
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
214
252
|
if active_job_present?
|
215
253
|
require "active_job"
|
216
254
|
|
217
255
|
context "when wrapped by ActiveJob" do
|
218
|
-
let(:
|
256
|
+
let(:payload_object) do
|
219
257
|
ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper.new(
|
220
258
|
"arguments" => args,
|
221
259
|
"job_class" => "TestClass",
|
@@ -233,32 +271,30 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
233
271
|
:queue => "default",
|
234
272
|
:created_at => created_at,
|
235
273
|
:run_at => run_at,
|
236
|
-
:payload_object =>
|
274
|
+
:payload_object => payload_object
|
237
275
|
)
|
238
276
|
end
|
239
|
-
let(:default_params) do
|
240
|
-
{
|
241
|
-
:class => "TestClass",
|
242
|
-
:method => "perform",
|
243
|
-
:metadata => {
|
244
|
-
:priority => 1,
|
245
|
-
:attempts => 1,
|
246
|
-
:queue => "default",
|
247
|
-
:id => "123"
|
248
|
-
},
|
249
|
-
:queue_start => run_at,
|
250
|
-
:params => args
|
251
|
-
}
|
252
|
-
end
|
253
277
|
let(:args) { ["activejob_argument"] }
|
254
278
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
279
|
+
it "wraps it in a transaction with the correct params" do
|
280
|
+
perform
|
281
|
+
transaction_data = last_transaction.to_h
|
282
|
+
expect(transaction_data).to include(
|
283
|
+
"action" => "TestClass#perform",
|
284
|
+
"namespace" => "background_job",
|
285
|
+
"error" => nil
|
286
|
+
)
|
287
|
+
expect(transaction_data["events"].map { |e| e["name"] })
|
288
|
+
.to eql(["perform_job.delayed_job"])
|
289
|
+
expect(transaction_data["sample_data"]).to include(
|
290
|
+
"metadata" => {
|
291
|
+
"priority" => 1,
|
292
|
+
"attempts" => 1,
|
293
|
+
"queue" => "default",
|
294
|
+
"id" => "123"
|
295
|
+
},
|
296
|
+
"params" => ["activejob_argument"]
|
297
|
+
)
|
262
298
|
end
|
263
299
|
|
264
300
|
context "with more complex params" do
|
@@ -270,14 +306,14 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
270
306
|
end
|
271
307
|
|
272
308
|
it "adds the more complex arguments" do
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
309
|
+
perform
|
310
|
+
transaction_data = last_transaction.to_h
|
311
|
+
expect(transaction_data).to include("action" => "TestClass#perform")
|
312
|
+
expect(transaction_data["sample_data"]).to include(
|
313
|
+
"params" => {
|
314
|
+
"foo" => "Foo",
|
315
|
+
"bar" => "Bar"
|
316
|
+
}
|
281
317
|
)
|
282
318
|
end
|
283
319
|
|
@@ -288,14 +324,14 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
288
324
|
end
|
289
325
|
|
290
326
|
it "filters selected arguments" do
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
327
|
+
perform
|
328
|
+
transaction_data = last_transaction.to_h
|
329
|
+
expect(transaction_data).to include("action" => "TestClass#perform")
|
330
|
+
expect(transaction_data["sample_data"]).to include(
|
331
|
+
"params" => {
|
332
|
+
"foo" => "[FILTERED]",
|
333
|
+
"bar" => "Bar"
|
334
|
+
}
|
299
335
|
)
|
300
336
|
end
|
301
337
|
end
|
@@ -307,8 +343,9 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
307
343
|
it "reports queue_start with run_at time" do
|
308
344
|
expect(Appsignal).to receive(:monitor_transaction).with(
|
309
345
|
"perform_job.delayed_job",
|
310
|
-
|
311
|
-
)
|
346
|
+
a_hash_including(:queue_start => run_at)
|
347
|
+
).and_call_original
|
348
|
+
perform
|
312
349
|
end
|
313
350
|
end
|
314
351
|
end
|
@@ -316,33 +353,28 @@ describe Appsignal::Hooks::DelayedJobHook do
|
|
316
353
|
end
|
317
354
|
|
318
355
|
context "with an erroring call" do
|
319
|
-
let(:error) { ExampleException }
|
320
|
-
let(:transaction) do
|
321
|
-
Appsignal::Transaction.new(
|
322
|
-
SecureRandom.uuid,
|
323
|
-
Appsignal::Transaction::BACKGROUND_JOB,
|
324
|
-
Appsignal::Transaction::GenericRequest.new({})
|
325
|
-
)
|
326
|
-
end
|
356
|
+
let(:error) { ExampleException.new("uh oh") }
|
327
357
|
before do
|
328
358
|
expect(invoked_block).to receive(:call).and_raise(error)
|
329
|
-
|
330
|
-
allow(Appsignal::Transaction).to receive(:current).and_return(transaction)
|
331
|
-
expect(Appsignal::Transaction).to receive(:create)
|
332
|
-
.with(
|
333
|
-
kind_of(String),
|
334
|
-
Appsignal::Transaction::BACKGROUND_JOB,
|
335
|
-
kind_of(Appsignal::Transaction::GenericRequest)
|
336
|
-
).and_return(transaction)
|
337
359
|
end
|
338
360
|
|
339
361
|
it "adds the error to the transaction" do
|
340
|
-
expect(transaction).to receive(:set_error).with(error)
|
341
|
-
expect(transaction).to receive(:complete)
|
342
|
-
|
343
362
|
expect do
|
344
|
-
|
363
|
+
perform
|
345
364
|
end.to raise_error(error)
|
365
|
+
|
366
|
+
transaction_data = last_transaction.to_h
|
367
|
+
expect(transaction_data).to include(
|
368
|
+
"action" => "TestClass#perform",
|
369
|
+
"namespace" => "background_job",
|
370
|
+
"error" => {
|
371
|
+
"name" => "ExampleException",
|
372
|
+
"message" => "uh oh",
|
373
|
+
# TODO: backtrace should be an Array of Strings
|
374
|
+
# https://github.com/appsignal/appsignal-agent/issues/294
|
375
|
+
"backtrace" => kind_of(String)
|
376
|
+
}
|
377
|
+
)
|
346
378
|
end
|
347
379
|
end
|
348
380
|
end
|
@@ -285,19 +285,19 @@ describe Appsignal::Minutely do
|
|
285
285
|
end
|
286
286
|
|
287
287
|
describe "#<<" do
|
288
|
-
let(:
|
289
|
-
let(:
|
288
|
+
let(:err_stream) { std_stream }
|
289
|
+
let(:stderr) { err_stream.read }
|
290
290
|
let(:log_stream) { std_stream }
|
291
291
|
let(:log) { log_contents(log_stream) }
|
292
292
|
before { Appsignal.logger = test_logger(log_stream) }
|
293
293
|
|
294
294
|
it "adds the probe, but prints a deprecation warning" do
|
295
295
|
probe = lambda {}
|
296
|
-
|
296
|
+
capture_std_streams(std_stream, err_stream) { collection << probe }
|
297
297
|
deprecation_message = "Deprecated " \
|
298
298
|
"`Appsignal::Minute.probes <<` call. Please use " \
|
299
299
|
"`Appsignal::Minutely.probes.register` instead."
|
300
|
-
expect(
|
300
|
+
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
301
301
|
expect(log).to contains_log :warn, deprecation_message
|
302
302
|
expect(collection[probe.object_id]).to eql(probe)
|
303
303
|
end
|
@@ -11,18 +11,22 @@ describe Appsignal::Rack::JSExceptionCatcher do
|
|
11
11
|
before { Appsignal.config = config }
|
12
12
|
|
13
13
|
describe "#initialize" do
|
14
|
+
let(:out_stream) { std_stream }
|
15
|
+
let(:err_stream) { std_stream }
|
16
|
+
let(:output) { out_stream.read }
|
17
|
+
let(:stderr) { err_stream.read }
|
18
|
+
|
14
19
|
it "logs to the logger" do
|
15
|
-
stdout = std_stream
|
16
|
-
stderr = std_stream
|
17
20
|
log = capture_logs do
|
18
|
-
capture_std_streams(
|
21
|
+
capture_std_streams(out_stream, err_stream) do
|
19
22
|
Appsignal::Rack::JSExceptionCatcher.new(app, options)
|
20
23
|
end
|
21
24
|
end
|
22
25
|
expect(log).to contains_log(:warn, deprecation_message)
|
23
26
|
expect(log).to contains_log(:debug, "Initializing Appsignal::Rack::JSExceptionCatcher")
|
24
|
-
expect(
|
25
|
-
expect(stderr
|
27
|
+
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
28
|
+
expect(stderr).to_not include("appsignal:")
|
29
|
+
expect(output).to be_empty
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
@@ -93,40 +93,4 @@ describe Appsignal::System do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
97
|
-
describe ".ruby_2_or_up?" do
|
98
|
-
around do |example|
|
99
|
-
original_ruby_version = RUBY_VERSION
|
100
|
-
Object.send(:remove_const, "RUBY_VERSION")
|
101
|
-
Object.const_set("RUBY_VERSION", ruby_version)
|
102
|
-
example.run
|
103
|
-
Object.send(:remove_const, "RUBY_VERSION")
|
104
|
-
Object.const_set("RUBY_VERSION", original_ruby_version)
|
105
|
-
end
|
106
|
-
subject { described_class.ruby_2_or_up? }
|
107
|
-
|
108
|
-
context "when on Ruby 1.9" do
|
109
|
-
let(:ruby_version) { "1.9.3-p533" }
|
110
|
-
|
111
|
-
it "returns false" do
|
112
|
-
is_expected.to be(false)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context "when on Ruby 2.0" do
|
117
|
-
let(:ruby_version) { "2.0.0" }
|
118
|
-
|
119
|
-
it "returns true" do
|
120
|
-
is_expected.to be(true)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context "when on Ruby 2.x" do
|
125
|
-
let(:ruby_version) { "2.1.0" }
|
126
|
-
|
127
|
-
it "returns true" do
|
128
|
-
is_expected.to be(true)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
96
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -949,7 +949,7 @@ describe Appsignal do
|
|
949
949
|
|
950
950
|
it "outputs deprecated warning" do
|
951
951
|
subject
|
952
|
-
expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement
|
952
|
+
expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement")
|
953
953
|
end
|
954
954
|
|
955
955
|
context "when error is not in the ignored list" do
|
@@ -981,7 +981,7 @@ describe Appsignal do
|
|
981
981
|
|
982
982
|
it "outputs deprecated warning" do
|
983
983
|
subject
|
984
|
-
expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement
|
984
|
+
expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement")
|
985
985
|
end
|
986
986
|
|
987
987
|
context "when action is not in the ingore list" do
|
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.10.
|
4
|
+
version: 2.10.9.beta.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-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -241,7 +241,6 @@ files:
|
|
241
241
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
242
242
|
- lib/appsignal/integrations/grape.rb
|
243
243
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
244
|
-
- lib/appsignal/integrations/net_http.rb
|
245
244
|
- lib/appsignal/integrations/object.rb
|
246
245
|
- lib/appsignal/integrations/padrino.rb
|
247
246
|
- lib/appsignal/integrations/que.rb
|
@@ -406,9 +405,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
406
405
|
version: '1.9'
|
407
406
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
408
407
|
requirements:
|
409
|
-
- - "
|
408
|
+
- - ">"
|
410
409
|
- !ruby/object:Gem::Version
|
411
|
-
version:
|
410
|
+
version: 1.3.1
|
412
411
|
requirements: []
|
413
412
|
rubygems_version: 3.1.2
|
414
413
|
signing_key:
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appsignal
|
4
|
-
module Integrations
|
5
|
-
module NetHttpIntegration
|
6
|
-
def request(request, body = nil, &block)
|
7
|
-
Appsignal.instrument(
|
8
|
-
"request.net_http",
|
9
|
-
"#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
|
10
|
-
) do
|
11
|
-
super
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|