appsignal 2.11.5 → 3.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.semaphore/semaphore.yml +0 -23
- data/CHANGELOG.md +6 -0
- data/build_matrix.yml +0 -4
- data/lib/appsignal.rb +1 -27
- data/lib/appsignal/auth_check.rb +2 -8
- data/lib/appsignal/cli.rb +1 -23
- data/lib/appsignal/config.rb +0 -24
- data/lib/appsignal/event_formatter.rb +0 -25
- data/lib/appsignal/hooks.rb +0 -23
- data/lib/appsignal/hooks/action_cable.rb +3 -34
- data/lib/appsignal/hooks/active_support_notifications.rb +7 -86
- data/lib/appsignal/hooks/celluloid.rb +5 -9
- data/lib/appsignal/hooks/net_http.rb +2 -12
- data/lib/appsignal/hooks/puma.rb +3 -5
- data/lib/appsignal/hooks/que.rb +1 -1
- data/lib/appsignal/hooks/rake.rb +2 -24
- data/lib/appsignal/hooks/redis.rb +2 -13
- data/lib/appsignal/hooks/resque.rb +2 -43
- data/lib/appsignal/hooks/unicorn.rb +3 -24
- data/lib/appsignal/hooks/webmachine.rb +1 -7
- data/lib/appsignal/integrations/action_cable.rb +34 -0
- data/lib/appsignal/integrations/active_support_notifications.rb +77 -0
- data/lib/appsignal/integrations/net_http.rb +16 -0
- data/lib/appsignal/integrations/object.rb +61 -4
- data/lib/appsignal/integrations/padrino.rb +5 -7
- data/lib/appsignal/integrations/que.rb +26 -33
- data/lib/appsignal/integrations/railtie.rb +1 -4
- data/lib/appsignal/integrations/rake.rb +26 -2
- data/lib/appsignal/integrations/redis.rb +17 -0
- data/lib/appsignal/integrations/resque.rb +39 -10
- data/lib/appsignal/integrations/unicorn.rb +28 -0
- data/lib/appsignal/integrations/webmachine.rb +22 -24
- data/lib/appsignal/minutely.rb +0 -12
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +1 -24
- data/spec/lib/appsignal/cli_spec.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +0 -66
- data/spec/lib/appsignal/event_formatter_spec.rb +0 -37
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +6 -1
- data/spec/lib/appsignal/hooks/rake_spec.rb +1 -2
- data/spec/lib/appsignal/hooks/redis_spec.rb +50 -15
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +14 -3
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -13
- data/spec/lib/appsignal/hooks_spec.rb +0 -57
- data/spec/lib/appsignal/integrations/object_spec.rb +0 -4
- data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -3
- data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -45
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +26 -8
- data/spec/lib/appsignal/minutely_spec.rb +0 -19
- data/spec/lib/appsignal/transaction_spec.rb +1 -14
- data/spec/lib/appsignal/transmitter_spec.rb +1 -1
- data/spec/lib/appsignal_spec.rb +0 -69
- data/spec/spec_helper.rb +1 -15
- metadata +9 -22
- data/lib/appsignal/cli/notify_of_deploy.rb +0 -131
- data/lib/appsignal/integrations/object_ruby_19.rb +0 -37
- data/lib/appsignal/integrations/object_ruby_modern.rb +0 -64
- data/lib/appsignal/integrations/resque_active_job.rb +0 -19
- data/lib/appsignal/js_exception_transaction.rb +0 -56
- data/lib/appsignal/rack/js_exception_catcher.rb +0 -80
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +0 -180
- data/spec/lib/appsignal/integrations/object_19_spec.rb +0 -266
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +0 -28
- data/spec/lib/appsignal/integrations/resque_spec.rb +0 -28
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -128
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -170
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936166fae7d72db514778fce44512e528f36cbfa0a94f7c3fe8ea383754c47c2
|
4
|
+
data.tar.gz: cbfeb15ecec3d152c34a1759273de14cabe086a11782d441bd5aae6114fc0ac2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b125b9378be2ac1445e94f924dc5fbb70e4f5eb5b886673c6748482988eaa2cb29bef61fe87fd05d7e75954139dd57abf2a5c5605e479e5a6c68893b3739ea8
|
7
|
+
data.tar.gz: 28d5212905fefffdddc077619a8f57d1f92b23bbb4237cb8c28847ce5215e9f2b12790d20c25115d9735f19d1fb4d592699601c476f13398882a9c65a3c187e1
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
3
|
AllCops:
|
4
|
-
TargetRubyVersion:
|
4
|
+
TargetRubyVersion: 2.0
|
5
5
|
Include:
|
6
6
|
- "**/*.cap"
|
7
7
|
- "Gemfile"
|
@@ -80,5 +80,8 @@ Metrics/BlockLength:
|
|
80
80
|
Style/FrozenStringLiteralComment:
|
81
81
|
Enabled: true
|
82
82
|
|
83
|
+
Style/SymbolArray:
|
84
|
+
EnforcedStyle: brackets
|
85
|
+
|
83
86
|
# Metrics/LineLength:
|
84
87
|
# Max: 80
|
data/.semaphore/semaphore.yml
CHANGED
@@ -79,29 +79,6 @@ blocks:
|
|
79
79
|
value: gemfiles/no_dependencies.gemfile
|
80
80
|
commands:
|
81
81
|
- "./support/bundler_wrapper exec rubocop"
|
82
|
-
- name: Ruby 1.9.3-p551
|
83
|
-
dependencies:
|
84
|
-
- Validation
|
85
|
-
task:
|
86
|
-
prologue:
|
87
|
-
commands:
|
88
|
-
- "./support/bundler_wrapper exec rake extension:install"
|
89
|
-
jobs:
|
90
|
-
- name: Ruby 1.9.3-p551 for no_dependencies
|
91
|
-
env_vars:
|
92
|
-
- name: RUBY_VERSION
|
93
|
-
value: 1.9.3-p551
|
94
|
-
- name: GEMSET
|
95
|
-
value: no_dependencies
|
96
|
-
- name: BUNDLE_GEMFILE
|
97
|
-
value: gemfiles/no_dependencies.gemfile
|
98
|
-
- name: _RUBYGEMS_VERSION
|
99
|
-
value: 2.7.8
|
100
|
-
- name: _BUNDLER_VERSION
|
101
|
-
value: 1.17.3
|
102
|
-
commands:
|
103
|
-
- "./support/bundler_wrapper exec rake test"
|
104
|
-
- "./support/bundler_wrapper exec rake test:failure"
|
105
82
|
- name: Ruby 2.0.0-p648
|
106
83
|
dependencies:
|
107
84
|
- Validation
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 3.0.0
|
4
|
+
- Drop Ruby 1.9 support. PR #683, #682, #688, #694
|
5
|
+
- Use Module.prepend for all gem integrations. Fixes #603 in combination with
|
6
|
+
other gems that provide instrumentation for gems. PR #683
|
7
|
+
- Remove deprecated integrations, classes, methods and arguments. PR #685
|
8
|
+
|
3
9
|
# 2.11.5
|
4
10
|
- Add more detailed logging to finish_event calls when the event is unknown, so
|
5
11
|
we know what event is being tried to finish. Commit
|
data/build_matrix.yml
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -129,7 +129,6 @@ module Appsignal
|
|
129
129
|
config.write_to_environment
|
130
130
|
Appsignal::Extension.start
|
131
131
|
Appsignal::Hooks.load_hooks
|
132
|
-
Appsignal::EventFormatter.initialize_deprecated_formatters
|
133
132
|
initialize_extensions
|
134
133
|
|
135
134
|
if config[:enable_allocation_tracking] && !Appsignal::System.jruby?
|
@@ -222,15 +221,9 @@ module Appsignal
|
|
222
221
|
# Sets the log level and sets the logger. Uses a file-based logger or the
|
223
222
|
# STDOUT-based logger. See the `:log` configuration option.
|
224
223
|
#
|
225
|
-
# @param path_arg [nil] Deprecated param. Use the `:log_path`
|
226
|
-
# configuration option instead.
|
227
224
|
# @return [void]
|
228
225
|
# @since 0.7.0
|
229
|
-
def start_logger
|
230
|
-
if path_arg
|
231
|
-
logger.info("Setting the path in start_logger has no effect anymore, set it in the config instead")
|
232
|
-
end
|
233
|
-
|
226
|
+
def start_logger
|
234
227
|
if config && config[:log] == "file" && config.log_file_path
|
235
228
|
start_file_logger(config.log_file_path)
|
236
229
|
else
|
@@ -285,21 +278,6 @@ module Appsignal
|
|
285
278
|
config && config.active? && extension_loaded?
|
286
279
|
end
|
287
280
|
|
288
|
-
# @deprecated No replacement
|
289
|
-
def is_ignored_error?(error) # rubocop:disable Naming/PredicateName
|
290
|
-
deprecation_message "Appsignal.is_ignored_error? is deprecated " \
|
291
|
-
"with no replacement and will be removed in version 3.0."
|
292
|
-
Appsignal.config[:ignore_errors].include?(error.class.name)
|
293
|
-
end
|
294
|
-
alias :is_ignored_exception? :is_ignored_error?
|
295
|
-
|
296
|
-
# @deprecated No replacement
|
297
|
-
def is_ignored_action?(action) # rubocop:disable Naming/PredicateName
|
298
|
-
deprecation_message "Appsignal.is_ignored_action? is deprecated " \
|
299
|
-
"with no replacement and will be removed in version 3.0."
|
300
|
-
Appsignal.config[:ignore_actions].include?(action)
|
301
|
-
end
|
302
|
-
|
303
281
|
private
|
304
282
|
|
305
283
|
def start_stdout_logger
|
@@ -344,11 +322,7 @@ require "appsignal/marker"
|
|
344
322
|
require "appsignal/minutely"
|
345
323
|
require "appsignal/garbage_collection_profiler"
|
346
324
|
require "appsignal/integrations/railtie" if defined?(::Rails)
|
347
|
-
require "appsignal/integrations/resque"
|
348
|
-
require "appsignal/integrations/resque_active_job"
|
349
325
|
require "appsignal/transaction"
|
350
326
|
require "appsignal/version"
|
351
327
|
require "appsignal/rack/generic_instrumentation"
|
352
|
-
require "appsignal/rack/js_exception_catcher"
|
353
|
-
require "appsignal/js_exception_transaction"
|
354
328
|
require "appsignal/transmitter"
|
data/lib/appsignal/auth_check.rb
CHANGED
@@ -20,16 +20,10 @@ module Appsignal
|
|
20
20
|
# https://push.appsignal.com/1/auth
|
21
21
|
ACTION = "auth".freeze
|
22
22
|
|
23
|
-
attr_reader :config
|
23
|
+
attr_reader :config
|
24
24
|
|
25
|
-
def initialize(config
|
25
|
+
def initialize(config)
|
26
26
|
@config = config
|
27
|
-
if logger # rubocop:disable Style/GuardClause
|
28
|
-
Appsignal::Utils::DeprecationMessage.message \
|
29
|
-
"`Appsignal::AuthCheck.new`'s `logger` argument will be removed " \
|
30
|
-
"in the next major version. Please configure the logger " \
|
31
|
-
"using `Appsignal.logger`."
|
32
|
-
end
|
33
27
|
end
|
34
28
|
|
35
29
|
# Perform push api validation request and return response status code.
|
data/lib/appsignal/cli.rb
CHANGED
@@ -7,12 +7,11 @@ require "appsignal/cli/helpers"
|
|
7
7
|
require "appsignal/cli/demo"
|
8
8
|
require "appsignal/cli/diagnose"
|
9
9
|
require "appsignal/cli/install"
|
10
|
-
require "appsignal/cli/notify_of_deploy"
|
11
10
|
|
12
11
|
module Appsignal
|
13
12
|
# @api private
|
14
13
|
class CLI
|
15
|
-
AVAILABLE_COMMANDS = %w[demo diagnose install
|
14
|
+
AVAILABLE_COMMANDS = %w[demo diagnose install].freeze
|
16
15
|
|
17
16
|
class << self
|
18
17
|
attr_accessor :options
|
@@ -33,8 +32,6 @@ module Appsignal
|
|
33
32
|
Appsignal::CLI::Diagnose.run(options)
|
34
33
|
when :install
|
35
34
|
Appsignal::CLI::Install.run(argv.shift, options)
|
36
|
-
when :notify_of_deploy
|
37
|
-
Appsignal::CLI::NotifyOfDeploy.run(options)
|
38
35
|
end
|
39
36
|
else
|
40
37
|
puts "Command '#{command}' does not exist, run appsignal -h to "\
|
@@ -93,25 +90,6 @@ module Appsignal
|
|
93
90
|
o.on "--[no-]color", "Colorize the output of the diagnose command" do |arg|
|
94
91
|
options[:color] = arg
|
95
92
|
end
|
96
|
-
end,
|
97
|
-
"notify_of_deploy" => OptionParser.new do |o|
|
98
|
-
o.banner = "Usage: appsignal notify_of_deploy [options]"
|
99
|
-
|
100
|
-
o.on "--revision=<revision>", "The revision you're deploying" do |arg|
|
101
|
-
options[:revision] = arg
|
102
|
-
end
|
103
|
-
|
104
|
-
o.on "--user=<user>", "The name of the user that's deploying" do |arg|
|
105
|
-
options[:user] = arg
|
106
|
-
end
|
107
|
-
|
108
|
-
o.on "--environment=<app_env>", "The environment you're deploying to" do |arg|
|
109
|
-
options[:environment] = arg
|
110
|
-
end
|
111
|
-
|
112
|
-
o.on "--name=<name>", "The name of the app (optional)" do |arg|
|
113
|
-
options[:name] = arg
|
114
|
-
end
|
115
93
|
end
|
116
94
|
}
|
117
95
|
end
|
data/lib/appsignal/config.rb
CHANGED
@@ -32,8 +32,6 @@ module Appsignal
|
|
32
32
|
:instrument_redis => true,
|
33
33
|
:instrument_sequel => true,
|
34
34
|
:skip_session_data => false,
|
35
|
-
:enable_frontend_error_catching => false,
|
36
|
-
:frontend_error_catching_path => "/appsignal_error_catcher",
|
37
35
|
:enable_allocation_tracking => true,
|
38
36
|
:enable_gc_instrumentation => false,
|
39
37
|
:enable_host_metrics => true,
|
@@ -49,7 +47,6 @@ module Appsignal
|
|
49
47
|
"APPSIGNAL_PUSH_API_KEY" => :push_api_key,
|
50
48
|
"APPSIGNAL_APP_NAME" => :name,
|
51
49
|
"APPSIGNAL_PUSH_API_ENDPOINT" => :endpoint,
|
52
|
-
"APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH" => :frontend_error_catching_path,
|
53
50
|
"APPSIGNAL_DEBUG" => :debug,
|
54
51
|
"APPSIGNAL_LOG" => :log,
|
55
52
|
"APPSIGNAL_LOG_PATH" => :log_path,
|
@@ -57,7 +54,6 @@ module Appsignal
|
|
57
54
|
"APPSIGNAL_INSTRUMENT_REDIS" => :instrument_redis,
|
58
55
|
"APPSIGNAL_INSTRUMENT_SEQUEL" => :instrument_sequel,
|
59
56
|
"APPSIGNAL_SKIP_SESSION_DATA" => :skip_session_data,
|
60
|
-
"APPSIGNAL_ENABLE_FRONTEND_ERROR_CATCHING" => :enable_frontend_error_catching,
|
61
57
|
"APPSIGNAL_IGNORE_ACTIONS" => :ignore_actions,
|
62
58
|
"APPSIGNAL_IGNORE_ERRORS" => :ignore_errors,
|
63
59
|
"APPSIGNAL_IGNORE_NAMESPACES" => :ignore_namespaces,
|
@@ -86,7 +82,6 @@ module Appsignal
|
|
86
82
|
APPSIGNAL_APP_NAME
|
87
83
|
APPSIGNAL_CA_FILE_PATH
|
88
84
|
APPSIGNAL_DNS_SERVERS
|
89
|
-
APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH
|
90
85
|
APPSIGNAL_HOSTNAME
|
91
86
|
APPSIGNAL_HTTP_PROXY
|
92
87
|
APPSIGNAL_LOG
|
@@ -102,7 +97,6 @@ module Appsignal
|
|
102
97
|
APPSIGNAL_ACTIVE
|
103
98
|
APPSIGNAL_DEBUG
|
104
99
|
APPSIGNAL_ENABLE_ALLOCATION_TRACKING
|
105
|
-
APPSIGNAL_ENABLE_FRONTEND_ERROR_CATCHING
|
106
100
|
APPSIGNAL_ENABLE_GC_INSTRUMENTATION
|
107
101
|
APPSIGNAL_ENABLE_HOST_METRICS
|
108
102
|
APPSIGNAL_ENABLE_MINUTELY_PROBES
|
@@ -126,12 +120,6 @@ module Appsignal
|
|
126
120
|
APPSIGNAL_REQUEST_HEADERS
|
127
121
|
].freeze
|
128
122
|
|
129
|
-
# Mapping of old and deprecated AppSignal configuration keys
|
130
|
-
DEPRECATED_CONFIG_KEY_MAPPING = {
|
131
|
-
:api_key => :push_api_key,
|
132
|
-
:ignore_exceptions => :ignore_errors
|
133
|
-
}.freeze
|
134
|
-
|
135
123
|
# @attribute [r] system_config
|
136
124
|
# Config detected on the system level.
|
137
125
|
# Used in diagnose report.
|
@@ -376,18 +364,6 @@ module Appsignal
|
|
376
364
|
# Used by {#load_from_disk}. No compatibility for env variables or initial config currently.
|
377
365
|
def maintain_backwards_compatibility(configuration)
|
378
366
|
configuration.tap do |config|
|
379
|
-
DEPRECATED_CONFIG_KEY_MAPPING.each do |old_key, new_key|
|
380
|
-
old_config_value = config.delete(old_key)
|
381
|
-
next unless old_config_value
|
382
|
-
deprecation_message \
|
383
|
-
"Old configuration key found. Please update the "\
|
384
|
-
"'#{old_key}' to '#{new_key}'.",
|
385
|
-
logger
|
386
|
-
|
387
|
-
next if config[new_key] # Skip if new key is already in use
|
388
|
-
config[new_key] = old_config_value
|
389
|
-
end
|
390
|
-
|
391
367
|
if config.include?(:working_dir_path)
|
392
368
|
deprecation_message \
|
393
369
|
"'working_dir_path' is deprecated, please use " \
|
@@ -20,20 +20,11 @@ module Appsignal
|
|
20
20
|
@formatters ||= {}
|
21
21
|
end
|
22
22
|
|
23
|
-
def deprecated_formatter_classes
|
24
|
-
@deprecated_formatter_classes ||= {}
|
25
|
-
end
|
26
|
-
|
27
23
|
def formatter_classes
|
28
24
|
@formatter_classes ||= {}
|
29
25
|
end
|
30
26
|
|
31
27
|
def register(name, formatter = nil)
|
32
|
-
unless formatter
|
33
|
-
register_deprecated_formatter(name)
|
34
|
-
return
|
35
|
-
end
|
36
|
-
|
37
28
|
if registered?(name, formatter)
|
38
29
|
logger.warn(
|
39
30
|
"Formatter for '#{name}' already registered, not registering "\
|
@@ -45,12 +36,6 @@ module Appsignal
|
|
45
36
|
initialize_formatter name, formatter
|
46
37
|
end
|
47
38
|
|
48
|
-
def initialize_deprecated_formatters
|
49
|
-
deprecated_formatter_classes.each do |name, formatter|
|
50
|
-
register(name, formatter)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
39
|
def unregister(name, formatter = self)
|
55
40
|
return unless formatter_classes[name] == formatter
|
56
41
|
|
@@ -86,16 +71,6 @@ module Appsignal
|
|
86
71
|
logger.error("'#{ex.message}' when initializing #{name} event formatter")
|
87
72
|
end
|
88
73
|
|
89
|
-
def register_deprecated_formatter(name)
|
90
|
-
deprecation_message \
|
91
|
-
"Formatter for '#{name}' is using a deprecated registration " \
|
92
|
-
"method. This event formatter will not be loaded. " \
|
93
|
-
"Please update the formatter according to the documentation at: " \
|
94
|
-
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
|
95
|
-
|
96
|
-
EventFormatter.deprecated_formatter_classes[name] = self
|
97
|
-
end
|
98
|
-
|
99
74
|
def logger
|
100
75
|
Appsignal.logger
|
101
76
|
end
|
data/lib/appsignal/hooks.rb
CHANGED
@@ -69,29 +69,6 @@ module Appsignal
|
|
69
69
|
text.size > 200 ? "#{text[0...197]}..." : text
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
73
|
-
# Alias Probes constants that have moved to their own module in version
|
74
|
-
# 2.11.0.
|
75
|
-
def self.const_missing(name)
|
76
|
-
case name
|
77
|
-
when :SidekiqProbe
|
78
|
-
callers = caller
|
79
|
-
Appsignal::Utils::DeprecationMessage.message \
|
80
|
-
"The constant Appsignal::Hooks::SidekiqProbe has been deprecated. " \
|
81
|
-
"Please update the constant name to Appsignal::Probes::SidekiqProbe " \
|
82
|
-
"in the following file to remove this message.\n#{callers.first}"
|
83
|
-
Appsignal::Probes::SidekiqProbe
|
84
|
-
when :PumaProbe
|
85
|
-
callers = caller
|
86
|
-
Appsignal::Utils::DeprecationMessage.message \
|
87
|
-
"The constant Appsignal::Hooks::PumaProbe has been deprecated. " \
|
88
|
-
"Please update the constant name to Appsignal::Probes::PumaProbe " \
|
89
|
-
"in the following file to remove this message.\n#{callers.first}"
|
90
|
-
Appsignal::Probes::PumaProbe
|
91
|
-
else
|
92
|
-
super
|
93
|
-
end
|
94
|
-
end
|
95
72
|
end
|
96
73
|
end
|
97
74
|
|
@@ -14,45 +14,14 @@ module Appsignal
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def install
|
17
|
-
|
17
|
+
require "appsignal/integrations/action_cable"
|
18
|
+
ActionCable::Channel::Base.send(:prepend, Appsignal::Integrations::ActionCableIntegration)
|
19
|
+
|
18
20
|
install_callbacks
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
|
-
def patch_perform_action
|
24
|
-
ActionCable::Channel::Base.class_eval do
|
25
|
-
alias_method :original_perform_action, :perform_action
|
26
|
-
|
27
|
-
def perform_action(*args, &block)
|
28
|
-
# The request is only the original websocket request
|
29
|
-
env = connection.env
|
30
|
-
request = ActionDispatch::Request.new(env)
|
31
|
-
env[Appsignal::Hooks::ActionCableHook::REQUEST_ID] ||=
|
32
|
-
request.request_id || SecureRandom.uuid
|
33
|
-
|
34
|
-
transaction = Appsignal::Transaction.create(
|
35
|
-
env[Appsignal::Hooks::ActionCableHook::REQUEST_ID],
|
36
|
-
Appsignal::Transaction::ACTION_CABLE,
|
37
|
-
request
|
38
|
-
)
|
39
|
-
|
40
|
-
begin
|
41
|
-
original_perform_action(*args, &block)
|
42
|
-
rescue Exception => exception # rubocop:disable Lint/RescueException
|
43
|
-
transaction.set_error(exception)
|
44
|
-
raise exception
|
45
|
-
ensure
|
46
|
-
transaction.params = args.first
|
47
|
-
transaction.set_action_if_nil("#{self.class}##{args.first["action"]}")
|
48
|
-
transaction.set_metadata("path", request.path)
|
49
|
-
transaction.set_metadata("method", "websocket")
|
50
|
-
Appsignal::Transaction.complete_current!
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
25
|
def install_callbacks
|
57
26
|
ActionCable::Channel::Base.set_callback :subscribe, :around, :prepend => true do |channel, inner|
|
58
27
|
# The request is only the original websocket request
|
@@ -6,8 +6,6 @@ module Appsignal
|
|
6
6
|
class ActiveSupportNotificationsHook < Appsignal::Hooks::Hook
|
7
7
|
register :active_support_notifications
|
8
8
|
|
9
|
-
BANG = "!".freeze
|
10
|
-
|
11
9
|
def dependencies_present?
|
12
10
|
defined?(::ActiveSupport::Notifications::Instrumenter)
|
13
11
|
end
|
@@ -23,100 +21,23 @@ module Appsignal
|
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
24
|
+
require "appsignal/integrations/active_support_notifications"
|
26
25
|
instrumenter = ::ActiveSupport::Notifications::Instrumenter
|
27
|
-
|
26
|
+
parent_integration_module = Appsignal::Integrations::ActiveSupportNotificationsIntegration
|
28
27
|
if instrumenter.method_defined?(:start) && instrumenter.method_defined?(:finish)
|
29
|
-
|
28
|
+
install_module(parent_integration_module::StartFinishIntegration)
|
30
29
|
else
|
31
|
-
|
30
|
+
install_module(parent_integration_module::InstrumentIntegration)
|
32
31
|
end
|
33
32
|
|
34
33
|
# rubocop:disable Style/GuardClause
|
35
34
|
if instrumenter.method_defined?(:finish_with_state)
|
36
|
-
|
35
|
+
install_module(parent_integration_module::FinishStateIntegration)
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
def
|
41
|
-
::ActiveSupport::Notifications::Instrumenter.
|
42
|
-
alias instrument_without_appsignal instrument
|
43
|
-
|
44
|
-
def instrument(name, payload = {}, &block)
|
45
|
-
# Events that start with a bang are internal to Rails
|
46
|
-
instrument_this = name[0] != BANG
|
47
|
-
|
48
|
-
Appsignal::Transaction.current.start_event if instrument_this
|
49
|
-
|
50
|
-
instrument_without_appsignal(name, payload, &block)
|
51
|
-
ensure
|
52
|
-
if instrument_this
|
53
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
54
|
-
Appsignal::Transaction.current.finish_event(
|
55
|
-
name.to_s,
|
56
|
-
title,
|
57
|
-
body,
|
58
|
-
body_format
|
59
|
-
)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def install_start_finish
|
66
|
-
::ActiveSupport::Notifications::Instrumenter.class_eval do
|
67
|
-
alias start_without_appsignal start
|
68
|
-
|
69
|
-
def start(name, payload = {})
|
70
|
-
# Events that start with a bang are internal to Rails
|
71
|
-
instrument_this = name[0] != BANG
|
72
|
-
|
73
|
-
Appsignal::Transaction.current.start_event if instrument_this
|
74
|
-
|
75
|
-
start_without_appsignal(name, payload)
|
76
|
-
end
|
77
|
-
|
78
|
-
alias finish_without_appsignal finish
|
79
|
-
|
80
|
-
def finish(name, payload = {})
|
81
|
-
# Events that start with a bang are internal to Rails
|
82
|
-
instrument_this = name[0] != BANG
|
83
|
-
|
84
|
-
if instrument_this
|
85
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
86
|
-
Appsignal::Transaction.current.finish_event(
|
87
|
-
name.to_s,
|
88
|
-
title,
|
89
|
-
body,
|
90
|
-
body_format
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
finish_without_appsignal(name, payload)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def install_finish_with_state
|
100
|
-
::ActiveSupport::Notifications::Instrumenter.class_eval do
|
101
|
-
alias finish_with_state_without_appsignal finish_with_state
|
102
|
-
|
103
|
-
def finish_with_state(listeners_state, name, payload = {})
|
104
|
-
# Events that start with a bang are internal to Rails
|
105
|
-
instrument_this = name[0] != BANG
|
106
|
-
|
107
|
-
if instrument_this
|
108
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
109
|
-
Appsignal::Transaction.current.finish_event(
|
110
|
-
name.to_s,
|
111
|
-
title,
|
112
|
-
body,
|
113
|
-
body_format
|
114
|
-
)
|
115
|
-
end
|
116
|
-
|
117
|
-
finish_with_state_without_appsignal(listeners_state, name, payload)
|
118
|
-
end
|
119
|
-
end
|
39
|
+
def install_module(mod)
|
40
|
+
::ActiveSupport::Notifications::Instrumenter.send(:prepend, mod)
|
120
41
|
end
|
121
42
|
end
|
122
43
|
end
|