appsignal 2.11.8-java → 3.0.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/.rubocop_todo.yml +1 -1
- data/.semaphore/semaphore.yml +88 -111
- data/CHANGELOG.md +24 -0
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +11 -15
- data/lib/appsignal.rb +2 -29
- data/lib/appsignal/auth_check.rb +2 -8
- data/lib/appsignal/cli.rb +1 -23
- data/lib/appsignal/config.rb +1 -25
- data/lib/appsignal/event_formatter.rb +0 -25
- data/lib/appsignal/helpers/instrumentation.rb +69 -5
- data/lib/appsignal/hooks.rb +6 -13
- 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/sidekiq.rb +6 -143
- 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 +39 -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/sidekiq.rb +171 -0
- 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 +2 -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/sidekiq_spec.rb +12 -464
- 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 +6 -22
- data/spec/lib/appsignal/integrations/object_spec.rb +91 -8
- 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/sidekiq_spec.rb +524 -0
- 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 +162 -116
- data/spec/spec_helper.rb +1 -15
- metadata +11 -21
- 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
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,7 @@ ENV["RAILS_ENV"] ||= "test"
|
|
2
2
|
ENV["RACK_ENV"] ||= "test"
|
3
3
|
ENV["PADRINO_ENV"] ||= "test"
|
4
4
|
|
5
|
-
APPSIGNAL_SPEC_DIR = File.expand_path(
|
5
|
+
APPSIGNAL_SPEC_DIR = File.expand_path(__dir__)
|
6
6
|
$LOAD_PATH.unshift(File.join(APPSIGNAL_SPEC_DIR, "support/stubs"))
|
7
7
|
|
8
8
|
Bundler.require :default
|
@@ -85,20 +85,6 @@ RSpec.configure do |config|
|
|
85
85
|
FileUtils.mkdir_p(spec_system_tmp_dir)
|
86
86
|
end
|
87
87
|
|
88
|
-
config.before :each, :only_ruby19 => true do
|
89
|
-
is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
|
90
|
-
next if is_ruby19
|
91
|
-
|
92
|
-
skip "Skipping spec. Only for Ruby 1.9"
|
93
|
-
end
|
94
|
-
|
95
|
-
config.before :each, :not_ruby19 => true do
|
96
|
-
is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
|
97
|
-
next unless is_ruby19
|
98
|
-
|
99
|
-
skip "Skipping spec for Ruby 1.9"
|
100
|
-
end
|
101
|
-
|
102
88
|
config.before do
|
103
89
|
stop_minutely_probes
|
104
90
|
ENV["RAILS_ENV"] ||= "test"
|
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:
|
4
|
+
version: 3.0.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: 2021-
|
13
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -202,7 +202,6 @@ files:
|
|
202
202
|
- lib/appsignal/cli/diagnose/utils.rb
|
203
203
|
- lib/appsignal/cli/helpers.rb
|
204
204
|
- lib/appsignal/cli/install.rb
|
205
|
-
- lib/appsignal/cli/notify_of_deploy.rb
|
206
205
|
- lib/appsignal/config.rb
|
207
206
|
- lib/appsignal/demo.rb
|
208
207
|
- lib/appsignal/environment.rb
|
@@ -240,24 +239,26 @@ files:
|
|
240
239
|
- lib/appsignal/hooks/sidekiq.rb
|
241
240
|
- lib/appsignal/hooks/unicorn.rb
|
242
241
|
- lib/appsignal/hooks/webmachine.rb
|
242
|
+
- lib/appsignal/integrations/action_cable.rb
|
243
|
+
- lib/appsignal/integrations/active_support_notifications.rb
|
243
244
|
- lib/appsignal/integrations/capistrano/appsignal.cap
|
244
245
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
245
246
|
- lib/appsignal/integrations/data_mapper.rb
|
246
247
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
247
248
|
- lib/appsignal/integrations/grape.rb
|
248
249
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
250
|
+
- lib/appsignal/integrations/net_http.rb
|
249
251
|
- lib/appsignal/integrations/object.rb
|
250
|
-
- lib/appsignal/integrations/object_ruby_19.rb
|
251
|
-
- lib/appsignal/integrations/object_ruby_modern.rb
|
252
252
|
- lib/appsignal/integrations/padrino.rb
|
253
253
|
- lib/appsignal/integrations/que.rb
|
254
254
|
- lib/appsignal/integrations/railtie.rb
|
255
255
|
- lib/appsignal/integrations/rake.rb
|
256
|
+
- lib/appsignal/integrations/redis.rb
|
256
257
|
- lib/appsignal/integrations/resque.rb
|
257
|
-
- lib/appsignal/integrations/
|
258
|
+
- lib/appsignal/integrations/sidekiq.rb
|
258
259
|
- lib/appsignal/integrations/sinatra.rb
|
260
|
+
- lib/appsignal/integrations/unicorn.rb
|
259
261
|
- lib/appsignal/integrations/webmachine.rb
|
260
|
-
- lib/appsignal/js_exception_transaction.rb
|
261
262
|
- lib/appsignal/logger.rb
|
262
263
|
- lib/appsignal/marker.rb
|
263
264
|
- lib/appsignal/minutely.rb
|
@@ -265,7 +266,6 @@ files:
|
|
265
266
|
- lib/appsignal/probes/puma.rb
|
266
267
|
- lib/appsignal/probes/sidekiq.rb
|
267
268
|
- lib/appsignal/rack/generic_instrumentation.rb
|
268
|
-
- lib/appsignal/rack/js_exception_catcher.rb
|
269
269
|
- lib/appsignal/rack/rails_instrumentation.rb
|
270
270
|
- lib/appsignal/rack/sinatra_instrumentation.rb
|
271
271
|
- lib/appsignal/rack/streaming_listener.rb
|
@@ -294,7 +294,6 @@ files:
|
|
294
294
|
- spec/lib/appsignal/cli/diagnose_spec.rb
|
295
295
|
- spec/lib/appsignal/cli/helpers_spec.rb
|
296
296
|
- spec/lib/appsignal/cli/install_spec.rb
|
297
|
-
- spec/lib/appsignal/cli/notify_of_deploy_spec.rb
|
298
297
|
- spec/lib/appsignal/cli_spec.rb
|
299
298
|
- spec/lib/appsignal/config_spec.rb
|
300
299
|
- spec/lib/appsignal/demo_spec.rb
|
@@ -338,23 +337,19 @@ files:
|
|
338
337
|
- spec/lib/appsignal/integrations/data_mapper_spec.rb
|
339
338
|
- spec/lib/appsignal/integrations/grape_spec.rb
|
340
339
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
341
|
-
- spec/lib/appsignal/integrations/object_19_spec.rb
|
342
340
|
- spec/lib/appsignal/integrations/object_spec.rb
|
343
341
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
344
342
|
- spec/lib/appsignal/integrations/que_spec.rb
|
345
343
|
- spec/lib/appsignal/integrations/railtie_spec.rb
|
346
|
-
- spec/lib/appsignal/integrations/
|
347
|
-
- spec/lib/appsignal/integrations/resque_spec.rb
|
344
|
+
- spec/lib/appsignal/integrations/sidekiq_spec.rb
|
348
345
|
- spec/lib/appsignal/integrations/sinatra_spec.rb
|
349
346
|
- spec/lib/appsignal/integrations/webmachine_spec.rb
|
350
|
-
- spec/lib/appsignal/js_exception_transaction_spec.rb
|
351
347
|
- spec/lib/appsignal/logger_spec.rb
|
352
348
|
- spec/lib/appsignal/marker_spec.rb
|
353
349
|
- spec/lib/appsignal/minutely_spec.rb
|
354
350
|
- spec/lib/appsignal/probes/puma_spec.rb
|
355
351
|
- spec/lib/appsignal/probes/sidekiq_spec.rb
|
356
352
|
- spec/lib/appsignal/rack/generic_instrumentation_spec.rb
|
357
|
-
- spec/lib/appsignal/rack/js_exception_catcher_spec.rb
|
358
353
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
359
354
|
- spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
|
360
355
|
- spec/lib/appsignal/rack/streaming_listener_spec.rb
|
@@ -425,7 +420,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
425
420
|
requirements:
|
426
421
|
- - ">="
|
427
422
|
- !ruby/object:Gem::Version
|
428
|
-
version: '
|
423
|
+
version: '2.0'
|
429
424
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
430
425
|
requirements:
|
431
426
|
- - ">="
|
@@ -447,7 +442,6 @@ test_files:
|
|
447
442
|
- spec/lib/appsignal/cli/diagnose_spec.rb
|
448
443
|
- spec/lib/appsignal/cli/helpers_spec.rb
|
449
444
|
- spec/lib/appsignal/cli/install_spec.rb
|
450
|
-
- spec/lib/appsignal/cli/notify_of_deploy_spec.rb
|
451
445
|
- spec/lib/appsignal/cli_spec.rb
|
452
446
|
- spec/lib/appsignal/config_spec.rb
|
453
447
|
- spec/lib/appsignal/demo_spec.rb
|
@@ -491,23 +485,19 @@ test_files:
|
|
491
485
|
- spec/lib/appsignal/integrations/data_mapper_spec.rb
|
492
486
|
- spec/lib/appsignal/integrations/grape_spec.rb
|
493
487
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
494
|
-
- spec/lib/appsignal/integrations/object_19_spec.rb
|
495
488
|
- spec/lib/appsignal/integrations/object_spec.rb
|
496
489
|
- spec/lib/appsignal/integrations/padrino_spec.rb
|
497
490
|
- spec/lib/appsignal/integrations/que_spec.rb
|
498
491
|
- spec/lib/appsignal/integrations/railtie_spec.rb
|
499
|
-
- spec/lib/appsignal/integrations/
|
500
|
-
- spec/lib/appsignal/integrations/resque_spec.rb
|
492
|
+
- spec/lib/appsignal/integrations/sidekiq_spec.rb
|
501
493
|
- spec/lib/appsignal/integrations/sinatra_spec.rb
|
502
494
|
- spec/lib/appsignal/integrations/webmachine_spec.rb
|
503
|
-
- spec/lib/appsignal/js_exception_transaction_spec.rb
|
504
495
|
- spec/lib/appsignal/logger_spec.rb
|
505
496
|
- spec/lib/appsignal/marker_spec.rb
|
506
497
|
- spec/lib/appsignal/minutely_spec.rb
|
507
498
|
- spec/lib/appsignal/probes/puma_spec.rb
|
508
499
|
- spec/lib/appsignal/probes/sidekiq_spec.rb
|
509
500
|
- spec/lib/appsignal/rack/generic_instrumentation_spec.rb
|
510
|
-
- spec/lib/appsignal/rack/js_exception_catcher_spec.rb
|
511
501
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
512
502
|
- spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
|
513
503
|
- spec/lib/appsignal/rack/streaming_listener_spec.rb
|
@@ -1,131 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appsignal
|
4
|
-
class CLI
|
5
|
-
# Command line tool to send a "Deploy Marker" for an application to
|
6
|
-
# AppSignal.
|
7
|
-
#
|
8
|
-
# Deploy markers are used on AppSignal.com to indicate changes in an
|
9
|
-
# application, "Deploy markers" indicate a deploy of an application.
|
10
|
-
#
|
11
|
-
# Incidents for exceptions and performance issues will be closed and
|
12
|
-
# reopened if they occur again in the new deploy.
|
13
|
-
#
|
14
|
-
# @note The same logic is used in the Capistrano integration. A deploy
|
15
|
-
# marker is created on each deploy.
|
16
|
-
#
|
17
|
-
# ## Options
|
18
|
-
#
|
19
|
-
# - `--environment` required. The environment of the application being
|
20
|
-
# deployed.
|
21
|
-
# - `--user` required. User that triggered the deploy.
|
22
|
-
# - `--revision` required. Git commit SHA or other identifiable revision id.
|
23
|
-
# - `--name` If no "name" config can be found in a `config/appsignal.yml`
|
24
|
-
# file or based on the `APPSIGNAL_APP_NAME` environment variable, this
|
25
|
-
# option is required.
|
26
|
-
#
|
27
|
-
# ## Exit codes
|
28
|
-
#
|
29
|
-
# - Exits with status code `0` if the deploy marker is sent.
|
30
|
-
# - Exits with status code `1` if the configuration is not valid and active.
|
31
|
-
# - Exits with status code `1` if the required options aren't present.
|
32
|
-
#
|
33
|
-
# @example basic example
|
34
|
-
# appsignal notify_of_deploy \
|
35
|
-
# --user=tom \
|
36
|
-
# --environment=production \
|
37
|
-
# --revision=abc1234
|
38
|
-
#
|
39
|
-
# @example using a custom app name
|
40
|
-
# appsignal notify_of_deploy \
|
41
|
-
# --user=tom \
|
42
|
-
# --environment=production \
|
43
|
-
# --revision=abc1234 \
|
44
|
-
# --name="My app"
|
45
|
-
#
|
46
|
-
# @example help command
|
47
|
-
# appsignal notify_of_deploy --help
|
48
|
-
#
|
49
|
-
# @deprecated This method of sending AppSignal deploy markers is
|
50
|
-
# deprecated. Use the [`revision` config option]
|
51
|
-
# (https://docs.appsignal.com/ruby/configuration/options.html#app_revision-revision)
|
52
|
-
# instead. For more information, please read the [deploy markers]
|
53
|
-
# (https://docs.appsignal.com/application/markers/deploy-markers.html)
|
54
|
-
# documentation.
|
55
|
-
# @since 0.2.5
|
56
|
-
# @see Appsignal::Marker Appsignal::Marker
|
57
|
-
# @see http://docs.appsignal.com/ruby/command-line/notify_of_deploy.html
|
58
|
-
# AppSignal notify_of_deploy documentation
|
59
|
-
# @see http://docs.appsignal.com/appsignal/terminology.html#markers
|
60
|
-
# Terminology: Deploy marker
|
61
|
-
class NotifyOfDeploy
|
62
|
-
class << self
|
63
|
-
include Appsignal::Utils::DeprecationMessage
|
64
|
-
|
65
|
-
# @param options [Hash]
|
66
|
-
# @option options :environment [String] environment to load
|
67
|
-
# configuration for.
|
68
|
-
# @option options :name [String] custom name of the application.
|
69
|
-
# @option options :user [String] user who triggered the deploy.
|
70
|
-
# @option options :revision [String] the revision that has been
|
71
|
-
# deployed. E.g. a git commit SHA.
|
72
|
-
# @return [void]
|
73
|
-
def run(options)
|
74
|
-
config = config_for(options[:environment])
|
75
|
-
config[:name] = options[:name] if options[:name]
|
76
|
-
|
77
|
-
validate_active_config(config)
|
78
|
-
required_config = [:revision, :user]
|
79
|
-
required_config << :environment if config.env.empty?
|
80
|
-
required_config << :name if !config[:name] || config[:name].empty?
|
81
|
-
validate_required_options(options, required_config)
|
82
|
-
|
83
|
-
Appsignal::Marker.new(
|
84
|
-
{
|
85
|
-
:revision => options[:revision],
|
86
|
-
:user => options[:user]
|
87
|
-
},
|
88
|
-
config
|
89
|
-
).transmit
|
90
|
-
|
91
|
-
puts
|
92
|
-
message = "This command (appsignal notify_of_deploy) has been " \
|
93
|
-
"deprecated in favor of the `revision` config option. Please " \
|
94
|
-
"see our documentation for more information on the recommended " \
|
95
|
-
"method: " \
|
96
|
-
"https://docs.appsignal.com/application/markers/deploy-markers.html"
|
97
|
-
deprecation_message message
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def validate_required_options(options, required_options)
|
103
|
-
missing = required_options.select do |required_option|
|
104
|
-
val = options[required_option]
|
105
|
-
val.nil? || (val.respond_to?(:empty?) && val.empty?)
|
106
|
-
end
|
107
|
-
return unless missing.any?
|
108
|
-
|
109
|
-
puts "Error: Missing options: #{missing.join(", ")}"
|
110
|
-
exit 1
|
111
|
-
end
|
112
|
-
|
113
|
-
def validate_active_config(config)
|
114
|
-
return if config.active?
|
115
|
-
|
116
|
-
puts "Error: No valid config found."
|
117
|
-
exit 1
|
118
|
-
end
|
119
|
-
|
120
|
-
def config_for(environment)
|
121
|
-
Appsignal::Config.new(
|
122
|
-
Dir.pwd,
|
123
|
-
environment,
|
124
|
-
{},
|
125
|
-
Logger.new(StringIO.new)
|
126
|
-
)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Object
|
4
|
-
def self.appsignal_instrument_class_method(method_name, options = {})
|
5
|
-
singleton_class.send \
|
6
|
-
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
7
|
-
singleton_class.send(:define_method, method_name) do |*args, &block|
|
8
|
-
name = options.fetch(:name) do
|
9
|
-
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
10
|
-
end
|
11
|
-
Appsignal.instrument name do
|
12
|
-
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.appsignal_instrument_method(method_name, options = {})
|
18
|
-
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
19
|
-
define_method method_name do |*args, &block|
|
20
|
-
name = options.fetch(:name) do
|
21
|
-
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
22
|
-
end
|
23
|
-
Appsignal.instrument name do
|
24
|
-
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.appsignal_reverse_class_name
|
30
|
-
return "AnonymousClass" unless name
|
31
|
-
name.split("::").reverse.join(".")
|
32
|
-
end
|
33
|
-
|
34
|
-
def appsignal_reverse_class_name
|
35
|
-
self.class.appsignal_reverse_class_name
|
36
|
-
end
|
37
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Object
|
4
|
-
if Appsignal::System.ruby_2_7_or_newer?
|
5
|
-
def self.appsignal_instrument_class_method(method_name, options = {})
|
6
|
-
singleton_class.send \
|
7
|
-
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
8
|
-
singleton_class.send(:define_method, method_name) do |*args, **kwargs, &block|
|
9
|
-
name = options.fetch(:name) do
|
10
|
-
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
11
|
-
end
|
12
|
-
Appsignal.instrument name do
|
13
|
-
send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.appsignal_instrument_method(method_name, options = {})
|
19
|
-
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
20
|
-
define_method method_name do |*args, **kwargs, &block|
|
21
|
-
name = options.fetch(:name) do
|
22
|
-
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
23
|
-
end
|
24
|
-
Appsignal.instrument name do
|
25
|
-
send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
else
|
30
|
-
def self.appsignal_instrument_class_method(method_name, options = {})
|
31
|
-
singleton_class.send \
|
32
|
-
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
33
|
-
singleton_class.send(:define_method, method_name) do |*args, &block|
|
34
|
-
name = options.fetch(:name) do
|
35
|
-
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
36
|
-
end
|
37
|
-
Appsignal.instrument name do
|
38
|
-
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.appsignal_instrument_method(method_name, options = {})
|
44
|
-
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
45
|
-
define_method method_name do |*args, &block|
|
46
|
-
name = options.fetch(:name) do
|
47
|
-
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
48
|
-
end
|
49
|
-
Appsignal.instrument name do
|
50
|
-
send "appsignal_uninstrumented_#{method_name}", *args, &block
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.appsignal_reverse_class_name
|
57
|
-
return "AnonymousClass" unless name
|
58
|
-
name.split("::").reverse.join(".")
|
59
|
-
end
|
60
|
-
|
61
|
-
def appsignal_reverse_class_name
|
62
|
-
self.class.appsignal_reverse_class_name
|
63
|
-
end
|
64
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appsignal
|
4
|
-
module Integrations
|
5
|
-
# @api private
|
6
|
-
module ResqueActiveJobPlugin
|
7
|
-
def self.included(_)
|
8
|
-
callers = caller
|
9
|
-
Appsignal::Utils::DeprecationMessage.message \
|
10
|
-
"The AppSignal ResqueActiveJobPlugin is deprecated and does " \
|
11
|
-
"nothing on extend. In this version of the AppSignal Ruby gem " \
|
12
|
-
"the integration with Resque is automatic on all Resque workers. " \
|
13
|
-
"Please remove the following line from this file to remove this " \
|
14
|
-
"message: include Appsignal::Integrations::ResqueActiveJobPlugin\n" \
|
15
|
-
"#{callers.first}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appsignal
|
4
|
-
class JSExceptionTransaction
|
5
|
-
attr_reader :uuid, :ext
|
6
|
-
|
7
|
-
def initialize(data)
|
8
|
-
@data = data
|
9
|
-
@uuid = SecureRandom.uuid
|
10
|
-
@ext = Appsignal::Extension.start_transaction(@uuid, Appsignal::Transaction::FRONTEND, 0)
|
11
|
-
|
12
|
-
set_action
|
13
|
-
set_metadata
|
14
|
-
set_error
|
15
|
-
set_sample_data
|
16
|
-
end
|
17
|
-
|
18
|
-
def set_action
|
19
|
-
return unless @data["action"]
|
20
|
-
ext.set_action(@data["action"])
|
21
|
-
end
|
22
|
-
|
23
|
-
def set_metadata
|
24
|
-
return unless @data["path"]
|
25
|
-
ext.set_metadata("path", @data["path"])
|
26
|
-
end
|
27
|
-
|
28
|
-
def set_error
|
29
|
-
ext.set_error(
|
30
|
-
@data["name"],
|
31
|
-
@data["message"] || "",
|
32
|
-
Appsignal::Utils::Data.generate(@data["backtrace"] || [])
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
def set_sample_data
|
37
|
-
{
|
38
|
-
:params => @data["params"],
|
39
|
-
:session_data => @data["session_data"],
|
40
|
-
:environment => @data["environment"],
|
41
|
-
:tags => @data["tags"]
|
42
|
-
}.each do |key, data|
|
43
|
-
next unless data.is_a?(Array) || data.is_a?(Hash)
|
44
|
-
ext.set_sample_data(
|
45
|
-
key.to_s,
|
46
|
-
Appsignal::Utils::Data.generate(data)
|
47
|
-
)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def complete!
|
52
|
-
ext.finish(0)
|
53
|
-
ext.complete
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|