appsignal 4.0.6-java → 4.0.7-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Rakefile +9 -9
  4. data/appsignal.gemspec +22 -1
  5. data/ext/agent.rb +27 -27
  6. data/lib/appsignal/check_in.rb +1 -1
  7. data/lib/appsignal/config.rb +1 -3
  8. data/lib/appsignal/integrations/resque.rb +1 -6
  9. data/lib/appsignal/utils/hash_sanitizer.rb +4 -0
  10. data/lib/appsignal/version.rb +1 -1
  11. metadata +2 -192
  12. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  13. data/.github/ISSUE_TEMPLATE/chore.md +0 -14
  14. data/.github/workflows/ci.yml +0 -3285
  15. data/.github/workflows/create_release_from_tag.yml +0 -62
  16. data/.gitignore +0 -35
  17. data/.gitmodules +0 -3
  18. data/.rspec +0 -4
  19. data/.yardopts +0 -8
  20. data/benchmark.rake +0 -139
  21. data/gemfiles/capistrano2.gemfile +0 -6
  22. data/gemfiles/capistrano3.gemfile +0 -7
  23. data/gemfiles/dry-monitor.gemfile +0 -5
  24. data/gemfiles/grape.gemfile +0 -5
  25. data/gemfiles/hanami-2.0.gemfile +0 -7
  26. data/gemfiles/hanami-2.1.gemfile +0 -7
  27. data/gemfiles/http5.gemfile +0 -5
  28. data/gemfiles/no_dependencies.gemfile +0 -10
  29. data/gemfiles/padrino.gemfile +0 -7
  30. data/gemfiles/psych-3.gemfile +0 -5
  31. data/gemfiles/psych-4.gemfile +0 -5
  32. data/gemfiles/que-1.gemfile +0 -5
  33. data/gemfiles/que-2.gemfile +0 -5
  34. data/gemfiles/rails-6.0.gemfile +0 -10
  35. data/gemfiles/rails-6.1.gemfile +0 -11
  36. data/gemfiles/rails-7.0.gemfile +0 -11
  37. data/gemfiles/rails-7.1.gemfile +0 -11
  38. data/gemfiles/rails-7.2.gemfile +0 -11
  39. data/gemfiles/redis-4.gemfile +0 -5
  40. data/gemfiles/redis-5.gemfile +0 -6
  41. data/gemfiles/resque-2.gemfile +0 -6
  42. data/gemfiles/sequel.gemfile +0 -10
  43. data/gemfiles/sinatra.gemfile +0 -5
  44. data/gemfiles/webmachine1.gemfile +0 -7
  45. data/gemfiles/webmachine2.gemfile +0 -6
  46. data/mono.yml +0 -16
  47. data/spec/.rubocop.yml +0 -7
  48. data/spec/lib/appsignal/auth_check_spec.rb +0 -84
  49. data/spec/lib/appsignal/capistrano2_spec.rb +0 -227
  50. data/spec/lib/appsignal/capistrano3_spec.rb +0 -284
  51. data/spec/lib/appsignal/check_in/cron_spec.rb +0 -210
  52. data/spec/lib/appsignal/check_in/scheduler_spec.rb +0 -557
  53. data/spec/lib/appsignal/cli/demo_spec.rb +0 -46
  54. data/spec/lib/appsignal/cli/diagnose/paths_spec.rb +0 -16
  55. data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +0 -86
  56. data/spec/lib/appsignal/cli/diagnose_spec.rb +0 -1553
  57. data/spec/lib/appsignal/cli/helpers_spec.rb +0 -179
  58. data/spec/lib/appsignal/cli/install_spec.rb +0 -848
  59. data/spec/lib/appsignal/cli_spec.rb +0 -56
  60. data/spec/lib/appsignal/config_spec.rb +0 -1380
  61. data/spec/lib/appsignal/demo_spec.rb +0 -83
  62. data/spec/lib/appsignal/environment_spec.rb +0 -190
  63. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +0 -60
  64. data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +0 -21
  65. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +0 -21
  66. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +0 -52
  67. data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +0 -21
  68. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +0 -84
  69. data/spec/lib/appsignal/event_formatter/rom/sql_formatter_spec.rb +0 -22
  70. data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +0 -30
  71. data/spec/lib/appsignal/event_formatter/view_component/render_formatter_spec.rb +0 -41
  72. data/spec/lib/appsignal/event_formatter_spec.rb +0 -193
  73. data/spec/lib/appsignal/extension/jruby_spec.rb +0 -46
  74. data/spec/lib/appsignal/extension_install_failure_spec.rb +0 -20
  75. data/spec/lib/appsignal/extension_spec.rb +0 -178
  76. data/spec/lib/appsignal/garbage_collection_spec.rb +0 -98
  77. data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -345
  78. data/spec/lib/appsignal/hooks/action_mailer_spec.rb +0 -55
  79. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +0 -23
  80. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +0 -99
  81. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +0 -47
  82. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +0 -47
  83. data/spec/lib/appsignal/hooks/activejob_spec.rb +0 -650
  84. data/spec/lib/appsignal/hooks/at_exit_spec.rb +0 -105
  85. data/spec/lib/appsignal/hooks/celluloid_spec.rb +0 -40
  86. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +0 -40
  87. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +0 -38
  88. data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +0 -83
  89. data/spec/lib/appsignal/hooks/excon_spec.rb +0 -67
  90. data/spec/lib/appsignal/hooks/gvl_spec.rb +0 -145
  91. data/spec/lib/appsignal/hooks/http_spec.rb +0 -37
  92. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +0 -46
  93. data/spec/lib/appsignal/hooks/mri_spec.rb +0 -23
  94. data/spec/lib/appsignal/hooks/net_http_spec.rb +0 -18
  95. data/spec/lib/appsignal/hooks/passenger_spec.rb +0 -30
  96. data/spec/lib/appsignal/hooks/puma_spec.rb +0 -80
  97. data/spec/lib/appsignal/hooks/que_spec.rb +0 -19
  98. data/spec/lib/appsignal/hooks/rake_spec.rb +0 -144
  99. data/spec/lib/appsignal/hooks/redis_client_spec.rb +0 -218
  100. data/spec/lib/appsignal/hooks/redis_spec.rb +0 -124
  101. data/spec/lib/appsignal/hooks/resque_spec.rb +0 -27
  102. data/spec/lib/appsignal/hooks/sequel_spec.rb +0 -44
  103. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +0 -29
  104. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +0 -115
  105. data/spec/lib/appsignal/hooks/unicorn_spec.rb +0 -63
  106. data/spec/lib/appsignal/hooks/webmachine_spec.rb +0 -24
  107. data/spec/lib/appsignal/hooks_spec.rb +0 -124
  108. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +0 -74
  109. data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +0 -454
  110. data/spec/lib/appsignal/integrations/http_spec.rb +0 -111
  111. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +0 -154
  112. data/spec/lib/appsignal/integrations/net_http_spec.rb +0 -33
  113. data/spec/lib/appsignal/integrations/object_spec.rb +0 -347
  114. data/spec/lib/appsignal/integrations/puma_spec.rb +0 -150
  115. data/spec/lib/appsignal/integrations/que_spec.rb +0 -187
  116. data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -457
  117. data/spec/lib/appsignal/integrations/resque_spec.rb +0 -155
  118. data/spec/lib/appsignal/integrations/shoryuken_spec.rb +0 -165
  119. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +0 -640
  120. data/spec/lib/appsignal/integrations/webmachine_spec.rb +0 -136
  121. data/spec/lib/appsignal/loaders/grape_spec.rb +0 -12
  122. data/spec/lib/appsignal/loaders/hanami_spec.rb +0 -92
  123. data/spec/lib/appsignal/loaders/padrino_spec.rb +0 -273
  124. data/spec/lib/appsignal/loaders/sinatra_spec.rb +0 -44
  125. data/spec/lib/appsignal/loaders_spec.rb +0 -144
  126. data/spec/lib/appsignal/logger_spec.rb +0 -205
  127. data/spec/lib/appsignal/marker_spec.rb +0 -51
  128. data/spec/lib/appsignal/probes/gvl_spec.rb +0 -164
  129. data/spec/lib/appsignal/probes/mri_spec.rb +0 -162
  130. data/spec/lib/appsignal/probes/sidekiq_spec.rb +0 -333
  131. data/spec/lib/appsignal/probes_spec.rb +0 -414
  132. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +0 -370
  133. data/spec/lib/appsignal/rack/body_wrapper_spec.rb +0 -319
  134. data/spec/lib/appsignal/rack/event_handler_spec.rb +0 -441
  135. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +0 -201
  136. data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +0 -36
  137. data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +0 -38
  138. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +0 -126
  139. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +0 -217
  140. data/spec/lib/appsignal/rack_spec.rb +0 -243
  141. data/spec/lib/appsignal/sample_data_spec.rb +0 -238
  142. data/spec/lib/appsignal/span_spec.rb +0 -141
  143. data/spec/lib/appsignal/system_spec.rb +0 -126
  144. data/spec/lib/appsignal/transaction_spec.rb +0 -2115
  145. data/spec/lib/appsignal/transmitter_spec.rb +0 -198
  146. data/spec/lib/appsignal/utils/data_spec.rb +0 -166
  147. data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +0 -182
  148. data/spec/lib/appsignal/utils/integration_logger_spec.rb +0 -21
  149. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +0 -153
  150. data/spec/lib/appsignal/utils/json_spec.rb +0 -44
  151. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +0 -192
  152. data/spec/lib/appsignal_spec.rb +0 -1919
  153. data/spec/lib/puma/appsignal_spec.rb +0 -334
  154. data/spec/spec_helper.rb +0 -179
  155. data/spec/support/fixtures/generated_config.yml +0 -24
  156. data/spec/support/fixtures/projects/broken/config/appsignal.yml +0 -1
  157. data/spec/support/fixtures/projects/valid/config/appsignal.yml +0 -57
  158. data/spec/support/fixtures/projects/valid/log/.gitkeep +0 -0
  159. data/spec/support/fixtures/projects/valid_with_rails_app/config/application.rb +0 -16
  160. data/spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml +0 -56
  161. data/spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb +0 -10
  162. data/spec/support/fixtures/projects/valid_with_rails_app/log/.gitkeep +0 -0
  163. data/spec/support/fixtures/uploaded_file.txt +0 -0
  164. data/spec/support/hanami/hanami_app.rb +0 -29
  165. data/spec/support/helpers/action_mailer_helpers.rb +0 -25
  166. data/spec/support/helpers/activejob_helpers.rb +0 -27
  167. data/spec/support/helpers/api_request_helper.rb +0 -60
  168. data/spec/support/helpers/cli_helpers.rb +0 -40
  169. data/spec/support/helpers/config_helpers.rb +0 -66
  170. data/spec/support/helpers/dependency_helper.rb +0 -155
  171. data/spec/support/helpers/directory_helper.rb +0 -27
  172. data/spec/support/helpers/env_helpers.rb +0 -41
  173. data/spec/support/helpers/environment_metdata_helper.rb +0 -16
  174. data/spec/support/helpers/example_exception.rb +0 -13
  175. data/spec/support/helpers/example_standard_error.rb +0 -13
  176. data/spec/support/helpers/loader_helper.rb +0 -21
  177. data/spec/support/helpers/log_helpers.rb +0 -36
  178. data/spec/support/helpers/rails_helper.rb +0 -28
  179. data/spec/support/helpers/std_streams_helper.rb +0 -94
  180. data/spec/support/helpers/system_helpers.rb +0 -8
  181. data/spec/support/helpers/take_at_most_helper.rb +0 -21
  182. data/spec/support/helpers/time_helpers.rb +0 -11
  183. data/spec/support/helpers/transaction_helpers.rb +0 -122
  184. data/spec/support/helpers/wait_for_helper.rb +0 -39
  185. data/spec/support/matchers/contains_log.rb +0 -26
  186. data/spec/support/matchers/have_colorized_text.rb +0 -28
  187. data/spec/support/matchers/transaction.rb +0 -200
  188. data/spec/support/mocks/appsignal_mock.rb +0 -18
  189. data/spec/support/mocks/dummy_app.rb +0 -20
  190. data/spec/support/mocks/fake_gc_profiler.rb +0 -19
  191. data/spec/support/mocks/fake_gvl_tools.rb +0 -28
  192. data/spec/support/mocks/hash_like.rb +0 -10
  193. data/spec/support/mocks/mock_probe.rb +0 -13
  194. data/spec/support/mocks/puma_mock.rb +0 -43
  195. data/spec/support/shared_examples/instrument.rb +0 -48
  196. data/spec/support/stubs/appsignal/loaders/loader_stub.rb +0 -7
  197. data/spec/support/stubs/delayed_job.rb +0 -0
  198. data/spec/support/stubs/sidekiq/api.rb +0 -4
  199. data/spec/support/testing.rb +0 -203
  200. data/support/bundler_wrapper +0 -12
  201. data/support/install_deps +0 -33
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "hanami"
4
- require "hanami/action"
5
-
6
- module HanamiApp
7
- class App < Hanami::App
8
- end
9
-
10
- class Routes < Hanami::Routes
11
- get "/books", :to => "books.index"
12
- end
13
-
14
- module Actions
15
- module Books
16
- class Index < Hanami::Action
17
- def handle(_request, response)
18
- response.body = "YOU REQUESTED BOOKS!"
19
- end
20
- end
21
-
22
- class Error < Hanami::Action
23
- def handle(_request, _response)
24
- raise ExampleException, "exception message"
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,25 +0,0 @@
1
- module ActionMailerHelpers
2
- def perform_action_mailer(mailer, method, args = nil)
3
- if DependencyHelper.rails_version >= Gem::Version.new("5.2.0")
4
- case args
5
- when Array
6
- mailer.send(method, *args).deliver_later
7
- when Hash
8
- mailer.with(args).send(method).deliver_later
9
- when NilClass
10
- mailer.send(method).deliver_later
11
- else
12
- raise "Unknown scenario for arguments: #{args}"
13
- end
14
- else
15
- # Rails 5.1 and lower
16
- mailer_object =
17
- if args
18
- mailer.send(method, *args)
19
- else
20
- mailer.send(method)
21
- end
22
- mailer_object.deliver_later
23
- end
24
- end
25
- end
@@ -1,27 +0,0 @@
1
- module ActiveJobHelpers
2
- def active_job_args_wrapper(args: [], params: nil)
3
- if DependencyHelper.active_job_wraps_args?
4
- wrapped_args = {}
5
-
6
- if params
7
- if DependencyHelper.rails7_present?
8
- wrapped_args["_aj_ruby2_keywords"] = ["params", "args"]
9
- wrapped_args["args"] = []
10
- wrapped_args["params"] = {
11
- "_aj_symbol_keys" => ["foo"]
12
- }.merge(params)
13
- else
14
- wrapped_args["_aj_symbol_keys"] = ["foo"]
15
- wrapped_args.merge!(params)
16
- end
17
- else
18
- wrapped_args["_aj_ruby2_keywords"] = ["args"]
19
- wrapped_args["args"] = args
20
- end
21
-
22
- [wrapped_args]
23
- else
24
- params.nil? ? args : args + [params]
25
- end
26
- end
27
- end
@@ -1,60 +0,0 @@
1
- module ApiRequestHelper
2
- def stub_api_request(config, path, body = nil)
3
- options = {
4
- :query => {
5
- :api_key => config[:push_api_key],
6
- :name => config[:name],
7
- :environment => config.respond_to?(:env) ? config.env : config[:environment],
8
- :hostname => config[:hostname],
9
- :gem_version => Appsignal::VERSION
10
- },
11
- :headers => {
12
- "Content-Type" => "application/json; charset=UTF-8"
13
- }
14
- }
15
- body = Appsignal::Utils::JSON.generate(body) if body.is_a? Hash
16
- options[:body] = body if body
17
- endpoint = config[:endpoint] || Appsignal::Config::DEFAULT_CONFIG[:endpoint]
18
- stub_request(:post, "#{endpoint}/1/#{path}").with(options)
19
- end
20
-
21
- def stub_check_in_request(events:, response: { :status => 200 })
22
- config = Appsignal.config
23
- options = {
24
- :query => {
25
- :api_key => config[:push_api_key],
26
- :name => config[:name],
27
- :environment => config.respond_to?(:env) ? config.env : config[:environment],
28
- :hostname => config[:hostname],
29
- :gem_version => Appsignal::VERSION
30
- },
31
- :headers => { "Content-Type" => "application/x-ndjson; charset=UTF-8" }
32
- }
33
-
34
- request_stub =
35
- stub_request(
36
- :post,
37
- "#{config[:logging_endpoint]}/check_ins/json"
38
- ).with(options) do |request|
39
- # Parse each line as JSON per the NDJSON format
40
- payloads = request.body.split("\n").map { |line| JSON.parse(line) }
41
- formatted_events =
42
- events.map do |event|
43
- {
44
- "identifier" => nil,
45
- "digest" => kind_of(String),
46
- "kind" => "start",
47
- "timestamp" => kind_of(Integer),
48
- "check_in_type" => "cron"
49
- }.merge(event)
50
- end
51
- expect(payloads).to include(*formatted_events)
52
- end
53
-
54
- if response.is_a?(Exception)
55
- request_stub.to_raise(response)
56
- else
57
- request_stub.to_return(response)
58
- end
59
- end
60
- end
@@ -1,40 +0,0 @@
1
- require "appsignal/cli/helpers"
2
-
3
- module CLIHelpers
4
- def cli
5
- Appsignal::CLI
6
- end
7
-
8
- def run_cli(command, options = {})
9
- cli.run(format_cli_arguments_and_options(command, options))
10
- end
11
-
12
- def format_cli_arguments_and_options(command, options = {})
13
- [*command].tap do |o|
14
- options.each do |key, value|
15
- o << (value.nil? ? "--#{key}" : "--#{key}=#{value}")
16
- end
17
- end
18
- end
19
-
20
- def add_cli_input(value)
21
- $stdin.puts value
22
- end
23
-
24
- def prepare_cli_input
25
- # Prepare the input by rewinding the pointer in the StringIO
26
- $stdin.rewind
27
- end
28
-
29
- def colorize(*args)
30
- ColorizeHelper.colorize(*args)
31
- end
32
- end
33
-
34
- module ColorizeHelper
35
- extend Appsignal::CLI::Helpers
36
-
37
- def self.colorize(*_args)
38
- super
39
- end
40
- end
@@ -1,66 +0,0 @@
1
- module ConfigHelpers
2
- def project_fixture_path
3
- File.expand_path(
4
- File.join(File.dirname(__FILE__), "../fixtures/projects/valid")
5
- )
6
- end
7
- module_function :project_fixture_path
8
-
9
- def rails_project_fixture_path
10
- File.expand_path(
11
- File.join(File.dirname(__FILE__), "../fixtures/projects/valid_with_rails_app")
12
- )
13
- end
14
- module_function :rails_project_fixture_path
15
-
16
- def project_fixture_config(
17
- env = "production",
18
- options = {},
19
- logger = Appsignal.internal_logger
20
- )
21
- Appsignal::Config.new(
22
- project_fixture_path,
23
- env,
24
- logger
25
- ).tap do |c|
26
- c.merge_dsl_options(options)
27
- c.validate
28
- end
29
- end
30
- module_function :project_fixture_config
31
-
32
- def build_config(
33
- root_path: project_fixture_path,
34
- env: "production",
35
- options: {},
36
- logger: Appsignal.internal_logger
37
- )
38
- Appsignal::Config.new(
39
- root_path,
40
- env,
41
- logger
42
- ).tap do |c|
43
- c.merge_dsl_options(options) if options.any?
44
- c.validate
45
- end
46
- end
47
- module_function :build_config
48
-
49
- def start_agent(env: "production", options: {}, internal_logger: nil)
50
- env = "production" if env == :default
51
- env ||= "production"
52
- Appsignal.configure(env, :root_path => project_fixture_path) do |config|
53
- options.each do |option, value|
54
- config.send("#{option}=", value)
55
- end
56
- end
57
- Appsignal.start
58
- Appsignal.internal_logger = internal_logger if internal_logger
59
- end
60
-
61
- def clear_integration_env_vars!
62
- ENV.delete("RAILS_ENV")
63
- ENV.delete("RACK_ENV")
64
- ENV.delete("PADRINO_ENV")
65
- end
66
- end
@@ -1,155 +0,0 @@
1
- module DependencyHelper
2
- module_function
3
-
4
- def macos?
5
- RbConfig::CONFIG["host_os"].include?("darwin")
6
- end
7
-
8
- def ruby_version
9
- Gem::Version.new(RUBY_VERSION)
10
- end
11
-
12
- def ruby_3_1_or_newer?
13
- ruby_version >= Gem::Version.new("3.1.0")
14
- end
15
-
16
- def ruby_3_2_or_newer?
17
- ruby_version >= Gem::Version.new("3.2.0")
18
- end
19
-
20
- def running_jruby?
21
- Appsignal::System.jruby?
22
- end
23
-
24
- def rails_present?
25
- dependency_present? "rails"
26
- end
27
-
28
- def rails6_present?
29
- rails_present? && rails_version >= Gem::Version.new("6.0.0")
30
- end
31
-
32
- def rails6_1_present?
33
- rails_present? && rails_version >= Gem::Version.new("6.1.0")
34
- end
35
-
36
- def rails6_1_5_present?
37
- rails_present? && rails_version >= Gem::Version.new("6.1.5")
38
- end
39
-
40
- def rails7_present?
41
- rails_present? && rails_version >= Gem::Version.new("7.0.0")
42
- end
43
-
44
- def rails7_1_present?
45
- rails_present? && rails_version >= Gem::Version.new("7.1.0")
46
- end
47
-
48
- def active_job_wraps_args?
49
- rails7_present? || (ruby_3_1_or_newer? && rails6_1_present? && !rails6_1_5_present?)
50
- end
51
-
52
- def rails_version
53
- Gem.loaded_specs["rails"].version
54
- end
55
-
56
- def sequel_present?
57
- dependency_present? "sequel"
58
- end
59
-
60
- def resque_present?
61
- dependency_present? "resque"
62
- end
63
-
64
- def redis_client_present?
65
- dependency_present? "redis-client"
66
- end
67
-
68
- def hiredis_client_present?
69
- dependency_present? "hiredis-client"
70
- end
71
-
72
- def redis_present?
73
- dependency_present? "redis"
74
- end
75
-
76
- def action_cable_present?
77
- dependency_present? "actioncable"
78
- end
79
-
80
- def action_mailer_present?
81
- dependency_present? "actionmailer"
82
- end
83
-
84
- def active_job_present?
85
- dependency_present? "activejob"
86
- end
87
-
88
- def active_support_present?
89
- dependency_present? "activesupport"
90
- end
91
-
92
- def sinatra_present?
93
- dependency_present? "sinatra"
94
- end
95
-
96
- def padrino_present?
97
- dependency_present? "padrino"
98
- end
99
-
100
- def grape_present?
101
- dependency_present? "grape"
102
- end
103
-
104
- def webmachine_present?
105
- dependency_present? "webmachine"
106
- end
107
-
108
- def capistrano_present?
109
- dependency_present? "capistrano"
110
- end
111
-
112
- def capistrano2_present?
113
- capistrano_present? &&
114
- Gem.loaded_specs["capistrano"].version < Gem::Version.new("3.0")
115
- end
116
-
117
- def capistrano3_present?
118
- capistrano_present? &&
119
- Gem.loaded_specs["capistrano"].version >= Gem::Version.new("3.0")
120
- end
121
-
122
- def http_present?
123
- dependency_present? "http"
124
- end
125
-
126
- def que_present?
127
- dependency_present? "que"
128
- end
129
-
130
- def que2_present?
131
- que_present? &&
132
- Gem.loaded_specs["que"].version >= Gem::Version.new("2.0.0")
133
- end
134
-
135
- def hanami_present?
136
- dependency_present? "hanami"
137
- end
138
-
139
- def hanami2_1_present?
140
- hanami_present? &&
141
- Gem::Version.new(::Hanami::VERSION) >= Gem::Version.new("2.1.0")
142
- end
143
-
144
- def dry_monitor_present?
145
- dependency_present? "dry-monitor"
146
- end
147
-
148
- def hanami2_present?
149
- hanami_present? && Gem.loaded_specs["hanami"].version >= Gem::Version.new("2.0")
150
- end
151
-
152
- def dependency_present?(dependency_file)
153
- Gem.loaded_specs.key? dependency_file
154
- end
155
- end
@@ -1,27 +0,0 @@
1
- module DirectoryHelper
2
- module_function
3
-
4
- def project_dir
5
- @project_dir ||= File.expand_path("..", spec_dir)
6
- end
7
-
8
- def spec_dir
9
- APPSIGNAL_SPEC_DIR
10
- end
11
-
12
- def support_dir
13
- @support_dir ||= File.join(spec_dir, "support")
14
- end
15
-
16
- def tmp_dir
17
- @tmp_dir ||= File.join(spec_dir, "tmp")
18
- end
19
-
20
- def fixtures_dir
21
- @fixtures_dir ||= File.join(support_dir, "fixtures")
22
- end
23
-
24
- def resources_dir
25
- @resources_dir ||= File.join(project_dir, "resources")
26
- end
27
- end
@@ -1,41 +0,0 @@
1
- module EnvHelpers
2
- def http_request_env_with_data(args = {})
3
- with_queue_start = args.delete(:with_queue_start)
4
- path = args.delete(:path) || "/blog"
5
- request = Rack::MockRequest.env_for(
6
- path,
7
- :params => args[:params] || {
8
- "controller" => "blog_posts",
9
- "action" => "show",
10
- "id" => "1"
11
- }
12
- ).merge(
13
- :controller => "BlogPostsController",
14
- :action => "show",
15
- :request_format => "html",
16
- :request_method => "GET",
17
- :status => "200",
18
- :view_runtime => 500,
19
- :db_runtime => 500,
20
- :metadata => { :key => "value" }
21
- ).merge(args)
22
-
23
- # Set default queue value
24
- if with_queue_start
25
- request["HTTP_X_QUEUE_START"] = "t=#{(fixed_time * 1_000).to_i}" # in milliseconds
26
- end
27
-
28
- request
29
- end
30
-
31
- def background_env_with_data(args = {})
32
- {
33
- :class => "BackgroundJob",
34
- :method => "perform",
35
- :priority => 1,
36
- :attempts => 0,
37
- :queue => "default",
38
- :queue_start => fixed_time
39
- }.merge(args)
40
- end
41
- end
@@ -1,16 +0,0 @@
1
- module EnvironmentMetadataHelper
2
- def capture_environment_metadata_report_calls
3
- allow(Appsignal::Extension).to receive(:set_environment_metadata)
4
- .and_call_original
5
- end
6
-
7
- def expect_environment_metadata(key, value)
8
- expect(Appsignal::Extension).to have_received(:set_environment_metadata)
9
- .with(key, value)
10
- end
11
-
12
- def expect_not_environment_metadata(key)
13
- expect(Appsignal::Extension).to_not have_received(:set_environment_metadata)
14
- .with(key, anything)
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- # This ExampleException is used for throwing Exceptions in specs that are
2
- # allowed or expected.
3
- #
4
- # For example, this error can be thrown to raise an exception in AppSignal's
5
- # run, which should stop the program and the appsignal gem, but not crash the
6
- # test suite.
7
- #
8
- # There's also {ExampleStandardError}, use this when you need to test against
9
- # StandardError-level Ruby exceptions.
10
- #
11
- # @see ExampleStandardError
12
- class ExampleException < Exception # rubocop:disable Lint/InheritException
13
- end
@@ -1,13 +0,0 @@
1
- # This ExampleStandardError is used for throwing errors in specs that are
2
- # allowed or expected.
3
- #
4
- # For example, this error can be thrown to raise an exception in AppSignal's
5
- # run, which should stop the program and the appsignal gem, but not crash the
6
- # test suite.
7
- #
8
- # There's also {ExampleException}, use this when you need to test against
9
- # Exception-level Ruby exceptions.
10
- #
11
- # @see ExampleException
12
- class ExampleStandardError < StandardError
13
- end
@@ -1,21 +0,0 @@
1
- module LoaderHelper
2
- def load_loader(name)
3
- Appsignal.load(name)
4
- end
5
-
6
- def start_loader(name)
7
- Appsignal::Loaders.instances.fetch(name).on_start
8
- end
9
-
10
- def unregister_loader(name)
11
- Appsignal::Loaders.unregister(name)
12
- end
13
-
14
- def define_loader(name, &block)
15
- Appsignal::Testing.registered_loaders << name
16
- Class.new(Appsignal::Loaders::Loader) do
17
- register name
18
- class_eval(&block) if block_given?
19
- end
20
- end
21
- end
@@ -1,36 +0,0 @@
1
- module LogHelpers
2
- def capture_logs(&block)
3
- log = std_stream
4
- use_logger_with(log, &block)
5
- log_contents(log)
6
- end
7
-
8
- def use_logger_with(log)
9
- Appsignal.internal_logger = test_logger(log)
10
- yield
11
- ensure
12
- Appsignal.internal_logger = nil
13
- end
14
-
15
- def test_logger(log)
16
- Appsignal::Utils::IntegrationLogger.new(log).tap do |logger|
17
- logger.formatter = logger_formatter
18
- end
19
- end
20
-
21
- def logger_formatter
22
- proc do |severity, _datetime, _progname, msg|
23
- log_line(severity, msg)
24
- end
25
- end
26
-
27
- def log_line(severity, message)
28
- # This format is used in the `contains_log` matcher.
29
- "[#{severity}] #{message}\n"
30
- end
31
-
32
- def log_contents(log)
33
- log.rewind
34
- log.read
35
- end
36
- end
@@ -1,28 +0,0 @@
1
- module RailsHelper
2
- def run_appsignal_railtie
3
- app = MyApp::Application.new
4
- Appsignal::Integrations::Railtie.initializers.each do |initializer|
5
- initializer.run(app)
6
- end
7
- ActiveSupport.run_load_hooks(:after_initialize, app)
8
- end
9
-
10
- def with_rails_error_reporter
11
- if Rails.respond_to? :error
12
- clear_rails_error_reporter!
13
- Appsignal::Integrations::Railtie.initialize_error_reporter
14
- end
15
- yield
16
- ensure
17
- clear_rails_error_reporter!
18
- end
19
-
20
- def clear_rails_error_reporter!
21
- return unless Rails.respond_to? :error
22
-
23
- Rails
24
- .error
25
- .instance_variable_get(:@subscribers)
26
- .reject! { |s| s == Appsignal::Integrations::RailsErrorReporterSubscriber }
27
- end
28
- end