appsignal 3.0.0.beta.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/.semaphore/semaphore.yml +88 -88
- data/CHANGELOG.md +41 -1
- data/Rakefile +12 -4
- data/appsignal.gemspec +7 -5
- data/build_matrix.yml +11 -11
- data/ext/agent.yml +17 -17
- data/gemfiles/no_dependencies.gemfile +0 -7
- data/lib/appsignal.rb +1 -2
- data/lib/appsignal/config.rb +1 -1
- data/lib/appsignal/extension.rb +50 -0
- data/lib/appsignal/helpers/instrumentation.rb +69 -5
- data/lib/appsignal/hooks.rb +16 -0
- data/lib/appsignal/hooks/action_cable.rb +10 -2
- data/lib/appsignal/hooks/sidekiq.rb +9 -142
- data/lib/appsignal/integrations/object.rb +21 -43
- data/lib/appsignal/integrations/railtie.rb +0 -4
- data/lib/appsignal/integrations/sidekiq.rb +171 -0
- data/lib/appsignal/minutely.rb +6 -0
- data/lib/appsignal/transaction.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +2 -0
- data/spec/lib/appsignal/extension_install_failure_spec.rb +0 -7
- data/spec/lib/appsignal/extension_spec.rb +43 -9
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +88 -0
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +60 -458
- data/spec/lib/appsignal/hooks_spec.rb +41 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +91 -4
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +524 -0
- data/spec/lib/appsignal/transaction_spec.rb +17 -0
- data/spec/lib/appsignal/utils/data_spec.rb +133 -87
- data/spec/lib/appsignal_spec.rb +162 -47
- data/spec/lib/puma/appsignal_spec.rb +28 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/testing.rb +11 -1
- metadata +9 -8
- data/gemfiles/rails-4.0.gemfile +0 -6
- data/gemfiles/rails-4.1.gemfile +0 -6
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,50 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 3.0.3
|
4
|
+
- Fix deprecation message for set_error namespace argument. PR #712
|
5
|
+
- Fix example code for Transaction#set_namespace method. PR #713
|
6
|
+
- Fix extension fallbacks on extension installation failure, that caused
|
7
|
+
- NoMethodErrors. PR #720
|
8
|
+
- Bump agent to v-75e76ad. PR #721
|
9
|
+
|
10
|
+
# 3.0.2
|
11
|
+
- Fix error on Rails boot when `enable_frontend_error_catching` is `true`.
|
12
|
+
PR #711
|
13
|
+
|
14
|
+
# 3.0.1
|
15
|
+
- Fix error occurring on APPSIGNAL_DNS_SERVER environment variable option
|
16
|
+
parsing. PR #709
|
17
|
+
|
3
18
|
# 3.0.0
|
19
|
+
|
20
|
+
Please read our [upgrade from version 2 to 3 guide][upgrade3] before upgrading.
|
21
|
+
|
22
|
+
[upgrade3]: https://docs.appsignal.com/ruby/installation/upgrade-from-2-to-3.html
|
23
|
+
|
4
24
|
- Drop Ruby 1.9 support. PR #683, #682, #688, #694
|
25
|
+
- Require Ruby 2.0 or newer for gem. PR #701
|
5
26
|
- Use Module.prepend for all gem integrations. Fixes #603 in combination with
|
6
27
|
other gems that provide instrumentation for gems. PR #683
|
7
|
-
- Remove deprecated integrations, classes, methods and arguments. PR #685
|
28
|
+
- Remove deprecated integrations, classes, methods and arguments. PR #685, #686
|
29
|
+
- Deprecate `set_error` and `send_error` error helpers `tags` and `namespace`
|
30
|
+
arguments. PR #702
|
31
|
+
- Add Sidekiq error handler. Report more Sidekiq errors that happen around job
|
32
|
+
execution. PR #699
|
33
|
+
|
34
|
+
# 2.11.9
|
35
|
+
- Fix and simplify Ruby method delegation for object method instrumentation in
|
36
|
+
the different Ruby versions. PR #706
|
37
|
+
|
38
|
+
# 2.11.8
|
39
|
+
- Mark minutely probe thread as fork-safe by @pixeltrix. PR #704
|
40
|
+
|
41
|
+
# 2.11.7
|
42
|
+
- Fix ActionCable integration in test environment using `stub_connection`.
|
43
|
+
PR #705
|
44
|
+
|
45
|
+
# 2.11.6
|
46
|
+
- Prepend Sidekiq middleware to wrap all Sidekiq middleware. Catches more
|
47
|
+
errors and provide more complete performance measurements. PR #698
|
8
48
|
|
9
49
|
# 2.11.5
|
10
50
|
- Add more detailed logging to finish_event calls when the event is unknown, so
|
data/Rakefile
CHANGED
@@ -377,8 +377,6 @@ begin
|
|
377
377
|
is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
378
378
|
excludes = []
|
379
379
|
excludes << "spec/lib/appsignal/extension/jruby_spec.rb" unless is_jruby
|
380
|
-
is_ruby19 = RUBY_VERSION < "2.0"
|
381
|
-
excludes << "spec/lib/appsignal/integrations/object_spec.rb" if is_ruby19
|
382
380
|
exclude_pattern = "--exclude-pattern=#{excludes.join(",")}" if excludes.any?
|
383
381
|
|
384
382
|
desc "Run the AppSignal gem test suite."
|
@@ -387,10 +385,20 @@ begin
|
|
387
385
|
end
|
388
386
|
|
389
387
|
namespace :test do
|
390
|
-
|
391
|
-
RSpec::Core::RakeTask.new :failure do |t|
|
388
|
+
RSpec::Core::RakeTask.new :rspec_failure do |t|
|
392
389
|
t.rspec_opts = "#{exclude_pattern} --tag extension_installation_failure"
|
393
390
|
end
|
391
|
+
|
392
|
+
desc "Intentionally fail the extension installation"
|
393
|
+
task :prepare_failure do
|
394
|
+
# ENV var to make sure installation fails on purpurse
|
395
|
+
ENV["_TEST_APPSIGNAL_EXTENSION_FAILURE"] = "true"
|
396
|
+
# Run extension installation with intentional failure
|
397
|
+
`rake extension:install`
|
398
|
+
end
|
399
|
+
|
400
|
+
desc "Run the Appsignal gem test in an extension failure scenario"
|
401
|
+
task :failure => [:prepare_failure, :rspec_failure]
|
394
402
|
end
|
395
403
|
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
396
404
|
# When running rake install, there is no RSpec yet.
|
data/appsignal.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
21
21
|
gem.name = "appsignal"
|
22
22
|
gem.require_paths = %w[lib ext]
|
23
23
|
gem.version = Appsignal::VERSION
|
24
|
-
gem.required_ruby_version = ">=
|
24
|
+
gem.required_ruby_version = ">= 2.0"
|
25
25
|
# Default extension installer. Overridden by JRuby gemspec as defined in
|
26
26
|
# `Rakefile`.
|
27
27
|
gem.extensions = %w[ext/extconf.rb]
|
@@ -42,9 +42,11 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
42
42
|
gem.add_development_dependency "timecop"
|
43
43
|
gem.add_development_dependency "webmock"
|
44
44
|
gem.add_development_dependency "yard", ">= 0.9.20"
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
gem.add_development_dependency "pry"
|
46
|
+
gem.add_development_dependency "rubocop", "0.50.0"
|
47
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
|
48
|
+
# Newer versions of rexml use keyword arguments with optional arguments which
|
49
|
+
# work in Ruby 2.1 and newer.
|
50
|
+
gem.add_development_dependency "rexml", "3.2.4"
|
49
51
|
end
|
50
52
|
end
|
data/build_matrix.yml
CHANGED
@@ -58,7 +58,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
58
58
|
- name: Validate CI setup
|
59
59
|
env_vars:
|
60
60
|
- name: RUBY_VERSION
|
61
|
-
value: 2.6.
|
61
|
+
value: 2.6.6
|
62
62
|
- name: GEMSET
|
63
63
|
value: no_dependencies
|
64
64
|
- name: BUNDLE_GEMFILE
|
@@ -72,7 +72,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
72
72
|
- name: RuboCop
|
73
73
|
env_vars:
|
74
74
|
- name: RUBY_VERSION
|
75
|
-
value: 2.6.
|
75
|
+
value: 2.6.6
|
76
76
|
- name: GEMSET
|
77
77
|
value: no_dependencies
|
78
78
|
- name: BUNDLE_GEMFILE
|
@@ -107,12 +107,12 @@ matrix:
|
|
107
107
|
gems: "none"
|
108
108
|
- ruby: "2.3.8"
|
109
109
|
gems: "none"
|
110
|
-
- ruby: "2.4.
|
110
|
+
- ruby: "2.4.10"
|
111
111
|
gems: "none"
|
112
|
-
- ruby: "2.5.
|
112
|
+
- ruby: "2.5.8"
|
113
113
|
gems: "minimal"
|
114
|
-
- ruby: "2.6.
|
115
|
-
- ruby: "2.7.
|
114
|
+
- ruby: "2.6.6"
|
115
|
+
- ruby: "2.7.2"
|
116
116
|
- ruby: "3.0.0"
|
117
117
|
- ruby: "jruby-9.1.17.0"
|
118
118
|
gems: "minimal"
|
@@ -134,15 +134,15 @@ matrix:
|
|
134
134
|
bundler: "1.17.3"
|
135
135
|
exclude:
|
136
136
|
ruby:
|
137
|
-
- "2.6.
|
138
|
-
- "2.7.
|
137
|
+
- "2.6.6"
|
138
|
+
- "2.7.2"
|
139
139
|
- "3.0.0"
|
140
140
|
- gem: "rails-4.2"
|
141
141
|
bundler: "1.17.3"
|
142
142
|
exclude:
|
143
143
|
ruby:
|
144
|
-
- "2.6.
|
145
|
-
- "2.7.
|
144
|
+
- "2.6.6"
|
145
|
+
- "2.7.2"
|
146
146
|
- "3.0.0"
|
147
147
|
- gem: "rails-5.0"
|
148
148
|
exclude:
|
@@ -166,7 +166,7 @@ matrix:
|
|
166
166
|
- "2.1.10"
|
167
167
|
- "2.2.10"
|
168
168
|
- "2.3.8"
|
169
|
-
- "2.4.
|
169
|
+
- "2.4.10"
|
170
170
|
- "jruby-9.1.17.0"
|
171
171
|
- gem: "resque-1"
|
172
172
|
bundler: "1.17.3"
|
data/ext/agent.yml
CHANGED
@@ -1,62 +1,62 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 75e76ad
|
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: 81edea50b934fe5b42c0081a1de5782bc477c321c1c76127d7fa525917f70a04
|
10
10
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
11
11
|
dynamic:
|
12
|
-
checksum:
|
12
|
+
checksum: 60befd59ac704ee21d5881ca0aef6b38caa50b1d1972425bf8f40b4f9710ec1e
|
13
13
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
14
14
|
universal-darwin:
|
15
15
|
static:
|
16
|
-
checksum:
|
16
|
+
checksum: 81edea50b934fe5b42c0081a1de5782bc477c321c1c76127d7fa525917f70a04
|
17
17
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
18
18
|
dynamic:
|
19
|
-
checksum:
|
19
|
+
checksum: 60befd59ac704ee21d5881ca0aef6b38caa50b1d1972425bf8f40b4f9710ec1e
|
20
20
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
21
21
|
i686-linux:
|
22
22
|
static:
|
23
|
-
checksum:
|
23
|
+
checksum: 60ad6a1f69c8f89b5642f49fbf794409e8ada7d63a9126b2c59832c2a92d5b22
|
24
24
|
filename: appsignal-i686-linux-all-static.tar.gz
|
25
25
|
dynamic:
|
26
|
-
checksum:
|
26
|
+
checksum: aedf259de392ea00fd17bc30924cde70d9a1d82a62c6eeefc881cd5ea5dcce63
|
27
27
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
28
28
|
x86-linux:
|
29
29
|
static:
|
30
|
-
checksum:
|
30
|
+
checksum: 60ad6a1f69c8f89b5642f49fbf794409e8ada7d63a9126b2c59832c2a92d5b22
|
31
31
|
filename: appsignal-i686-linux-all-static.tar.gz
|
32
32
|
dynamic:
|
33
|
-
checksum:
|
33
|
+
checksum: aedf259de392ea00fd17bc30924cde70d9a1d82a62c6eeefc881cd5ea5dcce63
|
34
34
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
35
35
|
x86_64-linux:
|
36
36
|
static:
|
37
|
-
checksum:
|
37
|
+
checksum: 7e3cf760f9bd364a6602f05e5014ce1c8e8ac9a97f7a533769711e0fb21e1f45
|
38
38
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
39
39
|
dynamic:
|
40
|
-
checksum:
|
40
|
+
checksum: 4a9a4ea22abc93c3afa7d5bfd6f442cd69bf4d672e8db2df1aa2157cfb3fcc4b
|
41
41
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
42
42
|
x86_64-linux-musl:
|
43
43
|
static:
|
44
|
-
checksum:
|
44
|
+
checksum: 4d4dd00607cbe0fb4d14a15e74990f207eba90134c2d1a079b58f0d50f1ab76b
|
45
45
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
46
46
|
dynamic:
|
47
|
-
checksum:
|
47
|
+
checksum: 067a6d821e220c9c88ceb8f936390ce458fa94f41c13d32603d773485a8cdfd2
|
48
48
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
49
49
|
x86_64-freebsd:
|
50
50
|
static:
|
51
|
-
checksum:
|
51
|
+
checksum: 176bc1ff1ad40a585ea10456a8ae3f6502c614d713dcbb957d550fa1ae44e7ca
|
52
52
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
53
53
|
dynamic:
|
54
|
-
checksum:
|
54
|
+
checksum: 88c6f3e03f8f6c25a4705f7d6c4286eaa563069a9fb8fad3c0a19e5b9a09f80b
|
55
55
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
56
56
|
amd64-freebsd:
|
57
57
|
static:
|
58
|
-
checksum:
|
58
|
+
checksum: 176bc1ff1ad40a585ea10456a8ae3f6502c614d713dcbb957d550fa1ae44e7ca
|
59
59
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
60
60
|
dynamic:
|
61
|
-
checksum:
|
61
|
+
checksum: 88c6f3e03f8f6c25a4705f7d6c4286eaa563069a9fb8fad3c0a19e5b9a09f80b
|
62
62
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
@@ -2,11 +2,4 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rack', '~> 1.6'
|
4
4
|
|
5
|
-
ruby_version = Gem::Version.new(RUBY_VERSION)
|
6
|
-
if ruby_version < Gem::Version.new("2.0.0")
|
7
|
-
# Newer versions of this gem have rexml as a dependency which doesn't work on
|
8
|
-
# Ruby 1.9
|
9
|
-
gem "crack", "0.4.4"
|
10
|
-
end
|
11
|
-
|
12
5
|
gemspec :path => '../'
|
data/lib/appsignal.rb
CHANGED
@@ -4,9 +4,9 @@ require "json"
|
|
4
4
|
require "securerandom"
|
5
5
|
|
6
6
|
require "appsignal/logger"
|
7
|
+
require "appsignal/utils/deprecation_message"
|
7
8
|
require "appsignal/helpers/instrumentation"
|
8
9
|
require "appsignal/helpers/metrics"
|
9
|
-
require "appsignal/utils/deprecation_message"
|
10
10
|
|
11
11
|
# AppSignal for Ruby gem's main module.
|
12
12
|
#
|
@@ -18,7 +18,6 @@ module Appsignal
|
|
18
18
|
class << self
|
19
19
|
include Helpers::Instrumentation
|
20
20
|
include Helpers::Metrics
|
21
|
-
include Utils::DeprecationMessage
|
22
21
|
|
23
22
|
# Accessor for the AppSignal configuration.
|
24
23
|
# Return the current AppSignal configuration.
|
data/lib/appsignal/config.rb
CHANGED
@@ -81,7 +81,6 @@ module Appsignal
|
|
81
81
|
ENV_STRING_KEYS = %w[
|
82
82
|
APPSIGNAL_APP_NAME
|
83
83
|
APPSIGNAL_CA_FILE_PATH
|
84
|
-
APPSIGNAL_DNS_SERVERS
|
85
84
|
APPSIGNAL_HOSTNAME
|
86
85
|
APPSIGNAL_HTTP_PROXY
|
87
86
|
APPSIGNAL_LOG
|
@@ -112,6 +111,7 @@ module Appsignal
|
|
112
111
|
].freeze
|
113
112
|
# @api private
|
114
113
|
ENV_ARRAY_KEYS = %w[
|
114
|
+
APPSIGNAL_DNS_SERVERS
|
115
115
|
APPSIGNAL_FILTER_PARAMETERS
|
116
116
|
APPSIGNAL_FILTER_SESSION_DATA
|
117
117
|
APPSIGNAL_IGNORE_ACTIONS
|
data/lib/appsignal/extension.rb
CHANGED
@@ -40,6 +40,16 @@ module Appsignal
|
|
40
40
|
def method_missing(m, *args, &block)
|
41
41
|
super if Appsignal.testing?
|
42
42
|
end
|
43
|
+
|
44
|
+
unless Appsignal.extension_loaded?
|
45
|
+
def data_map_new
|
46
|
+
Appsignal::Extension::MockData.new
|
47
|
+
end
|
48
|
+
|
49
|
+
def data_array_new
|
50
|
+
Appsignal::Extension::MockData.new
|
51
|
+
end
|
52
|
+
end
|
43
53
|
end
|
44
54
|
|
45
55
|
if Appsignal::System.jruby?
|
@@ -62,5 +72,45 @@ module Appsignal
|
|
62
72
|
"#<#{self.class.name}:#{object_id} #{self}>"
|
63
73
|
end
|
64
74
|
end
|
75
|
+
|
76
|
+
# Mock of the {Data} class. This mock is used when the extension cannot be
|
77
|
+
# loaded. This mock listens to all method calls and does nothing, and
|
78
|
+
# prevents NoMethodErrors from being raised.
|
79
|
+
#
|
80
|
+
# Disabled in testing so we can make sure that we don't miss an extension
|
81
|
+
# function implementation.
|
82
|
+
#
|
83
|
+
# This class inherits from the {Data} class so that it passes type checks.
|
84
|
+
class MockData < Data
|
85
|
+
def initialize(*_args)
|
86
|
+
# JRuby extension requirement, as it sends a pointer to the Data object
|
87
|
+
# when creating it
|
88
|
+
end
|
89
|
+
|
90
|
+
def method_missing(_method, *_args, &_block)
|
91
|
+
super if Appsignal.testing?
|
92
|
+
end
|
93
|
+
|
94
|
+
def to_s
|
95
|
+
"{}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Mock of the {Transaction} class. This mock is used when the extension
|
100
|
+
# cannot be loaded. This mock listens to all method calls and does nothing,
|
101
|
+
# and prevents NoMethodErrors from being raised.
|
102
|
+
#
|
103
|
+
# Disabled in testing so we can make sure that we don't miss an extension
|
104
|
+
# function implementation.
|
105
|
+
class MockTransaction
|
106
|
+
def initialize(*_args)
|
107
|
+
# JRuby extension requirement, as it sends a pointer to the Transaction
|
108
|
+
# object when creating it
|
109
|
+
end
|
110
|
+
|
111
|
+
def method_missing(_method, *_args, &_block)
|
112
|
+
super if Appsignal.testing?
|
113
|
+
end
|
114
|
+
end
|
65
115
|
end
|
66
116
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Appsignal
|
4
4
|
module Helpers
|
5
5
|
module Instrumentation # rubocop:disable Metrics/ModuleLength
|
6
|
+
include Appsignal::Utils::DeprecationMessage
|
7
|
+
|
6
8
|
# Creates an AppSignal transaction for the given block.
|
7
9
|
#
|
8
10
|
# If AppSignal is not {.active?} it will still execute the block, but not
|
@@ -139,7 +141,10 @@ module Appsignal
|
|
139
141
|
)
|
140
142
|
yield
|
141
143
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
142
|
-
send_error(error
|
144
|
+
send_error(error) do |transaction|
|
145
|
+
transaction.set_tags(tags) if tags
|
146
|
+
transaction.set_namespace(namespace) if namespace
|
147
|
+
end
|
143
148
|
raise error
|
144
149
|
end
|
145
150
|
alias :listen_for_exception :listen_for_error
|
@@ -164,7 +169,7 @@ module Appsignal
|
|
164
169
|
# Appsignal.send_error(e)
|
165
170
|
# end
|
166
171
|
#
|
167
|
-
# @example Send an exception with tags
|
172
|
+
# @example Send an exception with tags. Deprecated method.
|
168
173
|
# begin
|
169
174
|
# raise "oh no!"
|
170
175
|
# rescue => e
|
@@ -172,17 +177,20 @@ module Appsignal
|
|
172
177
|
# end
|
173
178
|
#
|
174
179
|
# @example Add more metadata to transaction
|
175
|
-
# Appsignal.send_error(e
|
180
|
+
# Appsignal.send_error(e) do |transaction|
|
176
181
|
# transaction.params(:search_query => params[:search_query])
|
177
182
|
# transaction.set_action("my_action_name")
|
183
|
+
# transaction.set_tags(:key => "value")
|
178
184
|
# transaction.set_namespace("my_namespace")
|
179
185
|
# end
|
180
186
|
#
|
181
187
|
# @param error [Exception] The error to send to AppSignal.
|
182
188
|
# @param tags [Hash{String, Symbol => String, Symbol, Integer}]
|
183
189
|
# Additional tags to add to the error. See also {.tag_request}.
|
190
|
+
# This parameter is deprecated. Use the block argument instead.
|
184
191
|
# @param namespace [String] The namespace in which the error occurred.
|
185
192
|
# See also {.set_namespace}.
|
193
|
+
# This parameter is deprecated. Use the block argument instead.
|
186
194
|
# @yield [transaction] yields block to allow modification of the
|
187
195
|
# transaction before it's send.
|
188
196
|
# @yieldparam transaction [Transaction] yields the AppSignal transaction
|
@@ -197,9 +205,30 @@ module Appsignal
|
|
197
205
|
def send_error(
|
198
206
|
error,
|
199
207
|
tags = nil,
|
200
|
-
namespace =
|
208
|
+
namespace = nil
|
201
209
|
)
|
210
|
+
if tags
|
211
|
+
call_location = caller(1..1).first
|
212
|
+
deprecation_message \
|
213
|
+
"The tags argument for `Appsignal.send_error` is deprecated. " \
|
214
|
+
"Please use the block method to set tags instead.\n\n" \
|
215
|
+
" Appsignal.send_error(error) do |transaction|\n" \
|
216
|
+
" transaction.set_tags(#{tags})\n" \
|
217
|
+
" end\n\n" \
|
218
|
+
"Appsignal.send_error called on location: #{call_location}"
|
219
|
+
end
|
220
|
+
if namespace
|
221
|
+
call_location = caller(1..1).first
|
222
|
+
deprecation_message \
|
223
|
+
"The namespace argument for `Appsignal.send_error` is deprecated. " \
|
224
|
+
"Please use the block method to set the namespace instead.\n\n" \
|
225
|
+
" Appsignal.send_error(error) do |transaction|\n" \
|
226
|
+
" transaction.set_namespace(#{namespace.inspect})\n" \
|
227
|
+
" end\n\n" \
|
228
|
+
"Appsignal.send_error called on location: #{call_location}"
|
229
|
+
end
|
202
230
|
return unless active?
|
231
|
+
|
203
232
|
unless error.is_a?(Exception)
|
204
233
|
logger.error "Appsignal.send_error: Cannot send error. The given " \
|
205
234
|
"value is not an exception: #{error.inspect}"
|
@@ -207,7 +236,7 @@ module Appsignal
|
|
207
236
|
end
|
208
237
|
transaction = Appsignal::Transaction.new(
|
209
238
|
SecureRandom.uuid,
|
210
|
-
namespace,
|
239
|
+
namespace || Appsignal::Transaction::HTTP_REQUEST,
|
211
240
|
Appsignal::Transaction::GenericRequest.new({})
|
212
241
|
)
|
213
242
|
transaction.set_tags(tags) if tags
|
@@ -244,12 +273,26 @@ module Appsignal
|
|
244
273
|
# end
|
245
274
|
# end
|
246
275
|
#
|
276
|
+
# @example Add more metadata to transaction
|
277
|
+
# Appsignal.set_error(e) do |transaction|
|
278
|
+
# transaction.params(:search_query => params[:search_query])
|
279
|
+
# transaction.set_action("my_action_name")
|
280
|
+
# transaction.set_tags(:key => "value")
|
281
|
+
# transaction.set_namespace("my_namespace")
|
282
|
+
# end
|
283
|
+
#
|
247
284
|
# @param exception [Exception] The error to add to the current
|
248
285
|
# transaction.
|
249
286
|
# @param tags [Hash{String, Symbol => String, Symbol, Integer}]
|
250
287
|
# Additional tags to add to the error. See also {.tag_request}.
|
288
|
+
# This parameter is deprecated. Use the block argument instead.
|
251
289
|
# @param namespace [String] The namespace in which the error occurred.
|
252
290
|
# See also {.set_namespace}.
|
291
|
+
# This parameter is deprecated. Use the block argument instead.
|
292
|
+
# @yield [transaction] yields block to allow modification of the
|
293
|
+
# transaction.
|
294
|
+
# @yieldparam transaction [Transaction] yields the AppSignal transaction
|
295
|
+
# used to store the error.
|
253
296
|
# @return [void]
|
254
297
|
#
|
255
298
|
# @see Transaction#set_error
|
@@ -257,6 +300,26 @@ module Appsignal
|
|
257
300
|
# Exception handling guide
|
258
301
|
# @since 0.6.6
|
259
302
|
def set_error(exception, tags = nil, namespace = nil)
|
303
|
+
if tags
|
304
|
+
call_location = caller(1..1).first
|
305
|
+
deprecation_message \
|
306
|
+
"The tags argument for `Appsignal.set_error` is deprecated. " \
|
307
|
+
"Please use the block method to set tags instead.\n\n" \
|
308
|
+
" Appsignal.set_error(error) do |transaction|\n" \
|
309
|
+
" transaction.set_tags(#{tags})\n" \
|
310
|
+
" end\n\n" \
|
311
|
+
"Appsignal.set_error called on location: #{call_location}"
|
312
|
+
end
|
313
|
+
if namespace
|
314
|
+
call_location = caller(1..1).first
|
315
|
+
deprecation_message \
|
316
|
+
"The namespace argument for `Appsignal.set_error` is deprecated. " \
|
317
|
+
"Please use the block method to set the namespace instead.\n\n" \
|
318
|
+
" Appsignal.set_error(error) do |transaction|\n" \
|
319
|
+
" transaction.set_namespace(#{namespace.inspect})\n" \
|
320
|
+
" end\n\n" \
|
321
|
+
"Appsignal.set_error called on location: #{call_location}"
|
322
|
+
end
|
260
323
|
unless exception.is_a?(Exception)
|
261
324
|
logger.error "Appsignal.set_error: Cannot set error. The given " \
|
262
325
|
"value is not an exception: #{exception.inspect}"
|
@@ -267,6 +330,7 @@ module Appsignal
|
|
267
330
|
transaction.set_error(exception)
|
268
331
|
transaction.set_tags(tags) if tags
|
269
332
|
transaction.set_namespace(namespace) if namespace
|
333
|
+
yield transaction if block_given?
|
270
334
|
end
|
271
335
|
alias :set_exception :set_error
|
272
336
|
alias :add_exception :set_error
|