appsignal 2.11.5-java → 3.0.0.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/.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
@@ -16,16 +16,12 @@ module Appsignal
|
|
16
16
|
# down Celluloid so we're sure our thread does not aggravate this situation.
|
17
17
|
# This way we also make sure any outstanding transactions get flushed.
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
def shutdown
|
24
|
-
Appsignal.stop("celluloid")
|
25
|
-
shutdown_without_appsignal
|
26
|
-
end
|
19
|
+
Celluloid.singleton_class.send(:prepend, Module.new do
|
20
|
+
def shutdown
|
21
|
+
Appsignal.stop("celluloid")
|
22
|
+
super
|
27
23
|
end
|
28
|
-
end
|
24
|
+
end)
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
@@ -13,18 +13,8 @@ module Appsignal
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def install
|
16
|
-
|
17
|
-
|
18
|
-
|
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)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
16
|
+
require "appsignal/integrations/net_http"
|
17
|
+
Net::HTTP.send(:prepend, Appsignal::Integrations::NetHttpIntegration)
|
28
18
|
|
29
19
|
Appsignal::Environment.report_enabled("net_http")
|
30
20
|
end
|
data/lib/appsignal/hooks/puma.rb
CHANGED
@@ -29,14 +29,12 @@ module Appsignal
|
|
29
29
|
|
30
30
|
return unless defined?(::Puma::Cluster)
|
31
31
|
# For clustered mode with multiple workers
|
32
|
-
::Puma::Cluster.
|
33
|
-
alias stop_workers_without_appsignal stop_workers
|
34
|
-
|
32
|
+
::Puma::Cluster.send(:prepend, Module.new do
|
35
33
|
def stop_workers
|
36
34
|
Appsignal.stop("puma cluster")
|
37
|
-
|
35
|
+
super
|
38
36
|
end
|
39
|
-
end
|
37
|
+
end)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
data/lib/appsignal/hooks/que.rb
CHANGED
@@ -12,7 +12,7 @@ module Appsignal
|
|
12
12
|
|
13
13
|
def install
|
14
14
|
require "appsignal/integrations/que"
|
15
|
-
::Que::Job.send(:
|
15
|
+
::Que::Job.send(:prepend, Appsignal::Integrations::QuePlugin)
|
16
16
|
|
17
17
|
::Que.error_notifier = proc do |error, _job|
|
18
18
|
Appsignal::Transaction.current.set_error(error)
|
data/lib/appsignal/hooks/rake.rb
CHANGED
@@ -11,30 +11,8 @@ module Appsignal
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def install
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def execute(*args)
|
18
|
-
execute_without_appsignal(*args)
|
19
|
-
rescue Exception => error # rubocop:disable Lint/RescueException
|
20
|
-
# Format given arguments and cast to hash if possible
|
21
|
-
params, _ = args
|
22
|
-
params = params.to_hash if params.respond_to?(:to_hash)
|
23
|
-
|
24
|
-
transaction = Appsignal::Transaction.create(
|
25
|
-
SecureRandom.uuid,
|
26
|
-
Appsignal::Transaction::BACKGROUND_JOB,
|
27
|
-
Appsignal::Transaction::GenericRequest.new(
|
28
|
-
:params => params
|
29
|
-
)
|
30
|
-
)
|
31
|
-
transaction.set_action(name)
|
32
|
-
transaction.set_error(error)
|
33
|
-
transaction.complete
|
34
|
-
Appsignal.stop("rake")
|
35
|
-
raise error
|
36
|
-
end
|
37
|
-
end
|
14
|
+
require "appsignal/integrations/rake"
|
15
|
+
::Rake::Task.send(:prepend, Appsignal::Integrations::RakeIntegration)
|
38
16
|
end
|
39
17
|
end
|
40
18
|
end
|
@@ -13,19 +13,8 @@ module Appsignal
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def install
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def process(commands, &block)
|
20
|
-
sanitized_commands = commands.map do |command, *args|
|
21
|
-
"#{command}#{" ?" * args.size}"
|
22
|
-
end.join("\n")
|
23
|
-
|
24
|
-
Appsignal.instrument "query.redis", id, sanitized_commands do
|
25
|
-
process_without_appsignal(commands, &block)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
16
|
+
require "appsignal/integrations/redis"
|
17
|
+
::Redis::Client.send(:prepend, Appsignal::Integrations::RedisIntegration)
|
29
18
|
|
30
19
|
Appsignal::Environment.report_enabled("redis")
|
31
20
|
end
|
@@ -11,49 +11,8 @@ module Appsignal
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def install
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def perform
|
18
|
-
transaction = Appsignal::Transaction.create(
|
19
|
-
SecureRandom.uuid,
|
20
|
-
Appsignal::Transaction::BACKGROUND_JOB,
|
21
|
-
Appsignal::Transaction::GenericRequest.new({})
|
22
|
-
)
|
23
|
-
|
24
|
-
Appsignal.instrument "perform.resque" do
|
25
|
-
perform_without_appsignal
|
26
|
-
end
|
27
|
-
rescue Exception => exception # rubocop:disable Lint/RescueException
|
28
|
-
transaction.set_error(exception)
|
29
|
-
raise exception
|
30
|
-
ensure
|
31
|
-
if transaction
|
32
|
-
transaction.set_action_if_nil("#{payload["class"]}#perform")
|
33
|
-
args =
|
34
|
-
Appsignal::Utils::HashSanitizer.sanitize(
|
35
|
-
ResqueHelpers.arguments(payload),
|
36
|
-
Appsignal.config[:filter_parameters]
|
37
|
-
)
|
38
|
-
transaction.params = args if args
|
39
|
-
transaction.set_tags("queue" => queue)
|
40
|
-
|
41
|
-
Appsignal::Transaction.complete_current!
|
42
|
-
end
|
43
|
-
Appsignal.stop("resque")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class ResqueHelpers
|
49
|
-
def self.arguments(payload)
|
50
|
-
case payload["class"]
|
51
|
-
when "ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper"
|
52
|
-
nil # Set in the ActiveJob integration
|
53
|
-
else
|
54
|
-
payload["args"]
|
55
|
-
end
|
56
|
-
end
|
14
|
+
require "appsignal/integrations/resque"
|
15
|
+
Resque::Job.send(:prepend, Appsignal::Integrations::ResqueIntegration)
|
57
16
|
end
|
58
17
|
end
|
59
18
|
end
|
@@ -12,30 +12,9 @@ module Appsignal
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def install
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# We'd love to be able to hook this into Unicorn in a less
|
19
|
-
# intrusive way, but this is the best we can do given the
|
20
|
-
# options we have.
|
21
|
-
|
22
|
-
::Unicorn::HttpServer.class_eval do
|
23
|
-
alias worker_loop_without_appsignal worker_loop
|
24
|
-
|
25
|
-
def worker_loop(worker)
|
26
|
-
Appsignal.forked
|
27
|
-
worker_loop_without_appsignal(worker)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
::Unicorn::Worker.class_eval do
|
32
|
-
alias close_without_appsignal close
|
33
|
-
|
34
|
-
def close
|
35
|
-
Appsignal.stop("unicorn")
|
36
|
-
close_without_appsignal
|
37
|
-
end
|
38
|
-
end
|
15
|
+
require "appsignal/integrations/unicorn"
|
16
|
+
::Unicorn::HttpServer.send(:prepend, Appsignal::Integrations::UnicornIntegration::Server)
|
17
|
+
::Unicorn::Worker.send(:prepend, Appsignal::Integrations::UnicornIntegration::Worker)
|
39
18
|
end
|
40
19
|
end
|
41
20
|
end
|
@@ -12,13 +12,7 @@ module Appsignal
|
|
12
12
|
|
13
13
|
def install
|
14
14
|
require "appsignal/integrations/webmachine"
|
15
|
-
::Webmachine::Decision::FSM.
|
16
|
-
include Appsignal::Integrations::WebmachinePlugin::FSM
|
17
|
-
alias run_without_appsignal run
|
18
|
-
alias run run_with_appsignal
|
19
|
-
alias handle_exceptions_without_appsignal handle_exceptions
|
20
|
-
alias handle_exceptions handle_exceptions_with_appsignal
|
21
|
-
end
|
15
|
+
::Webmachine::Decision::FSM.send(:prepend, Appsignal::Integrations::WebmachineIntegration)
|
22
16
|
end
|
23
17
|
end
|
24
18
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
module Integrations
|
5
|
+
module ActionCableIntegration
|
6
|
+
def perform_action(*args, &block)
|
7
|
+
# The request is only the original websocket request
|
8
|
+
env = connection.env
|
9
|
+
request = ActionDispatch::Request.new(env)
|
10
|
+
env[Appsignal::Hooks::ActionCableHook::REQUEST_ID] ||=
|
11
|
+
request.request_id || SecureRandom.uuid
|
12
|
+
|
13
|
+
transaction = Appsignal::Transaction.create(
|
14
|
+
env[Appsignal::Hooks::ActionCableHook::REQUEST_ID],
|
15
|
+
Appsignal::Transaction::ACTION_CABLE,
|
16
|
+
request
|
17
|
+
)
|
18
|
+
|
19
|
+
begin
|
20
|
+
super
|
21
|
+
rescue Exception => exception # rubocop:disable Lint/RescueException
|
22
|
+
transaction.set_error(exception)
|
23
|
+
raise exception
|
24
|
+
ensure
|
25
|
+
transaction.params = args.first
|
26
|
+
transaction.set_action_if_nil("#{self.class}##{args.first["action"]}")
|
27
|
+
transaction.set_metadata("path", request.path)
|
28
|
+
transaction.set_metadata("method", "websocket")
|
29
|
+
Appsignal::Transaction.complete_current!
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
module Integrations
|
5
|
+
module ActiveSupportNotificationsIntegration
|
6
|
+
BANG = "!".freeze
|
7
|
+
|
8
|
+
module InstrumentIntegration
|
9
|
+
def instrument(name, payload = {}, &block)
|
10
|
+
# Events that start with a bang are internal to Rails
|
11
|
+
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
12
|
+
|
13
|
+
Appsignal::Transaction.current.start_event if instrument_this
|
14
|
+
|
15
|
+
super
|
16
|
+
ensure
|
17
|
+
if instrument_this
|
18
|
+
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
19
|
+
Appsignal::Transaction.current.finish_event(
|
20
|
+
name.to_s,
|
21
|
+
title,
|
22
|
+
body,
|
23
|
+
body_format
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module StartFinishIntegration
|
30
|
+
def start(name, payload = {})
|
31
|
+
# Events that start with a bang are internal to Rails
|
32
|
+
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
33
|
+
|
34
|
+
Appsignal::Transaction.current.start_event if instrument_this
|
35
|
+
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def finish(name, payload = {})
|
40
|
+
# Events that start with a bang are internal to Rails
|
41
|
+
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
42
|
+
|
43
|
+
if instrument_this
|
44
|
+
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
45
|
+
Appsignal::Transaction.current.finish_event(
|
46
|
+
name.to_s,
|
47
|
+
title,
|
48
|
+
body,
|
49
|
+
body_format
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module FinishStateIntegration
|
58
|
+
def finish_with_state(listeners_state, name, payload = {})
|
59
|
+
# Events that start with a bang are internal to Rails
|
60
|
+
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
61
|
+
|
62
|
+
if instrument_this
|
63
|
+
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
64
|
+
Appsignal::Transaction.current.finish_event(
|
65
|
+
name.to_s,
|
66
|
+
title,
|
67
|
+
body,
|
68
|
+
body_format
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
super
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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
|
@@ -4,8 +4,65 @@ if defined?(Appsignal)
|
|
4
4
|
Appsignal::Environment.report_enabled("object_instrumentation")
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
class Object
|
8
|
+
if Appsignal::System.ruby_2_7_or_newer?
|
9
|
+
def self.appsignal_instrument_class_method(method_name, options = {})
|
10
|
+
singleton_class.send \
|
11
|
+
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
12
|
+
singleton_class.send(:define_method, method_name) do |*args, **kwargs, &block|
|
13
|
+
name = options.fetch(:name) do
|
14
|
+
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
15
|
+
end
|
16
|
+
Appsignal.instrument name do
|
17
|
+
send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.appsignal_instrument_method(method_name, options = {})
|
23
|
+
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
24
|
+
define_method method_name do |*args, **kwargs, &block|
|
25
|
+
name = options.fetch(:name) do
|
26
|
+
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
27
|
+
end
|
28
|
+
Appsignal.instrument name do
|
29
|
+
send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
34
|
+
def self.appsignal_instrument_class_method(method_name, options = {})
|
35
|
+
singleton_class.send \
|
36
|
+
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
37
|
+
singleton_class.send(:define_method, method_name) do |*args, &block|
|
38
|
+
name = options.fetch(:name) do
|
39
|
+
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
40
|
+
end
|
41
|
+
Appsignal.instrument name do
|
42
|
+
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.appsignal_instrument_method(method_name, options = {})
|
48
|
+
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
49
|
+
define_method method_name do |*args, &block|
|
50
|
+
name = options.fetch(:name) do
|
51
|
+
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
52
|
+
end
|
53
|
+
Appsignal.instrument name do
|
54
|
+
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.appsignal_reverse_class_name
|
61
|
+
return "AnonymousClass" unless name
|
62
|
+
name.split("::").reverse.join(".")
|
63
|
+
end
|
64
|
+
|
65
|
+
def appsignal_reverse_class_name
|
66
|
+
self.class.appsignal_reverse_class_name
|
67
|
+
end
|
11
68
|
end
|
@@ -19,13 +19,9 @@ module Appsignal
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
module
|
23
|
-
alias route_without_appsignal route!
|
24
|
-
|
22
|
+
module Appsignal::Integrations::PadrinoIntegration
|
25
23
|
def route!(base = settings, pass_block = nil)
|
26
|
-
if !Appsignal.active? || env["sinatra.static_file"]
|
27
|
-
return route_without_appsignal(base, pass_block)
|
28
|
-
end
|
24
|
+
return super if !Appsignal.active? || env["sinatra.static_file"]
|
29
25
|
|
30
26
|
transaction = Appsignal::Transaction.create(
|
31
27
|
SecureRandom.uuid,
|
@@ -34,7 +30,7 @@ module Padrino::Routing::InstanceMethods
|
|
34
30
|
)
|
35
31
|
begin
|
36
32
|
Appsignal.instrument("process_action.padrino") do
|
37
|
-
|
33
|
+
super
|
38
34
|
end
|
39
35
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
40
36
|
transaction.set_error(error)
|
@@ -78,6 +74,8 @@ module Padrino::Routing::InstanceMethods
|
|
78
74
|
end
|
79
75
|
end
|
80
76
|
|
77
|
+
Padrino::Application.send(:prepend, Appsignal::Integrations::PadrinoIntegration)
|
78
|
+
|
81
79
|
Padrino.after_load do
|
82
80
|
Appsignal::Integrations::PadrinoPlugin.init
|
83
81
|
end
|