appsignal 2.11.9-java → 3.0.0.beta.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.semaphore/semaphore.yml +0 -23
  4. data/CHANGELOG.md +5 -14
  5. data/build_matrix.yml +0 -4
  6. data/lib/appsignal.rb +1 -27
  7. data/lib/appsignal/auth_check.rb +2 -8
  8. data/lib/appsignal/cli.rb +1 -23
  9. data/lib/appsignal/config.rb +0 -24
  10. data/lib/appsignal/event_formatter.rb +0 -25
  11. data/lib/appsignal/hooks.rb +0 -23
  12. data/lib/appsignal/hooks/action_cable.rb +5 -44
  13. data/lib/appsignal/hooks/active_support_notifications.rb +7 -86
  14. data/lib/appsignal/hooks/celluloid.rb +5 -9
  15. data/lib/appsignal/hooks/net_http.rb +2 -12
  16. data/lib/appsignal/hooks/puma.rb +3 -5
  17. data/lib/appsignal/hooks/que.rb +1 -1
  18. data/lib/appsignal/hooks/rake.rb +2 -24
  19. data/lib/appsignal/hooks/redis.rb +2 -13
  20. data/lib/appsignal/hooks/resque.rb +2 -43
  21. data/lib/appsignal/hooks/sidekiq.rb +1 -5
  22. data/lib/appsignal/hooks/unicorn.rb +3 -24
  23. data/lib/appsignal/hooks/webmachine.rb +1 -7
  24. data/lib/appsignal/integrations/action_cable.rb +34 -0
  25. data/lib/appsignal/integrations/active_support_notifications.rb +77 -0
  26. data/lib/appsignal/integrations/net_http.rb +16 -0
  27. data/lib/appsignal/integrations/object.rb +61 -4
  28. data/lib/appsignal/integrations/padrino.rb +5 -7
  29. data/lib/appsignal/integrations/que.rb +26 -33
  30. data/lib/appsignal/integrations/railtie.rb +1 -4
  31. data/lib/appsignal/integrations/rake.rb +26 -2
  32. data/lib/appsignal/integrations/redis.rb +17 -0
  33. data/lib/appsignal/integrations/resque.rb +39 -10
  34. data/lib/appsignal/integrations/unicorn.rb +28 -0
  35. data/lib/appsignal/integrations/webmachine.rb +22 -24
  36. data/lib/appsignal/minutely.rb +0 -18
  37. data/lib/appsignal/version.rb +1 -1
  38. data/spec/lib/appsignal/auth_check_spec.rb +1 -24
  39. data/spec/lib/appsignal/cli_spec.rb +1 -1
  40. data/spec/lib/appsignal/config_spec.rb +0 -66
  41. data/spec/lib/appsignal/event_formatter_spec.rb +0 -37
  42. data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -88
  43. data/spec/lib/appsignal/hooks/celluloid_spec.rb +6 -1
  44. data/spec/lib/appsignal/hooks/rake_spec.rb +1 -2
  45. data/spec/lib/appsignal/hooks/redis_spec.rb +50 -15
  46. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +7 -61
  47. data/spec/lib/appsignal/hooks/unicorn_spec.rb +14 -3
  48. data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -13
  49. data/spec/lib/appsignal/hooks_spec.rb +0 -57
  50. data/spec/lib/appsignal/integrations/object_spec.rb +4 -95
  51. data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -3
  52. data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -45
  53. data/spec/lib/appsignal/integrations/webmachine_spec.rb +26 -8
  54. data/spec/lib/appsignal/minutely_spec.rb +0 -19
  55. data/spec/lib/appsignal/transaction_spec.rb +1 -14
  56. data/spec/lib/appsignal/transmitter_spec.rb +1 -1
  57. data/spec/lib/appsignal_spec.rb +0 -69
  58. data/spec/lib/puma/appsignal_spec.rb +0 -28
  59. data/spec/spec_helper.rb +1 -15
  60. metadata +10 -23
  61. data/lib/appsignal/cli/notify_of_deploy.rb +0 -131
  62. data/lib/appsignal/integrations/object_ruby_19.rb +0 -37
  63. data/lib/appsignal/integrations/object_ruby_modern.rb +0 -41
  64. data/lib/appsignal/integrations/resque_active_job.rb +0 -19
  65. data/lib/appsignal/js_exception_transaction.rb +0 -56
  66. data/lib/appsignal/rack/js_exception_catcher.rb +0 -80
  67. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +0 -180
  68. data/spec/lib/appsignal/integrations/object_19_spec.rb +0 -266
  69. data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +0 -28
  70. data/spec/lib/appsignal/integrations/resque_spec.rb +0 -28
  71. data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -128
  72. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -170
@@ -143,7 +143,7 @@ describe Appsignal::Transmitter do
143
143
  context "with a proxy" do
144
144
  let(:config) { project_fixture_config("production", :http_proxy => "http://localhost:8080") }
145
145
 
146
- it "is of Net::HTTP class", :not_ruby19 do
146
+ it "is of Net::HTTP class" do
147
147
  expect(subject).to be_instance_of(Net::HTTP)
148
148
  end
149
149
  it { expect(subject.proxy?).to be_truthy }
@@ -63,11 +63,6 @@ describe Appsignal do
63
63
  Appsignal.start
64
64
  end
65
65
 
66
- it "should load deprecated event formatters" do
67
- expect(Appsignal::EventFormatter).to receive(:initialize_deprecated_formatters)
68
- Appsignal.start
69
- end
70
-
71
66
  context "with an extension" do
72
67
  before { Appsignal.extensions << Appsignal::MockExtension }
73
68
 
@@ -980,70 +975,6 @@ describe Appsignal do
980
975
  end
981
976
  end
982
977
  end
983
-
984
- describe ".is_ignored_error?" do
985
- let(:error) { StandardError.new }
986
- let(:err_stream) { std_stream }
987
- let(:stderr) { err_stream.read }
988
- before do
989
- allow(Appsignal).to receive(:config).and_return(:ignore_errors => ["StandardError"])
990
- end
991
-
992
- subject do
993
- capture_std_streams(std_stream, err_stream) do
994
- Appsignal.is_ignored_error?(error)
995
- end
996
- end
997
-
998
- it "should return true if it's in the ignored list" do
999
- is_expected.to be_truthy
1000
- end
1001
-
1002
- it "outputs deprecated warning" do
1003
- subject
1004
- expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement")
1005
- end
1006
-
1007
- context "when error is not in the ignored list" do
1008
- let(:error) { Object.new }
1009
-
1010
- it "should return false" do
1011
- is_expected.to be_falsy
1012
- end
1013
- end
1014
- end
1015
-
1016
- describe ".is_ignored_action?" do
1017
- let(:action) { "TestController#isup" }
1018
- let(:err_stream) { std_stream }
1019
- let(:stderr) { err_stream.read }
1020
- before do
1021
- allow(Appsignal).to receive(:config).and_return(:ignore_actions => "TestController#isup")
1022
- end
1023
-
1024
- subject do
1025
- capture_std_streams(std_stream, err_stream) do
1026
- Appsignal.is_ignored_action?(action)
1027
- end
1028
- end
1029
-
1030
- it "should return true if it's in the ignored list" do
1031
- is_expected.to be_truthy
1032
- end
1033
-
1034
- it "outputs deprecated warning" do
1035
- subject
1036
- expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement")
1037
- end
1038
-
1039
- context "when action is not in the ingore list" do
1040
- let(:action) { "TestController#other_action" }
1041
-
1042
- it "should return false" do
1043
- is_expected.to be_falsy
1044
- end
1045
- end
1046
- end
1047
978
  end
1048
979
 
1049
980
  describe ".start_logger" do
@@ -23,27 +23,6 @@ RSpec.describe "Puma plugin" do
23
23
  def self.stats
24
24
  end
25
25
 
26
- def self.run
27
- # Capture threads running before application is preloaded
28
- before = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
29
-
30
- # An abbreviated version of what happens in Puma::Cluster#run
31
- launcher = MockPumaLauncher.new
32
- plugin = Plugin.plugin.new
33
- plugin.start(launcher)
34
- launcher.events.on_booted.call
35
-
36
- # Wait for minutely probe thread to finish starting
37
- sleep 0.005
38
-
39
- # Capture any new threads running after application is preloaded.
40
- # Any threads created during the preloading phase will not be
41
- # carried over into the forked workers. Puma warns about these
42
- # but the minutely probe thread should only exist in the main process.
43
- after = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
44
- $stdout.puts "! WARNING: Detected #{after.size - before.size} Thread(s) started in app boot" if after.size > before.size
45
- end
46
-
47
26
  class Plugin
48
27
  class << self
49
28
  attr_reader :plugin
@@ -89,13 +68,6 @@ RSpec.describe "Puma plugin" do
89
68
  wait_for("enough probe calls") { probe.calls >= 2 }
90
69
  end
91
70
 
92
- it "marks the PumaProbe thread as fork-safe", :not_ruby19 do
93
- out_stream = std_stream
94
- capture_stdout(out_stream) { Puma.run }
95
-
96
- expect(out_stream.read).not_to include("WARNING: Detected 1 Thread")
97
- end
98
-
99
71
  context "without Puma.stats" do
100
72
  before { Puma.singleton_class.send(:remove_method, :stats) }
101
73
 
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(File.dirname(__FILE__))
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: 2.11.9
4
+ version: 3.0.0.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: 2021-02-23 00:00:00.000000000 Z
13
+ date: 2021-01-28 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,25 @@ 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/resque_active_job.rb
258
258
  - lib/appsignal/integrations/sinatra.rb
259
+ - lib/appsignal/integrations/unicorn.rb
259
260
  - lib/appsignal/integrations/webmachine.rb
260
- - lib/appsignal/js_exception_transaction.rb
261
261
  - lib/appsignal/logger.rb
262
262
  - lib/appsignal/marker.rb
263
263
  - lib/appsignal/minutely.rb
@@ -265,7 +265,6 @@ files:
265
265
  - lib/appsignal/probes/puma.rb
266
266
  - lib/appsignal/probes/sidekiq.rb
267
267
  - lib/appsignal/rack/generic_instrumentation.rb
268
- - lib/appsignal/rack/js_exception_catcher.rb
269
268
  - lib/appsignal/rack/rails_instrumentation.rb
270
269
  - lib/appsignal/rack/sinatra_instrumentation.rb
271
270
  - lib/appsignal/rack/streaming_listener.rb
@@ -294,7 +293,6 @@ files:
294
293
  - spec/lib/appsignal/cli/diagnose_spec.rb
295
294
  - spec/lib/appsignal/cli/helpers_spec.rb
296
295
  - spec/lib/appsignal/cli/install_spec.rb
297
- - spec/lib/appsignal/cli/notify_of_deploy_spec.rb
298
296
  - spec/lib/appsignal/cli_spec.rb
299
297
  - spec/lib/appsignal/config_spec.rb
300
298
  - spec/lib/appsignal/demo_spec.rb
@@ -338,23 +336,18 @@ files:
338
336
  - spec/lib/appsignal/integrations/data_mapper_spec.rb
339
337
  - spec/lib/appsignal/integrations/grape_spec.rb
340
338
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
341
- - spec/lib/appsignal/integrations/object_19_spec.rb
342
339
  - spec/lib/appsignal/integrations/object_spec.rb
343
340
  - spec/lib/appsignal/integrations/padrino_spec.rb
344
341
  - spec/lib/appsignal/integrations/que_spec.rb
345
342
  - spec/lib/appsignal/integrations/railtie_spec.rb
346
- - spec/lib/appsignal/integrations/resque_active_job_spec.rb
347
- - spec/lib/appsignal/integrations/resque_spec.rb
348
343
  - spec/lib/appsignal/integrations/sinatra_spec.rb
349
344
  - spec/lib/appsignal/integrations/webmachine_spec.rb
350
- - spec/lib/appsignal/js_exception_transaction_spec.rb
351
345
  - spec/lib/appsignal/logger_spec.rb
352
346
  - spec/lib/appsignal/marker_spec.rb
353
347
  - spec/lib/appsignal/minutely_spec.rb
354
348
  - spec/lib/appsignal/probes/puma_spec.rb
355
349
  - spec/lib/appsignal/probes/sidekiq_spec.rb
356
350
  - spec/lib/appsignal/rack/generic_instrumentation_spec.rb
357
- - spec/lib/appsignal/rack/js_exception_catcher_spec.rb
358
351
  - spec/lib/appsignal/rack/rails_instrumentation_spec.rb
359
352
  - spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
360
353
  - spec/lib/appsignal/rack/streaming_listener_spec.rb
@@ -428,11 +421,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
428
421
  version: '1.9'
429
422
  required_rubygems_version: !ruby/object:Gem::Requirement
430
423
  requirements:
431
- - - ">="
424
+ - - ">"
432
425
  - !ruby/object:Gem::Version
433
- version: '0'
426
+ version: 1.3.1
434
427
  requirements: []
435
- rubygems_version: 3.2.8
428
+ rubygems_version: 3.2.6
436
429
  signing_key:
437
430
  specification_version: 4
438
431
  summary: Logs performance and exception data from your app to appsignal.com
@@ -447,7 +440,6 @@ test_files:
447
440
  - spec/lib/appsignal/cli/diagnose_spec.rb
448
441
  - spec/lib/appsignal/cli/helpers_spec.rb
449
442
  - spec/lib/appsignal/cli/install_spec.rb
450
- - spec/lib/appsignal/cli/notify_of_deploy_spec.rb
451
443
  - spec/lib/appsignal/cli_spec.rb
452
444
  - spec/lib/appsignal/config_spec.rb
453
445
  - spec/lib/appsignal/demo_spec.rb
@@ -491,23 +483,18 @@ test_files:
491
483
  - spec/lib/appsignal/integrations/data_mapper_spec.rb
492
484
  - spec/lib/appsignal/integrations/grape_spec.rb
493
485
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
494
- - spec/lib/appsignal/integrations/object_19_spec.rb
495
486
  - spec/lib/appsignal/integrations/object_spec.rb
496
487
  - spec/lib/appsignal/integrations/padrino_spec.rb
497
488
  - spec/lib/appsignal/integrations/que_spec.rb
498
489
  - spec/lib/appsignal/integrations/railtie_spec.rb
499
- - spec/lib/appsignal/integrations/resque_active_job_spec.rb
500
- - spec/lib/appsignal/integrations/resque_spec.rb
501
490
  - spec/lib/appsignal/integrations/sinatra_spec.rb
502
491
  - spec/lib/appsignal/integrations/webmachine_spec.rb
503
- - spec/lib/appsignal/js_exception_transaction_spec.rb
504
492
  - spec/lib/appsignal/logger_spec.rb
505
493
  - spec/lib/appsignal/marker_spec.rb
506
494
  - spec/lib/appsignal/minutely_spec.rb
507
495
  - spec/lib/appsignal/probes/puma_spec.rb
508
496
  - spec/lib/appsignal/probes/sidekiq_spec.rb
509
497
  - spec/lib/appsignal/rack/generic_instrumentation_spec.rb
510
- - spec/lib/appsignal/rack/js_exception_catcher_spec.rb
511
498
  - spec/lib/appsignal/rack/rails_instrumentation_spec.rb
512
499
  - spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
513
500
  - 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