appsignal 3.12.6 → 4.0.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +499 -487
  3. data/CHANGELOG.md +151 -0
  4. data/Rakefile +31 -7
  5. data/benchmark.rake +4 -6
  6. data/build_matrix.yml +45 -39
  7. data/ext/agent.rb +27 -27
  8. data/ext/appsignal_extension.c +25 -0
  9. data/gemfiles/rails-7.2.gemfile +11 -0
  10. data/lib/appsignal/check_in/cron.rb +67 -0
  11. data/lib/appsignal/check_in.rb +46 -0
  12. data/lib/appsignal/cli/diagnose.rb +37 -28
  13. data/lib/appsignal/cli/install.rb +5 -1
  14. data/lib/appsignal/config.rb +57 -119
  15. data/lib/appsignal/demo.rb +2 -2
  16. data/lib/appsignal/extension/jruby.rb +14 -0
  17. data/lib/appsignal/helpers/instrumentation.rb +139 -414
  18. data/lib/appsignal/helpers/metrics.rb +0 -16
  19. data/lib/appsignal/hooks/action_cable.rb +8 -8
  20. data/lib/appsignal/hooks/active_job.rb +2 -2
  21. data/lib/appsignal/hooks/at_exit.rb +37 -0
  22. data/lib/appsignal/hooks.rb +1 -16
  23. data/lib/appsignal/integrations/action_cable.rb +2 -2
  24. data/lib/appsignal/integrations/capistrano/appsignal.cap +2 -4
  25. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +1 -4
  26. data/lib/appsignal/integrations/delayed_job_plugin.rb +3 -3
  27. data/lib/appsignal/integrations/http.rb +2 -7
  28. data/lib/appsignal/integrations/que.rb +2 -2
  29. data/lib/appsignal/integrations/railtie.rb +26 -59
  30. data/lib/appsignal/integrations/rake.rb +2 -2
  31. data/lib/appsignal/integrations/resque.rb +2 -2
  32. data/lib/appsignal/integrations/shoryuken.rb +4 -4
  33. data/lib/appsignal/integrations/sidekiq.rb +3 -3
  34. data/lib/appsignal/integrations/webmachine.rb +2 -2
  35. data/lib/appsignal/loaders.rb +1 -1
  36. data/lib/appsignal/probes.rb +0 -9
  37. data/lib/appsignal/rack/abstract_middleware.rb +4 -26
  38. data/lib/appsignal/rack/event_handler.rb +4 -4
  39. data/lib/appsignal/rack/rails_instrumentation.rb +1 -1
  40. data/lib/appsignal/rack.rb +0 -25
  41. data/lib/appsignal/sample_data.rb +95 -0
  42. data/lib/appsignal/transaction.rb +235 -361
  43. data/lib/appsignal/utils/rails_helper.rb +4 -0
  44. data/lib/appsignal/version.rb +1 -1
  45. data/lib/appsignal.rb +20 -62
  46. data/spec/lib/appsignal/auth_check_spec.rb +1 -1
  47. data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
  48. data/spec/lib/appsignal/capistrano3_spec.rb +53 -13
  49. data/spec/lib/appsignal/{heartbeat_spec.rb → check_in_spec.rb} +45 -36
  50. data/spec/lib/appsignal/cli/demo_spec.rb +7 -27
  51. data/spec/lib/appsignal/cli/diagnose_spec.rb +145 -110
  52. data/spec/lib/appsignal/config_spec.rb +304 -379
  53. data/spec/lib/appsignal/extension_install_failure_spec.rb +5 -1
  54. data/spec/lib/appsignal/extension_spec.rb +5 -1
  55. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +1 -1
  56. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +1 -2
  57. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +1 -0
  58. data/spec/lib/appsignal/hooks/activejob_spec.rb +7 -12
  59. data/spec/lib/appsignal/hooks/at_exit_spec.rb +72 -0
  60. data/spec/lib/appsignal/hooks/gvl_spec.rb +10 -5
  61. data/spec/lib/appsignal/hooks/http_spec.rb +3 -3
  62. data/spec/lib/appsignal/hooks/net_http_spec.rb +3 -3
  63. data/spec/lib/appsignal/hooks/rake_spec.rb +6 -9
  64. data/spec/lib/appsignal/hooks/redis_client_spec.rb +5 -10
  65. data/spec/lib/appsignal/hooks/redis_spec.rb +4 -7
  66. data/spec/lib/appsignal/hooks/resque_spec.rb +3 -5
  67. data/spec/lib/appsignal/hooks_spec.rb +0 -41
  68. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +29 -20
  69. data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +4 -9
  70. data/spec/lib/appsignal/integrations/http_spec.rb +0 -21
  71. data/spec/lib/appsignal/integrations/railtie_spec.rb +179 -157
  72. data/spec/lib/appsignal/integrations/shoryuken_spec.rb +3 -5
  73. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +48 -62
  74. data/spec/lib/appsignal/loaders/hanami_spec.rb +6 -9
  75. data/spec/lib/appsignal/loaders/padrino_spec.rb +6 -10
  76. data/spec/lib/appsignal/loaders/sinatra_spec.rb +6 -9
  77. data/spec/lib/appsignal/loaders_spec.rb +8 -1
  78. data/spec/lib/appsignal/marker_spec.rb +1 -1
  79. data/spec/lib/appsignal/probes_spec.rb +4 -83
  80. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +4 -63
  81. data/spec/lib/appsignal/rack/event_handler_spec.rb +18 -15
  82. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +3 -11
  83. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +4 -5
  84. data/spec/lib/appsignal/sample_data_spec.rb +174 -0
  85. data/spec/lib/appsignal/transaction_spec.rb +791 -1031
  86. data/spec/lib/appsignal/transmitter_spec.rb +6 -8
  87. data/spec/lib/appsignal_spec.rb +294 -643
  88. data/spec/spec_helper.rb +1 -3
  89. data/spec/support/fixtures/projects/valid/config/appsignal.yml +4 -7
  90. data/spec/support/fixtures/projects/valid_with_rails_app/config/application.rb +16 -0
  91. data/spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml +56 -0
  92. data/spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb +5 -0
  93. data/spec/support/helpers/api_request_helper.rb +3 -2
  94. data/spec/support/helpers/config_helpers.rb +41 -11
  95. data/spec/support/helpers/dependency_helper.rb +8 -0
  96. data/spec/support/helpers/log_helpers.rb +1 -0
  97. data/spec/support/helpers/rails_helper.rb +6 -6
  98. data/spec/support/helpers/transaction_helpers.rb +2 -24
  99. data/spec/support/matchers/transaction.rb +3 -3
  100. data/spec/support/mocks/appsignal_mock.rb +3 -3
  101. data/spec/support/mocks/mock_probe.rb +2 -0
  102. data/spec/support/testing.rb +2 -2
  103. metadata +14 -23
  104. data/gemfiles/que_beta.gemfile +0 -5
  105. data/lib/appsignal/heartbeat.rb +0 -59
  106. data/lib/appsignal/helpers/heartbeats.rb +0 -44
  107. data/lib/appsignal/integrations/grape.rb +0 -35
  108. data/lib/appsignal/integrations/hanami.rb +0 -13
  109. data/lib/appsignal/integrations/padrino.rb +0 -13
  110. data/lib/appsignal/integrations/sinatra.rb +0 -13
  111. data/lib/appsignal/rack/generic_instrumentation.rb +0 -22
  112. data/lib/appsignal/rack/streaming_listener.rb +0 -28
  113. data/spec/lib/appsignal/integrations/grape_spec.rb +0 -36
  114. data/spec/lib/appsignal/integrations/hanami_spec.rb +0 -17
  115. data/spec/lib/appsignal/integrations/padrino_spec.rb +0 -15
  116. data/spec/lib/appsignal/integrations/sinatra_spec.rb +0 -15
  117. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +0 -81
  118. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +0 -69
  119. data/spec/support/fixtures/projects/valid/config/environments/development.rb +0 -0
  120. data/spec/support/fixtures/projects/valid/config/environments/production.rb +0 -0
  121. data/spec/support/fixtures/projects/valid/config/environments/test.rb +0 -0
  122. data/spec/support/rails/my_app.rb +0 -6
  123. /data/spec/support/fixtures/projects/{valid/config/application.rb → valid_with_rails_app/log/.gitkeep} +0 -0
data/spec/spec_helper.rb CHANGED
@@ -25,9 +25,7 @@ Dir[File.join(APPSIGNAL_SPEC_DIR, "support/shared_examples", "*.rb")].sort.each
25
25
  require f
26
26
  end
27
27
  if DependencyHelper.rails_present?
28
- Dir[File.join(DirectoryHelper.support_dir, "rails", "*.rb")].sort.each do |f|
29
- require f
30
- end
28
+ require File.join(ConfigHelpers.rails_project_fixture_path, "config/application.rb")
31
29
  end
32
30
  if DependencyHelper.hanami2_present?
33
31
  Dir[File.join(DirectoryHelper.support_dir, "hanami", "*.rb")].sort.each do |f|
@@ -1,13 +1,6 @@
1
1
  default: &defaults
2
2
  push_api_key: "abc"
3
3
  name: "TestApp"
4
- request_headers: [
5
- "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING",
6
- "HTTP_ACCEPT_LANGUAGE", "HTTP_CACHE_CONTROL", "HTTP_CONNECTION",
7
- "CONTENT_LENGTH", "PATH_INFO", "HTTP_RANGE", "HTTP_REFERER",
8
- "REQUEST_METHOD", "REQUEST_PATH", "SERVER_NAME", "SERVER_PORT",
9
- "SERVER_PROTOCOL", "HTTP_USER_AGENT"
10
- ]
11
4
  enable_minutely_probes: false
12
5
 
13
6
  production:
@@ -58,3 +51,7 @@ rack_env:
58
51
 
59
52
  rails_env:
60
53
  <<: *defaults
54
+
55
+ inactive_env:
56
+ <<: *defaults
57
+ active: false
@@ -0,0 +1,16 @@
1
+ require "rails"
2
+
3
+ module MyApp
4
+ class Application < Rails::Application
5
+ config.active_support.deprecation = proc { |message, stack| }
6
+ config.eager_load = false
7
+
8
+ def self.initialize!
9
+ # Prevent errors about Rails being initialized more than once
10
+ return if defined?(@initialized)
11
+
12
+ super
13
+ @initialized = true
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,56 @@
1
+ default: &defaults
2
+ push_api_key: "abc"
3
+ name: "TestApp"
4
+ enable_minutely_probes: false
5
+
6
+ production:
7
+ <<: *defaults
8
+ active: true
9
+
10
+ development:
11
+ <<: *defaults
12
+ active: true
13
+
14
+ test:
15
+ <<: *defaults
16
+ log_level: debug
17
+ active: true
18
+
19
+ old_config:
20
+ api_key: "def"
21
+ active: true
22
+ ignore_exceptions:
23
+ - StandardError
24
+ request_headers: [
25
+ "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING",
26
+ "HTTP_ACCEPT_LANGUAGE", "HTTP_CACHE_CONTROL", "HTTP_CONNECTION",
27
+ "CONTENT_LENGTH", "PATH_INFO", "HTTP_RANGE", "HTTP_REFERER",
28
+ "REQUEST_METHOD", "REQUEST_PATH", "SERVER_NAME", "SERVER_PORT",
29
+ "SERVER_PROTOCOL", "HTTP_USER_AGENT"
30
+ ]
31
+
32
+ old_config_mixed_with_new_config:
33
+ push_api_key: "ghi"
34
+ api_key: "def"
35
+ active: true
36
+ ignore_errors:
37
+ - NoMethodError
38
+ ignore_exceptions:
39
+ - StandardError
40
+ request_headers: [
41
+ "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING",
42
+ "HTTP_ACCEPT_LANGUAGE", "HTTP_CACHE_CONTROL", "HTTP_CONNECTION",
43
+ "CONTENT_LENGTH", "PATH_INFO", "HTTP_RANGE", "HTTP_REFERER",
44
+ "REQUEST_METHOD", "REQUEST_PATH", "SERVER_NAME", "SERVER_PORT",
45
+ "SERVER_PROTOCOL", "HTTP_USER_AGENT"
46
+ ]
47
+
48
+ rack_env:
49
+ <<: *defaults
50
+
51
+ rails_env:
52
+ <<: *defaults
53
+
54
+ inactive_env:
55
+ <<: *defaults
56
+ active: false
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative "application"
3
+
4
+ # Initialize the Rails application.
5
+ MyApp::Application.initialize!
@@ -4,7 +4,7 @@ module ApiRequestHelper
4
4
  :query => {
5
5
  :api_key => config[:push_api_key],
6
6
  :name => config[:name],
7
- :environment => config.env,
7
+ :environment => config.respond_to?(:env) ? config.env : config[:environment],
8
8
  :hostname => config[:hostname],
9
9
  :gem_version => Appsignal::VERSION
10
10
  },
@@ -14,6 +14,7 @@ module ApiRequestHelper
14
14
  }
15
15
  body = Appsignal::Utils::JSON.generate(body) if body.is_a? Hash
16
16
  options[:body] = body if body
17
- stub_request(:post, "#{config[:endpoint]}/1/#{path}").with(options)
17
+ endpoint = config[:endpoint] || Appsignal::Config::DEFAULT_CONFIG[:endpoint]
18
+ stub_request(:post, "#{endpoint}/1/#{path}").with(options)
18
19
  end
19
20
  end
@@ -6,24 +6,54 @@ module ConfigHelpers
6
6
  end
7
7
  module_function :project_fixture_path
8
8
 
9
- def project_fixture_config( # rubocop:disable Metrics/ParameterLists
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(
10
17
  env = "production",
11
- initial_config = {},
12
- logger = Appsignal.internal_logger,
13
- config_file = nil
18
+ options = {},
19
+ logger = Appsignal.internal_logger
14
20
  )
15
21
  Appsignal::Config.new(
16
22
  project_fixture_path,
17
23
  env,
18
- initial_config,
19
- logger,
20
- config_file
21
- )
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
22
46
  end
23
- module_function :project_fixture_config, :project_fixture_path
47
+ module_function :build_config
24
48
 
25
- def start_agent(env = "production")
26
- Appsignal._config = project_fixture_config(env)
49
+ def start_agent(env: "production", options: {})
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
27
57
  Appsignal.start
28
58
  end
29
59
 
@@ -1,6 +1,10 @@
1
1
  module DependencyHelper
2
2
  module_function
3
3
 
4
+ def macos?
5
+ RbConfig::CONFIG["host_os"].include?("darwin")
6
+ end
7
+
4
8
  def ruby_version
5
9
  Gem::Version.new(RUBY_VERSION)
6
10
  end
@@ -37,6 +41,10 @@ module DependencyHelper
37
41
  rails_present? && rails_version >= Gem::Version.new("7.0.0")
38
42
  end
39
43
 
44
+ def rails7_1_present?
45
+ rails_present? && rails_version >= Gem::Version.new("7.1.0")
46
+ end
47
+
40
48
  def active_job_wraps_args?
41
49
  rails7_present? || (ruby_3_1_or_newer? && rails6_1_present? && !rails6_1_5_present?)
42
50
  end
@@ -8,6 +8,7 @@ module LogHelpers
8
8
  def use_logger_with(log)
9
9
  Appsignal.internal_logger = test_logger(log)
10
10
  yield
11
+ ensure
11
12
  Appsignal.internal_logger = nil
12
13
  end
13
14
 
@@ -1,10 +1,10 @@
1
1
  module RailsHelper
2
- def with_railtie(app)
3
- clear_rails_error_reporter! if Rails.respond_to? :error
4
- Appsignal::Integrations::Railtie.initialize_appsignal(app)
5
- yield
6
- ensure
7
- clear_rails_error_reporter!
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
8
  end
9
9
 
10
10
  def with_rails_error_reporter
@@ -15,30 +15,8 @@ module TransactionHelpers
15
15
  Appsignal::Transaction.create(namespace)
16
16
  end
17
17
 
18
- def new_transaction(namespace = default_namespace)
19
- Appsignal::Transaction.new(SecureRandom.uuid, namespace)
20
- end
21
-
22
- def legacy_create_transaction(
23
- id: "mock_transaction_id",
24
- namespace: "mock_namespace",
25
- request: legacy_request,
26
- options: {}
27
- )
28
- Appsignal::Transaction.create(id, namespace, request, options)
29
- end
30
-
31
- def legacy_new_transaction(
32
- id: "mock_transaction_id",
33
- namespace: "mock_namespace",
34
- request: legacy_request,
35
- options: {}
36
- )
37
- Appsignal::Transaction.new(id, namespace, request, options)
38
- end
39
-
40
- def legacy_request(env = {})
41
- Appsignal::Transaction::InternalGenericRequest.new(env)
18
+ def new_transaction(namespace = default_namespace, ext: nil)
19
+ Appsignal::Transaction.new(SecureRandom.uuid, namespace, :ext => ext)
42
20
  end
43
21
 
44
22
  def rack_request(env)
@@ -171,9 +171,9 @@ RSpec::Matchers.define :include_breadcrumb do |action, category, message, metada
171
171
  {
172
172
  "action" => action,
173
173
  "category" => category,
174
- "message" => message,
175
- "metadata" => metadata,
176
- "time" => time
174
+ "message" => message || "",
175
+ "metadata" => metadata || {},
176
+ "time" => time || kind_of(Integer)
177
177
  }
178
178
  end
179
179
  end
@@ -7,9 +7,9 @@ class AppsignalMock
7
7
  end
8
8
 
9
9
  def config
10
- ConfigHelpers.project_fixture_config.tap do |conf|
11
- conf[:hostname] = @hostname if @hostname
12
- end
10
+ options = {}
11
+ options[:hostname] = @hostname if @hostname
12
+ ConfigHelpers.build_config(:options => options)
13
13
  end
14
14
 
15
15
  def set_gauge(*args)
@@ -2,10 +2,12 @@ class MockProbe
2
2
  attr_reader :calls
3
3
 
4
4
  def initialize
5
+ Appsignal::Testing.store[:mock_probe_call] = 0
5
6
  @calls = 0
6
7
  end
7
8
 
8
9
  def call
10
+ Appsignal::Testing.store[:mock_probe_call] += 1
9
11
  @calls += 1
10
12
  end
11
13
  end
@@ -171,7 +171,7 @@ module AppsignalTest
171
171
  # transactions are created on the {Appsignal::Testing.transactions} list.
172
172
  #
173
173
  # @see TransactionHelpers#last_transaction
174
- def new(*_args)
174
+ def new(...)
175
175
  transaction = super
176
176
  Appsignal::Testing.transactions << transaction
177
177
  transaction
@@ -180,7 +180,7 @@ module AppsignalTest
180
180
 
181
181
  module InstanceMethods
182
182
  def _sample
183
- _sample_data
183
+ sample_data
184
184
  end
185
185
  end
186
186
  end
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: 3.12.6
4
+ version: 4.0.0.beta.1
5
5
  platform: ruby
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: 2024-08-05 00:00:00.000000000 Z
13
+ date: 2024-08-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -171,11 +171,11 @@ files:
171
171
  - gemfiles/psych-3.gemfile
172
172
  - gemfiles/psych-4.gemfile
173
173
  - gemfiles/que.gemfile
174
- - gemfiles/que_beta.gemfile
175
174
  - gemfiles/rails-6.0.gemfile
176
175
  - gemfiles/rails-6.1.gemfile
177
176
  - gemfiles/rails-7.0.gemfile
178
177
  - gemfiles/rails-7.1.gemfile
178
+ - gemfiles/rails-7.2.gemfile
179
179
  - gemfiles/redis-4.gemfile
180
180
  - gemfiles/redis-5.gemfile
181
181
  - gemfiles/resque-2.gemfile
@@ -186,6 +186,8 @@ files:
186
186
  - lib/appsignal.rb
187
187
  - lib/appsignal/auth_check.rb
188
188
  - lib/appsignal/capistrano.rb
189
+ - lib/appsignal/check_in.rb
190
+ - lib/appsignal/check_in/cron.rb
189
191
  - lib/appsignal/cli.rb
190
192
  - lib/appsignal/cli/demo.rb
191
193
  - lib/appsignal/cli/diagnose.rb
@@ -209,8 +211,6 @@ files:
209
211
  - lib/appsignal/extension.rb
210
212
  - lib/appsignal/extension/jruby.rb
211
213
  - lib/appsignal/garbage_collection.rb
212
- - lib/appsignal/heartbeat.rb
213
- - lib/appsignal/helpers/heartbeats.rb
214
214
  - lib/appsignal/helpers/instrumentation.rb
215
215
  - lib/appsignal/helpers/metrics.rb
216
216
  - lib/appsignal/hooks.rb
@@ -218,6 +218,7 @@ files:
218
218
  - lib/appsignal/hooks/action_mailer.rb
219
219
  - lib/appsignal/hooks/active_job.rb
220
220
  - lib/appsignal/hooks/active_support_notifications.rb
221
+ - lib/appsignal/hooks/at_exit.rb
221
222
  - lib/appsignal/hooks/celluloid.rb
222
223
  - lib/appsignal/hooks/data_mapper.rb
223
224
  - lib/appsignal/hooks/delayed_job.rb
@@ -248,13 +249,10 @@ files:
248
249
  - lib/appsignal/integrations/delayed_job_plugin.rb
249
250
  - lib/appsignal/integrations/dry_monitor.rb
250
251
  - lib/appsignal/integrations/excon.rb
251
- - lib/appsignal/integrations/grape.rb
252
- - lib/appsignal/integrations/hanami.rb
253
252
  - lib/appsignal/integrations/http.rb
254
253
  - lib/appsignal/integrations/mongo_ruby_driver.rb
255
254
  - lib/appsignal/integrations/net_http.rb
256
255
  - lib/appsignal/integrations/object.rb
257
- - lib/appsignal/integrations/padrino.rb
258
256
  - lib/appsignal/integrations/que.rb
259
257
  - lib/appsignal/integrations/railtie.rb
260
258
  - lib/appsignal/integrations/rake.rb
@@ -263,7 +261,6 @@ files:
263
261
  - lib/appsignal/integrations/resque.rb
264
262
  - lib/appsignal/integrations/shoryuken.rb
265
263
  - lib/appsignal/integrations/sidekiq.rb
266
- - lib/appsignal/integrations/sinatra.rb
267
264
  - lib/appsignal/integrations/unicorn.rb
268
265
  - lib/appsignal/integrations/webmachine.rb
269
266
  - lib/appsignal/loaders.rb
@@ -282,13 +279,12 @@ files:
282
279
  - lib/appsignal/rack/abstract_middleware.rb
283
280
  - lib/appsignal/rack/body_wrapper.rb
284
281
  - lib/appsignal/rack/event_handler.rb
285
- - lib/appsignal/rack/generic_instrumentation.rb
286
282
  - lib/appsignal/rack/grape_middleware.rb
287
283
  - lib/appsignal/rack/hanami_middleware.rb
288
284
  - lib/appsignal/rack/instrumentation_middleware.rb
289
285
  - lib/appsignal/rack/rails_instrumentation.rb
290
286
  - lib/appsignal/rack/sinatra_instrumentation.rb
291
- - lib/appsignal/rack/streaming_listener.rb
287
+ - lib/appsignal/sample_data.rb
292
288
  - lib/appsignal/span.rb
293
289
  - lib/appsignal/system.rb
294
290
  - lib/appsignal/transaction.rb
@@ -312,6 +308,7 @@ files:
312
308
  - spec/lib/appsignal/auth_check_spec.rb
313
309
  - spec/lib/appsignal/capistrano2_spec.rb
314
310
  - spec/lib/appsignal/capistrano3_spec.rb
311
+ - spec/lib/appsignal/check_in_spec.rb
315
312
  - spec/lib/appsignal/cli/demo_spec.rb
316
313
  - spec/lib/appsignal/cli/diagnose/paths_spec.rb
317
314
  - spec/lib/appsignal/cli/diagnose/utils_spec.rb
@@ -336,7 +333,6 @@ files:
336
333
  - spec/lib/appsignal/extension_install_failure_spec.rb
337
334
  - spec/lib/appsignal/extension_spec.rb
338
335
  - spec/lib/appsignal/garbage_collection_spec.rb
339
- - spec/lib/appsignal/heartbeat_spec.rb
340
336
  - spec/lib/appsignal/hooks/action_cable_spec.rb
341
337
  - spec/lib/appsignal/hooks/action_mailer_spec.rb
342
338
  - spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
@@ -344,6 +340,7 @@ files:
344
340
  - spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
345
341
  - spec/lib/appsignal/hooks/active_support_notifications_spec.rb
346
342
  - spec/lib/appsignal/hooks/activejob_spec.rb
343
+ - spec/lib/appsignal/hooks/at_exit_spec.rb
347
344
  - spec/lib/appsignal/hooks/celluloid_spec.rb
348
345
  - spec/lib/appsignal/hooks/data_mapper_spec.rb
349
346
  - spec/lib/appsignal/hooks/delayed_job_spec.rb
@@ -369,18 +366,14 @@ files:
369
366
  - spec/lib/appsignal/hooks_spec.rb
370
367
  - spec/lib/appsignal/integrations/data_mapper_spec.rb
371
368
  - spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb
372
- - spec/lib/appsignal/integrations/grape_spec.rb
373
- - spec/lib/appsignal/integrations/hanami_spec.rb
374
369
  - spec/lib/appsignal/integrations/http_spec.rb
375
370
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
376
371
  - spec/lib/appsignal/integrations/net_http_spec.rb
377
372
  - spec/lib/appsignal/integrations/object_spec.rb
378
- - spec/lib/appsignal/integrations/padrino_spec.rb
379
373
  - spec/lib/appsignal/integrations/que_spec.rb
380
374
  - spec/lib/appsignal/integrations/railtie_spec.rb
381
375
  - spec/lib/appsignal/integrations/shoryuken_spec.rb
382
376
  - spec/lib/appsignal/integrations/sidekiq_spec.rb
383
- - spec/lib/appsignal/integrations/sinatra_spec.rb
384
377
  - spec/lib/appsignal/integrations/webmachine_spec.rb
385
378
  - spec/lib/appsignal/loaders/grape_spec.rb
386
379
  - spec/lib/appsignal/loaders/hanami_spec.rb
@@ -396,14 +389,13 @@ files:
396
389
  - spec/lib/appsignal/rack/abstract_middleware_spec.rb
397
390
  - spec/lib/appsignal/rack/body_wrapper_spec.rb
398
391
  - spec/lib/appsignal/rack/event_handler_spec.rb
399
- - spec/lib/appsignal/rack/generic_instrumentation_spec.rb
400
392
  - spec/lib/appsignal/rack/grape_middleware_spec.rb
401
393
  - spec/lib/appsignal/rack/hanami_middleware_spec.rb
402
394
  - spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
403
395
  - spec/lib/appsignal/rack/rails_instrumentation_spec.rb
404
396
  - spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
405
- - spec/lib/appsignal/rack/streaming_listener_spec.rb
406
397
  - spec/lib/appsignal/rack_spec.rb
398
+ - spec/lib/appsignal/sample_data_spec.rb
407
399
  - spec/lib/appsignal/span_spec.rb
408
400
  - spec/lib/appsignal/system_spec.rb
409
401
  - spec/lib/appsignal/transaction_spec.rb
@@ -419,12 +411,12 @@ files:
419
411
  - spec/spec_helper.rb
420
412
  - spec/support/fixtures/generated_config.yml
421
413
  - spec/support/fixtures/projects/broken/config/appsignal.yml
422
- - spec/support/fixtures/projects/valid/config/application.rb
423
414
  - spec/support/fixtures/projects/valid/config/appsignal.yml
424
- - spec/support/fixtures/projects/valid/config/environments/development.rb
425
- - spec/support/fixtures/projects/valid/config/environments/production.rb
426
- - spec/support/fixtures/projects/valid/config/environments/test.rb
427
415
  - spec/support/fixtures/projects/valid/log/.gitkeep
416
+ - spec/support/fixtures/projects/valid_with_rails_app/config/application.rb
417
+ - spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml
418
+ - spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb
419
+ - spec/support/fixtures/projects/valid_with_rails_app/log/.gitkeep
428
420
  - spec/support/fixtures/uploaded_file.txt
429
421
  - spec/support/hanami/hanami_app.rb
430
422
  - spec/support/helpers/action_mailer_helpers.rb
@@ -454,7 +446,6 @@ files:
454
446
  - spec/support/mocks/fake_gc_profiler.rb
455
447
  - spec/support/mocks/fake_gvl_tools.rb
456
448
  - spec/support/mocks/mock_probe.rb
457
- - spec/support/rails/my_app.rb
458
449
  - spec/support/shared_examples/instrument.rb
459
450
  - spec/support/stubs/appsignal/loaders/loader_stub.rb
460
451
  - spec/support/stubs/delayed_job.rb
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'que', '1.0.0.beta3'
4
-
5
- gemspec :path => '../'
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appsignal
4
- class Heartbeat
5
- class << self
6
- # @api private
7
- def transmitter
8
- @transmitter ||= Appsignal::Transmitter.new(
9
- "#{Appsignal.config[:logging_endpoint]}/heartbeats/json"
10
- )
11
- end
12
- end
13
-
14
- attr_reader :name, :id
15
-
16
- def initialize(name:)
17
- @name = name
18
- @id = SecureRandom.hex(8)
19
- end
20
-
21
- def start
22
- transmit_event("start")
23
- end
24
-
25
- def finish
26
- transmit_event("finish")
27
- end
28
-
29
- private
30
-
31
- def event(kind)
32
- {
33
- :name => name,
34
- :id => @id,
35
- :kind => kind,
36
- :timestamp => Time.now.utc.to_i
37
- }
38
- end
39
-
40
- def transmit_event(kind)
41
- unless Appsignal.active?
42
- Appsignal.internal_logger.debug("AppSignal not active, not transmitting heartbeat event")
43
- return
44
- end
45
-
46
- response = self.class.transmitter.transmit(event(kind))
47
-
48
- if response.code.to_i >= 200 && response.code.to_i < 300
49
- Appsignal.internal_logger.debug("Transmitted heartbeat `#{name}` (#{id}) #{kind} event")
50
- else
51
- Appsignal.internal_logger.error(
52
- "Failed to transmit heartbeat event: status code was #{response.code}"
53
- )
54
- end
55
- rescue => e
56
- Appsignal.internal_logger.error("Failed to transmit heartbeat event: #{e}")
57
- end
58
- end
59
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appsignal
4
- module Helpers
5
- module Heartbeats
6
- # Track heartbeats
7
- #
8
- # Track the execution of certain processes by sending a hearbeat.
9
- #
10
- # To track the duration of a piece of code, pass a block to {.heartbeat}
11
- # to report both when the process starts, and when it finishes.
12
- #
13
- # If an exception is raised within the block, the finish event will not
14
- # be reported, triggering a notification about the missing heartbeat. The
15
- # exception will bubble outside of the heartbeat block.
16
- #
17
- # @example Send a heartbeat
18
- # Appsignal.heartbeat("send_invoices")
19
- #
20
- # @example Send a heartbeat with duration
21
- # Appsignal.heartbeat("send_invoices") do
22
- # # your code
23
- # end
24
- #
25
- # @param name [String] name of the heartbeat to report.
26
- # @yield the block to monitor.
27
- # @return [void]
28
- # @since 3.7.0
29
- # @see https://docs.appsignal.com/heartbeats
30
- def heartbeat(name)
31
- heartbeat = Appsignal::Heartbeat.new(:name => name)
32
- output = nil
33
-
34
- if block_given?
35
- heartbeat.start
36
- output = yield
37
- end
38
-
39
- heartbeat.finish
40
- output
41
- end
42
- end
43
- end
44
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "appsignal"
4
- require "appsignal/rack/grape_middleware"
5
-
6
- Appsignal::Utils::StdoutAndLoggerMessage.warning(
7
- "The 'require \"appsignal/integrations/grape\"' file require integration " \
8
- "method is deprecated. " \
9
- "Please follow the Grape setup guide in our docs for the new method: " \
10
- "https://docs.appsignal.com/ruby/integrations/grape.html"
11
- )
12
-
13
- Appsignal.internal_logger.debug("Loading Grape integration")
14
-
15
- module Appsignal
16
- # @api private
17
- module Grape
18
- # Alias constants that have moved with a warning message that points to the
19
- # place to update the reference.
20
- def self.const_missing(name)
21
- case name
22
- when :Middleware
23
- callers = caller
24
- Appsignal::Utils::StdoutAndLoggerMessage.warning \
25
- "The constant Appsignal::Grape::Middleware has been deprecated. " \
26
- "Please update the constant name to " \
27
- "Appsignal::Rack::GrapeMiddleware in the following file to " \
28
- "remove this message.\n#{callers.first}"
29
- Appsignal::Rack::GrapeMiddleware
30
- else
31
- super
32
- end
33
- end
34
- end
35
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "appsignal"
4
-
5
- Appsignal::Utils::StdoutAndLoggerMessage.warning(
6
- "The 'require \"appsignal/integrations/hanami\"' file require integration " \
7
- "method is deprecated. " \
8
- "Please follow the Hanami setup guide in our docs for the new method: " \
9
- "https://docs.appsignal.com/ruby/integrations/hanami.html"
10
- )
11
-
12
- Appsignal.load(:hanami)
13
- Appsignal.start