appsignal 3.12.6-java → 4.0.0.beta.1-java
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +499 -487
- data/CHANGELOG.md +151 -0
- data/Rakefile +31 -7
- data/benchmark.rake +4 -6
- data/build_matrix.yml +45 -39
- data/ext/agent.rb +27 -27
- data/ext/appsignal_extension.c +25 -0
- data/gemfiles/rails-7.2.gemfile +11 -0
- data/lib/appsignal/check_in/cron.rb +67 -0
- data/lib/appsignal/check_in.rb +46 -0
- data/lib/appsignal/cli/diagnose.rb +37 -28
- data/lib/appsignal/cli/install.rb +5 -1
- data/lib/appsignal/config.rb +57 -119
- data/lib/appsignal/demo.rb +2 -2
- data/lib/appsignal/extension/jruby.rb +14 -0
- data/lib/appsignal/helpers/instrumentation.rb +139 -414
- data/lib/appsignal/helpers/metrics.rb +0 -16
- data/lib/appsignal/hooks/action_cable.rb +8 -8
- data/lib/appsignal/hooks/active_job.rb +2 -2
- data/lib/appsignal/hooks/at_exit.rb +37 -0
- data/lib/appsignal/hooks.rb +1 -16
- data/lib/appsignal/integrations/action_cable.rb +2 -2
- data/lib/appsignal/integrations/capistrano/appsignal.cap +2 -4
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +1 -4
- data/lib/appsignal/integrations/delayed_job_plugin.rb +3 -3
- data/lib/appsignal/integrations/http.rb +2 -7
- data/lib/appsignal/integrations/que.rb +2 -2
- data/lib/appsignal/integrations/railtie.rb +26 -59
- data/lib/appsignal/integrations/rake.rb +2 -2
- data/lib/appsignal/integrations/resque.rb +2 -2
- data/lib/appsignal/integrations/shoryuken.rb +4 -4
- data/lib/appsignal/integrations/sidekiq.rb +3 -3
- data/lib/appsignal/integrations/webmachine.rb +2 -2
- data/lib/appsignal/loaders.rb +1 -1
- data/lib/appsignal/probes.rb +0 -9
- data/lib/appsignal/rack/abstract_middleware.rb +4 -26
- data/lib/appsignal/rack/event_handler.rb +4 -4
- data/lib/appsignal/rack/rails_instrumentation.rb +1 -1
- data/lib/appsignal/rack.rb +0 -25
- data/lib/appsignal/sample_data.rb +95 -0
- data/lib/appsignal/transaction.rb +235 -361
- data/lib/appsignal/utils/rails_helper.rb +4 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +20 -62
- data/spec/lib/appsignal/auth_check_spec.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
- data/spec/lib/appsignal/capistrano3_spec.rb +53 -13
- data/spec/lib/appsignal/{heartbeat_spec.rb → check_in_spec.rb} +45 -36
- data/spec/lib/appsignal/cli/demo_spec.rb +7 -27
- data/spec/lib/appsignal/cli/diagnose_spec.rb +145 -110
- data/spec/lib/appsignal/config_spec.rb +304 -379
- data/spec/lib/appsignal/extension_install_failure_spec.rb +5 -1
- data/spec/lib/appsignal/extension_spec.rb +5 -1
- data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +1 -1
- data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +1 -2
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +1 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +7 -12
- data/spec/lib/appsignal/hooks/at_exit_spec.rb +72 -0
- data/spec/lib/appsignal/hooks/gvl_spec.rb +10 -5
- data/spec/lib/appsignal/hooks/http_spec.rb +3 -3
- data/spec/lib/appsignal/hooks/net_http_spec.rb +3 -3
- data/spec/lib/appsignal/hooks/rake_spec.rb +6 -9
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +5 -10
- data/spec/lib/appsignal/hooks/redis_spec.rb +4 -7
- data/spec/lib/appsignal/hooks/resque_spec.rb +3 -5
- data/spec/lib/appsignal/hooks_spec.rb +0 -41
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +29 -20
- data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +4 -9
- data/spec/lib/appsignal/integrations/http_spec.rb +0 -21
- data/spec/lib/appsignal/integrations/railtie_spec.rb +179 -157
- data/spec/lib/appsignal/integrations/shoryuken_spec.rb +3 -5
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +48 -62
- data/spec/lib/appsignal/loaders/hanami_spec.rb +6 -9
- data/spec/lib/appsignal/loaders/padrino_spec.rb +6 -10
- data/spec/lib/appsignal/loaders/sinatra_spec.rb +6 -9
- data/spec/lib/appsignal/loaders_spec.rb +8 -1
- data/spec/lib/appsignal/marker_spec.rb +1 -1
- data/spec/lib/appsignal/probes_spec.rb +4 -83
- data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +4 -63
- data/spec/lib/appsignal/rack/event_handler_spec.rb +18 -15
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +3 -11
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +4 -5
- data/spec/lib/appsignal/sample_data_spec.rb +174 -0
- data/spec/lib/appsignal/transaction_spec.rb +791 -1031
- data/spec/lib/appsignal/transmitter_spec.rb +6 -8
- data/spec/lib/appsignal_spec.rb +294 -643
- data/spec/spec_helper.rb +1 -3
- data/spec/support/fixtures/projects/valid/config/appsignal.yml +4 -7
- data/spec/support/fixtures/projects/valid_with_rails_app/config/application.rb +16 -0
- data/spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml +56 -0
- data/spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb +5 -0
- data/spec/support/helpers/api_request_helper.rb +3 -2
- data/spec/support/helpers/config_helpers.rb +41 -11
- data/spec/support/helpers/dependency_helper.rb +8 -0
- data/spec/support/helpers/log_helpers.rb +1 -0
- data/spec/support/helpers/rails_helper.rb +6 -6
- data/spec/support/helpers/transaction_helpers.rb +2 -24
- data/spec/support/matchers/transaction.rb +3 -3
- data/spec/support/mocks/appsignal_mock.rb +3 -3
- data/spec/support/mocks/mock_probe.rb +2 -0
- data/spec/support/testing.rb +2 -2
- metadata +14 -23
- data/gemfiles/que_beta.gemfile +0 -5
- data/lib/appsignal/heartbeat.rb +0 -59
- data/lib/appsignal/helpers/heartbeats.rb +0 -44
- data/lib/appsignal/integrations/grape.rb +0 -35
- data/lib/appsignal/integrations/hanami.rb +0 -13
- data/lib/appsignal/integrations/padrino.rb +0 -13
- data/lib/appsignal/integrations/sinatra.rb +0 -13
- data/lib/appsignal/rack/generic_instrumentation.rb +0 -22
- data/lib/appsignal/rack/streaming_listener.rb +0 -28
- data/spec/lib/appsignal/integrations/grape_spec.rb +0 -36
- data/spec/lib/appsignal/integrations/hanami_spec.rb +0 -17
- data/spec/lib/appsignal/integrations/padrino_spec.rb +0 -15
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +0 -15
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +0 -81
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +0 -69
- data/spec/support/fixtures/projects/valid/config/environments/development.rb +0 -0
- data/spec/support/fixtures/projects/valid/config/environments/production.rb +0 -0
- data/spec/support/fixtures/projects/valid/config/environments/test.rb +0 -0
- data/spec/support/rails/my_app.rb +0 -6
- /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
|
-
|
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
|
@@ -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
|
-
|
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
|
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
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
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 :
|
47
|
+
module_function :build_config
|
24
48
|
|
25
|
-
def start_agent(env
|
26
|
-
|
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
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module RailsHelper
|
2
|
-
def
|
3
|
-
|
4
|
-
Appsignal::Integrations::Railtie.
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
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)
|
data/spec/support/testing.rb
CHANGED
@@ -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(
|
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
|
-
|
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:
|
4
|
+
version: 4.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: 2024-08-
|
13
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -185,11 +185,11 @@ files:
|
|
185
185
|
- gemfiles/psych-3.gemfile
|
186
186
|
- gemfiles/psych-4.gemfile
|
187
187
|
- gemfiles/que.gemfile
|
188
|
-
- gemfiles/que_beta.gemfile
|
189
188
|
- gemfiles/rails-6.0.gemfile
|
190
189
|
- gemfiles/rails-6.1.gemfile
|
191
190
|
- gemfiles/rails-7.0.gemfile
|
192
191
|
- gemfiles/rails-7.1.gemfile
|
192
|
+
- gemfiles/rails-7.2.gemfile
|
193
193
|
- gemfiles/redis-4.gemfile
|
194
194
|
- gemfiles/redis-5.gemfile
|
195
195
|
- gemfiles/resque-2.gemfile
|
@@ -200,6 +200,8 @@ files:
|
|
200
200
|
- lib/appsignal.rb
|
201
201
|
- lib/appsignal/auth_check.rb
|
202
202
|
- lib/appsignal/capistrano.rb
|
203
|
+
- lib/appsignal/check_in.rb
|
204
|
+
- lib/appsignal/check_in/cron.rb
|
203
205
|
- lib/appsignal/cli.rb
|
204
206
|
- lib/appsignal/cli/demo.rb
|
205
207
|
- lib/appsignal/cli/diagnose.rb
|
@@ -223,8 +225,6 @@ files:
|
|
223
225
|
- lib/appsignal/extension.rb
|
224
226
|
- lib/appsignal/extension/jruby.rb
|
225
227
|
- lib/appsignal/garbage_collection.rb
|
226
|
-
- lib/appsignal/heartbeat.rb
|
227
|
-
- lib/appsignal/helpers/heartbeats.rb
|
228
228
|
- lib/appsignal/helpers/instrumentation.rb
|
229
229
|
- lib/appsignal/helpers/metrics.rb
|
230
230
|
- lib/appsignal/hooks.rb
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/appsignal/hooks/action_mailer.rb
|
233
233
|
- lib/appsignal/hooks/active_job.rb
|
234
234
|
- lib/appsignal/hooks/active_support_notifications.rb
|
235
|
+
- lib/appsignal/hooks/at_exit.rb
|
235
236
|
- lib/appsignal/hooks/celluloid.rb
|
236
237
|
- lib/appsignal/hooks/data_mapper.rb
|
237
238
|
- lib/appsignal/hooks/delayed_job.rb
|
@@ -262,13 +263,10 @@ files:
|
|
262
263
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
263
264
|
- lib/appsignal/integrations/dry_monitor.rb
|
264
265
|
- lib/appsignal/integrations/excon.rb
|
265
|
-
- lib/appsignal/integrations/grape.rb
|
266
|
-
- lib/appsignal/integrations/hanami.rb
|
267
266
|
- lib/appsignal/integrations/http.rb
|
268
267
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
269
268
|
- lib/appsignal/integrations/net_http.rb
|
270
269
|
- lib/appsignal/integrations/object.rb
|
271
|
-
- lib/appsignal/integrations/padrino.rb
|
272
270
|
- lib/appsignal/integrations/que.rb
|
273
271
|
- lib/appsignal/integrations/railtie.rb
|
274
272
|
- lib/appsignal/integrations/rake.rb
|
@@ -277,7 +275,6 @@ files:
|
|
277
275
|
- lib/appsignal/integrations/resque.rb
|
278
276
|
- lib/appsignal/integrations/shoryuken.rb
|
279
277
|
- lib/appsignal/integrations/sidekiq.rb
|
280
|
-
- lib/appsignal/integrations/sinatra.rb
|
281
278
|
- lib/appsignal/integrations/unicorn.rb
|
282
279
|
- lib/appsignal/integrations/webmachine.rb
|
283
280
|
- lib/appsignal/loaders.rb
|
@@ -296,13 +293,12 @@ files:
|
|
296
293
|
- lib/appsignal/rack/abstract_middleware.rb
|
297
294
|
- lib/appsignal/rack/body_wrapper.rb
|
298
295
|
- lib/appsignal/rack/event_handler.rb
|
299
|
-
- lib/appsignal/rack/generic_instrumentation.rb
|
300
296
|
- lib/appsignal/rack/grape_middleware.rb
|
301
297
|
- lib/appsignal/rack/hanami_middleware.rb
|
302
298
|
- lib/appsignal/rack/instrumentation_middleware.rb
|
303
299
|
- lib/appsignal/rack/rails_instrumentation.rb
|
304
300
|
- lib/appsignal/rack/sinatra_instrumentation.rb
|
305
|
-
- lib/appsignal/
|
301
|
+
- lib/appsignal/sample_data.rb
|
306
302
|
- lib/appsignal/span.rb
|
307
303
|
- lib/appsignal/system.rb
|
308
304
|
- lib/appsignal/transaction.rb
|
@@ -326,6 +322,7 @@ files:
|
|
326
322
|
- spec/lib/appsignal/auth_check_spec.rb
|
327
323
|
- spec/lib/appsignal/capistrano2_spec.rb
|
328
324
|
- spec/lib/appsignal/capistrano3_spec.rb
|
325
|
+
- spec/lib/appsignal/check_in_spec.rb
|
329
326
|
- spec/lib/appsignal/cli/demo_spec.rb
|
330
327
|
- spec/lib/appsignal/cli/diagnose/paths_spec.rb
|
331
328
|
- spec/lib/appsignal/cli/diagnose/utils_spec.rb
|
@@ -350,7 +347,6 @@ files:
|
|
350
347
|
- spec/lib/appsignal/extension_install_failure_spec.rb
|
351
348
|
- spec/lib/appsignal/extension_spec.rb
|
352
349
|
- spec/lib/appsignal/garbage_collection_spec.rb
|
353
|
-
- spec/lib/appsignal/heartbeat_spec.rb
|
354
350
|
- spec/lib/appsignal/hooks/action_cable_spec.rb
|
355
351
|
- spec/lib/appsignal/hooks/action_mailer_spec.rb
|
356
352
|
- spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
|
@@ -358,6 +354,7 @@ files:
|
|
358
354
|
- spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
|
359
355
|
- spec/lib/appsignal/hooks/active_support_notifications_spec.rb
|
360
356
|
- spec/lib/appsignal/hooks/activejob_spec.rb
|
357
|
+
- spec/lib/appsignal/hooks/at_exit_spec.rb
|
361
358
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
362
359
|
- spec/lib/appsignal/hooks/data_mapper_spec.rb
|
363
360
|
- spec/lib/appsignal/hooks/delayed_job_spec.rb
|
@@ -383,18 +380,14 @@ files:
|
|
383
380
|
- spec/lib/appsignal/hooks_spec.rb
|
384
381
|
- spec/lib/appsignal/integrations/data_mapper_spec.rb
|
385
382
|
- spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb
|
386
|
-
- spec/lib/appsignal/integrations/grape_spec.rb
|
387
|
-
- spec/lib/appsignal/integrations/hanami_spec.rb
|
388
383
|
- spec/lib/appsignal/integrations/http_spec.rb
|
389
384
|
- spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
|
390
385
|
- spec/lib/appsignal/integrations/net_http_spec.rb
|
391
386
|
- spec/lib/appsignal/integrations/object_spec.rb
|
392
|
-
- spec/lib/appsignal/integrations/padrino_spec.rb
|
393
387
|
- spec/lib/appsignal/integrations/que_spec.rb
|
394
388
|
- spec/lib/appsignal/integrations/railtie_spec.rb
|
395
389
|
- spec/lib/appsignal/integrations/shoryuken_spec.rb
|
396
390
|
- spec/lib/appsignal/integrations/sidekiq_spec.rb
|
397
|
-
- spec/lib/appsignal/integrations/sinatra_spec.rb
|
398
391
|
- spec/lib/appsignal/integrations/webmachine_spec.rb
|
399
392
|
- spec/lib/appsignal/loaders/grape_spec.rb
|
400
393
|
- spec/lib/appsignal/loaders/hanami_spec.rb
|
@@ -410,14 +403,13 @@ files:
|
|
410
403
|
- spec/lib/appsignal/rack/abstract_middleware_spec.rb
|
411
404
|
- spec/lib/appsignal/rack/body_wrapper_spec.rb
|
412
405
|
- spec/lib/appsignal/rack/event_handler_spec.rb
|
413
|
-
- spec/lib/appsignal/rack/generic_instrumentation_spec.rb
|
414
406
|
- spec/lib/appsignal/rack/grape_middleware_spec.rb
|
415
407
|
- spec/lib/appsignal/rack/hanami_middleware_spec.rb
|
416
408
|
- spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
|
417
409
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
418
410
|
- spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
|
419
|
-
- spec/lib/appsignal/rack/streaming_listener_spec.rb
|
420
411
|
- spec/lib/appsignal/rack_spec.rb
|
412
|
+
- spec/lib/appsignal/sample_data_spec.rb
|
421
413
|
- spec/lib/appsignal/span_spec.rb
|
422
414
|
- spec/lib/appsignal/system_spec.rb
|
423
415
|
- spec/lib/appsignal/transaction_spec.rb
|
@@ -433,12 +425,12 @@ files:
|
|
433
425
|
- spec/spec_helper.rb
|
434
426
|
- spec/support/fixtures/generated_config.yml
|
435
427
|
- spec/support/fixtures/projects/broken/config/appsignal.yml
|
436
|
-
- spec/support/fixtures/projects/valid/config/application.rb
|
437
428
|
- spec/support/fixtures/projects/valid/config/appsignal.yml
|
438
|
-
- spec/support/fixtures/projects/valid/config/environments/development.rb
|
439
|
-
- spec/support/fixtures/projects/valid/config/environments/production.rb
|
440
|
-
- spec/support/fixtures/projects/valid/config/environments/test.rb
|
441
429
|
- spec/support/fixtures/projects/valid/log/.gitkeep
|
430
|
+
- spec/support/fixtures/projects/valid_with_rails_app/config/application.rb
|
431
|
+
- spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml
|
432
|
+
- spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb
|
433
|
+
- spec/support/fixtures/projects/valid_with_rails_app/log/.gitkeep
|
442
434
|
- spec/support/fixtures/uploaded_file.txt
|
443
435
|
- spec/support/hanami/hanami_app.rb
|
444
436
|
- spec/support/helpers/action_mailer_helpers.rb
|
@@ -468,7 +460,6 @@ files:
|
|
468
460
|
- spec/support/mocks/fake_gc_profiler.rb
|
469
461
|
- spec/support/mocks/fake_gvl_tools.rb
|
470
462
|
- spec/support/mocks/mock_probe.rb
|
471
|
-
- spec/support/rails/my_app.rb
|
472
463
|
- spec/support/shared_examples/instrument.rb
|
473
464
|
- spec/support/stubs/appsignal/loaders/loader_stub.rb
|
474
465
|
- spec/support/stubs/delayed_job.rb
|
data/gemfiles/que_beta.gemfile
DELETED
data/lib/appsignal/heartbeat.rb
DELETED
@@ -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
|