appsignal 4.0.6-java → 4.0.7-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/CHANGELOG.md +12 -0
- data/Rakefile +9 -9
- data/appsignal.gemspec +22 -1
- data/ext/agent.rb +27 -27
- data/lib/appsignal/check_in.rb +1 -1
- data/lib/appsignal/config.rb +1 -3
- data/lib/appsignal/integrations/resque.rb +1 -6
- data/lib/appsignal/utils/hash_sanitizer.rb +4 -0
- data/lib/appsignal/version.rb +1 -1
- metadata +2 -192
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
- data/.github/ISSUE_TEMPLATE/chore.md +0 -14
- data/.github/workflows/ci.yml +0 -3285
- data/.github/workflows/create_release_from_tag.yml +0 -62
- data/.gitignore +0 -35
- data/.gitmodules +0 -3
- data/.rspec +0 -4
- data/.yardopts +0 -8
- data/benchmark.rake +0 -139
- data/gemfiles/capistrano2.gemfile +0 -6
- data/gemfiles/capistrano3.gemfile +0 -7
- data/gemfiles/dry-monitor.gemfile +0 -5
- data/gemfiles/grape.gemfile +0 -5
- data/gemfiles/hanami-2.0.gemfile +0 -7
- data/gemfiles/hanami-2.1.gemfile +0 -7
- data/gemfiles/http5.gemfile +0 -5
- data/gemfiles/no_dependencies.gemfile +0 -10
- data/gemfiles/padrino.gemfile +0 -7
- data/gemfiles/psych-3.gemfile +0 -5
- data/gemfiles/psych-4.gemfile +0 -5
- data/gemfiles/que-1.gemfile +0 -5
- data/gemfiles/que-2.gemfile +0 -5
- data/gemfiles/rails-6.0.gemfile +0 -10
- data/gemfiles/rails-6.1.gemfile +0 -11
- data/gemfiles/rails-7.0.gemfile +0 -11
- data/gemfiles/rails-7.1.gemfile +0 -11
- data/gemfiles/rails-7.2.gemfile +0 -11
- data/gemfiles/redis-4.gemfile +0 -5
- data/gemfiles/redis-5.gemfile +0 -6
- data/gemfiles/resque-2.gemfile +0 -6
- data/gemfiles/sequel.gemfile +0 -10
- data/gemfiles/sinatra.gemfile +0 -5
- data/gemfiles/webmachine1.gemfile +0 -7
- data/gemfiles/webmachine2.gemfile +0 -6
- data/mono.yml +0 -16
- data/spec/.rubocop.yml +0 -7
- data/spec/lib/appsignal/auth_check_spec.rb +0 -84
- data/spec/lib/appsignal/capistrano2_spec.rb +0 -227
- data/spec/lib/appsignal/capistrano3_spec.rb +0 -284
- data/spec/lib/appsignal/check_in/cron_spec.rb +0 -210
- data/spec/lib/appsignal/check_in/scheduler_spec.rb +0 -557
- data/spec/lib/appsignal/cli/demo_spec.rb +0 -46
- data/spec/lib/appsignal/cli/diagnose/paths_spec.rb +0 -16
- data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +0 -86
- data/spec/lib/appsignal/cli/diagnose_spec.rb +0 -1553
- data/spec/lib/appsignal/cli/helpers_spec.rb +0 -179
- data/spec/lib/appsignal/cli/install_spec.rb +0 -848
- data/spec/lib/appsignal/cli_spec.rb +0 -56
- data/spec/lib/appsignal/config_spec.rb +0 -1380
- data/spec/lib/appsignal/demo_spec.rb +0 -83
- data/spec/lib/appsignal/environment_spec.rb +0 -190
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +0 -60
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +0 -21
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +0 -21
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +0 -52
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +0 -21
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +0 -84
- data/spec/lib/appsignal/event_formatter/rom/sql_formatter_spec.rb +0 -22
- data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +0 -30
- data/spec/lib/appsignal/event_formatter/view_component/render_formatter_spec.rb +0 -41
- data/spec/lib/appsignal/event_formatter_spec.rb +0 -193
- data/spec/lib/appsignal/extension/jruby_spec.rb +0 -46
- data/spec/lib/appsignal/extension_install_failure_spec.rb +0 -20
- data/spec/lib/appsignal/extension_spec.rb +0 -178
- data/spec/lib/appsignal/garbage_collection_spec.rb +0 -98
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -345
- data/spec/lib/appsignal/hooks/action_mailer_spec.rb +0 -55
- data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +0 -23
- data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +0 -99
- data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +0 -47
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +0 -47
- data/spec/lib/appsignal/hooks/activejob_spec.rb +0 -650
- data/spec/lib/appsignal/hooks/at_exit_spec.rb +0 -105
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +0 -40
- data/spec/lib/appsignal/hooks/data_mapper_spec.rb +0 -40
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +0 -38
- data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +0 -83
- data/spec/lib/appsignal/hooks/excon_spec.rb +0 -67
- data/spec/lib/appsignal/hooks/gvl_spec.rb +0 -145
- data/spec/lib/appsignal/hooks/http_spec.rb +0 -37
- data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +0 -46
- data/spec/lib/appsignal/hooks/mri_spec.rb +0 -23
- data/spec/lib/appsignal/hooks/net_http_spec.rb +0 -18
- data/spec/lib/appsignal/hooks/passenger_spec.rb +0 -30
- data/spec/lib/appsignal/hooks/puma_spec.rb +0 -80
- data/spec/lib/appsignal/hooks/que_spec.rb +0 -19
- data/spec/lib/appsignal/hooks/rake_spec.rb +0 -144
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +0 -218
- data/spec/lib/appsignal/hooks/redis_spec.rb +0 -124
- data/spec/lib/appsignal/hooks/resque_spec.rb +0 -27
- data/spec/lib/appsignal/hooks/sequel_spec.rb +0 -44
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +0 -29
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +0 -115
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +0 -63
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +0 -24
- data/spec/lib/appsignal/hooks_spec.rb +0 -124
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +0 -74
- data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +0 -454
- data/spec/lib/appsignal/integrations/http_spec.rb +0 -111
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +0 -154
- data/spec/lib/appsignal/integrations/net_http_spec.rb +0 -33
- data/spec/lib/appsignal/integrations/object_spec.rb +0 -347
- data/spec/lib/appsignal/integrations/puma_spec.rb +0 -150
- data/spec/lib/appsignal/integrations/que_spec.rb +0 -187
- data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -457
- data/spec/lib/appsignal/integrations/resque_spec.rb +0 -155
- data/spec/lib/appsignal/integrations/shoryuken_spec.rb +0 -165
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +0 -640
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +0 -136
- data/spec/lib/appsignal/loaders/grape_spec.rb +0 -12
- data/spec/lib/appsignal/loaders/hanami_spec.rb +0 -92
- data/spec/lib/appsignal/loaders/padrino_spec.rb +0 -273
- data/spec/lib/appsignal/loaders/sinatra_spec.rb +0 -44
- data/spec/lib/appsignal/loaders_spec.rb +0 -144
- data/spec/lib/appsignal/logger_spec.rb +0 -205
- data/spec/lib/appsignal/marker_spec.rb +0 -51
- data/spec/lib/appsignal/probes/gvl_spec.rb +0 -164
- data/spec/lib/appsignal/probes/mri_spec.rb +0 -162
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +0 -333
- data/spec/lib/appsignal/probes_spec.rb +0 -414
- data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +0 -370
- data/spec/lib/appsignal/rack/body_wrapper_spec.rb +0 -319
- data/spec/lib/appsignal/rack/event_handler_spec.rb +0 -441
- data/spec/lib/appsignal/rack/grape_middleware_spec.rb +0 -201
- data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +0 -36
- data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +0 -38
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +0 -126
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +0 -217
- data/spec/lib/appsignal/rack_spec.rb +0 -243
- data/spec/lib/appsignal/sample_data_spec.rb +0 -238
- data/spec/lib/appsignal/span_spec.rb +0 -141
- data/spec/lib/appsignal/system_spec.rb +0 -126
- data/spec/lib/appsignal/transaction_spec.rb +0 -2115
- data/spec/lib/appsignal/transmitter_spec.rb +0 -198
- data/spec/lib/appsignal/utils/data_spec.rb +0 -166
- data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +0 -182
- data/spec/lib/appsignal/utils/integration_logger_spec.rb +0 -21
- data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +0 -153
- data/spec/lib/appsignal/utils/json_spec.rb +0 -44
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +0 -192
- data/spec/lib/appsignal_spec.rb +0 -1919
- data/spec/lib/puma/appsignal_spec.rb +0 -334
- data/spec/spec_helper.rb +0 -179
- data/spec/support/fixtures/generated_config.yml +0 -24
- data/spec/support/fixtures/projects/broken/config/appsignal.yml +0 -1
- data/spec/support/fixtures/projects/valid/config/appsignal.yml +0 -57
- data/spec/support/fixtures/projects/valid/log/.gitkeep +0 -0
- data/spec/support/fixtures/projects/valid_with_rails_app/config/application.rb +0 -16
- data/spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml +0 -56
- data/spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb +0 -10
- data/spec/support/fixtures/projects/valid_with_rails_app/log/.gitkeep +0 -0
- data/spec/support/fixtures/uploaded_file.txt +0 -0
- data/spec/support/hanami/hanami_app.rb +0 -29
- data/spec/support/helpers/action_mailer_helpers.rb +0 -25
- data/spec/support/helpers/activejob_helpers.rb +0 -27
- data/spec/support/helpers/api_request_helper.rb +0 -60
- data/spec/support/helpers/cli_helpers.rb +0 -40
- data/spec/support/helpers/config_helpers.rb +0 -66
- data/spec/support/helpers/dependency_helper.rb +0 -155
- data/spec/support/helpers/directory_helper.rb +0 -27
- data/spec/support/helpers/env_helpers.rb +0 -41
- data/spec/support/helpers/environment_metdata_helper.rb +0 -16
- data/spec/support/helpers/example_exception.rb +0 -13
- data/spec/support/helpers/example_standard_error.rb +0 -13
- data/spec/support/helpers/loader_helper.rb +0 -21
- data/spec/support/helpers/log_helpers.rb +0 -36
- data/spec/support/helpers/rails_helper.rb +0 -28
- data/spec/support/helpers/std_streams_helper.rb +0 -94
- data/spec/support/helpers/system_helpers.rb +0 -8
- data/spec/support/helpers/take_at_most_helper.rb +0 -21
- data/spec/support/helpers/time_helpers.rb +0 -11
- data/spec/support/helpers/transaction_helpers.rb +0 -122
- data/spec/support/helpers/wait_for_helper.rb +0 -39
- data/spec/support/matchers/contains_log.rb +0 -26
- data/spec/support/matchers/have_colorized_text.rb +0 -28
- data/spec/support/matchers/transaction.rb +0 -200
- data/spec/support/mocks/appsignal_mock.rb +0 -18
- data/spec/support/mocks/dummy_app.rb +0 -20
- data/spec/support/mocks/fake_gc_profiler.rb +0 -19
- data/spec/support/mocks/fake_gvl_tools.rb +0 -28
- data/spec/support/mocks/hash_like.rb +0 -10
- data/spec/support/mocks/mock_probe.rb +0 -13
- data/spec/support/mocks/puma_mock.rb +0 -43
- data/spec/support/shared_examples/instrument.rb +0 -48
- data/spec/support/stubs/appsignal/loaders/loader_stub.rb +0 -7
- data/spec/support/stubs/delayed_job.rb +0 -0
- data/spec/support/stubs/sidekiq/api.rb +0 -4
- data/spec/support/testing.rb +0 -203
- data/support/bundler_wrapper +0 -12
- data/support/install_deps +0 -33
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
require "appsignal/demo"
|
|
2
|
-
|
|
3
|
-
describe Appsignal::Demo do
|
|
4
|
-
before do
|
|
5
|
-
# Ignore sleeps to speed up the test
|
|
6
|
-
allow(described_class).to receive(:sleep)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe ".transmit" do
|
|
10
|
-
subject { described_class.transmit }
|
|
11
|
-
|
|
12
|
-
context "without config" do
|
|
13
|
-
it "returns false" do
|
|
14
|
-
expect(silence { subject }).to eq(false)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "with config" do
|
|
19
|
-
before { start_agent }
|
|
20
|
-
|
|
21
|
-
it "returns true" do
|
|
22
|
-
expect(subject).to eq(true)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "creates demonstration samples" do
|
|
26
|
-
expect(described_class).to receive(:create_example_error_request)
|
|
27
|
-
expect(described_class).to receive(:create_example_performance_request)
|
|
28
|
-
subject
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe ".create_example_error_request" do
|
|
34
|
-
before { start_agent }
|
|
35
|
-
around { |example| keep_transactions { example.run } }
|
|
36
|
-
|
|
37
|
-
it "sets an error" do
|
|
38
|
-
described_class.send(:create_example_error_request)
|
|
39
|
-
|
|
40
|
-
transaction = last_transaction
|
|
41
|
-
expect(transaction).to have_id
|
|
42
|
-
expect(transaction).to have_namespace(Appsignal::Transaction::HTTP_REQUEST)
|
|
43
|
-
expect(transaction).to have_action("DemoController#hello")
|
|
44
|
-
expect(transaction).to have_error(
|
|
45
|
-
"Appsignal::Demo::TestError",
|
|
46
|
-
"Hello world! This is an error used for demonstration purposes."
|
|
47
|
-
)
|
|
48
|
-
expect(transaction).to include_metadata(
|
|
49
|
-
"path" => "/hello",
|
|
50
|
-
"method" => "GET",
|
|
51
|
-
"demo_sample" => "true"
|
|
52
|
-
)
|
|
53
|
-
expect(transaction).to be_completed
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
describe ".create_example_performance_request" do
|
|
58
|
-
before { start_agent }
|
|
59
|
-
around { |example| keep_transactions { example.run } }
|
|
60
|
-
|
|
61
|
-
it "sends a performance sample" do
|
|
62
|
-
described_class.send(:create_example_performance_request)
|
|
63
|
-
|
|
64
|
-
transaction = last_transaction
|
|
65
|
-
expect(transaction).to have_id
|
|
66
|
-
expect(transaction).to have_namespace(Appsignal::Transaction::HTTP_REQUEST)
|
|
67
|
-
expect(transaction).to have_action("DemoController#hello")
|
|
68
|
-
expect(transaction).to_not have_error
|
|
69
|
-
expect(transaction).to include_metadata(
|
|
70
|
-
"path" => "/hello",
|
|
71
|
-
"method" => "GET",
|
|
72
|
-
"demo_sample" => "true"
|
|
73
|
-
)
|
|
74
|
-
expect(transaction).to include_event(
|
|
75
|
-
"name" => "action_view.render",
|
|
76
|
-
"title" => "Render hello.html.erb",
|
|
77
|
-
"body" => "<h1>Hello world!</h1>",
|
|
78
|
-
"body_format" => Appsignal::EventFormatter::DEFAULT
|
|
79
|
-
)
|
|
80
|
-
expect(transaction).to be_completed
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
describe Appsignal::Environment do
|
|
2
|
-
include EnvironmentMetadataHelper
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
start_agent
|
|
6
|
-
capture_environment_metadata_report_calls
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def report(key, &value_block)
|
|
10
|
-
described_class.report(key, &value_block)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe ".report" do
|
|
14
|
-
it "sends environment metadata to the extension" do
|
|
15
|
-
logs =
|
|
16
|
-
capture_logs do
|
|
17
|
-
report("_test_ruby_version") { "1.0.0" }
|
|
18
|
-
expect_environment_metadata("_test_ruby_version", "1.0.0")
|
|
19
|
-
end
|
|
20
|
-
expect(logs).to be_empty
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "when the key is a non String type" do
|
|
24
|
-
it "does not set the value" do
|
|
25
|
-
logs =
|
|
26
|
-
capture_logs do
|
|
27
|
-
report(:_test_symbol) { "1.0.0" }
|
|
28
|
-
expect_not_environment_metadata(:_test_symbol)
|
|
29
|
-
expect_not_environment_metadata("_test_symbol")
|
|
30
|
-
end
|
|
31
|
-
expect(logs).to contains_log(
|
|
32
|
-
:error,
|
|
33
|
-
"Unable to report on environment metadata: Unsupported value type for :_test_symbol"
|
|
34
|
-
)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
context "when the key is nil" do
|
|
39
|
-
it "does not set the value" do
|
|
40
|
-
logs =
|
|
41
|
-
capture_logs do
|
|
42
|
-
report(nil) { "1" }
|
|
43
|
-
expect_not_environment_metadata(nil)
|
|
44
|
-
end
|
|
45
|
-
expect(logs).to contains_log(
|
|
46
|
-
:error,
|
|
47
|
-
"Unable to report on environment metadata: Unsupported value type for nil"
|
|
48
|
-
)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
context "when the value is true or false" do
|
|
53
|
-
it "reports true or false as Strings" do
|
|
54
|
-
logs =
|
|
55
|
-
capture_logs do
|
|
56
|
-
report("_test_true") { true }
|
|
57
|
-
report("_test_false") { false }
|
|
58
|
-
expect_environment_metadata("_test_true", "true")
|
|
59
|
-
expect_environment_metadata("_test_false", "false")
|
|
60
|
-
end
|
|
61
|
-
expect(logs).to be_empty
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
context "when the value is nil" do
|
|
66
|
-
it "does not set the value" do
|
|
67
|
-
logs =
|
|
68
|
-
capture_logs do
|
|
69
|
-
report("_test_ruby_version") { nil }
|
|
70
|
-
expect_not_environment_metadata("_test_ruby_version")
|
|
71
|
-
end
|
|
72
|
-
expect(logs).to contains_log(
|
|
73
|
-
:error,
|
|
74
|
-
"Unable to report on environment metadata \"_test_ruby_version\": " \
|
|
75
|
-
"Unsupported value type for nil"
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
context "when the value block raises an error" do
|
|
81
|
-
it "does not re-raise the error and writes it to the log" do
|
|
82
|
-
logs =
|
|
83
|
-
capture_logs do
|
|
84
|
-
report("_test_error") { raise "uh oh" }
|
|
85
|
-
expect_not_environment_metadata("_test_error")
|
|
86
|
-
end
|
|
87
|
-
expect(logs).to contains_log(
|
|
88
|
-
:error,
|
|
89
|
-
"Unable to report on environment metadata \"_test_error\":\n" \
|
|
90
|
-
"RuntimeError: uh oh"
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
context "when something unforeseen errors" do
|
|
96
|
-
it "does not re-raise the error and writes it to the log" do
|
|
97
|
-
klass = Class.new do
|
|
98
|
-
def inspect
|
|
99
|
-
raise "inspect error"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
logs =
|
|
104
|
-
capture_logs do
|
|
105
|
-
report(klass.new) { raise "value error" }
|
|
106
|
-
expect(Appsignal::Extension).to_not have_received(:set_environment_metadata)
|
|
107
|
-
end
|
|
108
|
-
expect(logs).to contains_log(
|
|
109
|
-
:error,
|
|
110
|
-
"Unable to report on environment metadata:\n" \
|
|
111
|
-
"RuntimeError: inspect error"
|
|
112
|
-
)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
describe ".report_supported_gems" do
|
|
118
|
-
it "reports about all AppSignal supported gems in the bundle using Bundler all_specs" do
|
|
119
|
-
logs = capture_logs { described_class.report_supported_gems }
|
|
120
|
-
|
|
121
|
-
expect(logs).to be_empty
|
|
122
|
-
|
|
123
|
-
unless Bundler.rubygems.respond_to?(:all_specs)
|
|
124
|
-
skip "Using new Bundler version without `all_specs` method"
|
|
125
|
-
end
|
|
126
|
-
bundle_gem_specs = silence { ::Bundler.rubygems.all_specs }
|
|
127
|
-
rack_spec = bundle_gem_specs.find { |s| s.name == "rack" }
|
|
128
|
-
rake_spec = bundle_gem_specs.find { |s| s.name == "rake" }
|
|
129
|
-
expect_environment_metadata("ruby_rack_version", rack_spec.version.to_s)
|
|
130
|
-
expect_environment_metadata("ruby_rake_version", rake_spec.version.to_s)
|
|
131
|
-
expect(rack_spec.version.to_s).to_not be_empty
|
|
132
|
-
expect(rake_spec.version.to_s).to_not be_empty
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
it "reports about all AppSignal supported gems in the bundle using bundler installed_specs" do
|
|
136
|
-
unless Bundler.rubygems.respond_to?(:installed_specs)
|
|
137
|
-
skip "Using old Bundler version without `installed_specs` method"
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
logs = capture_logs { described_class.report_supported_gems }
|
|
141
|
-
|
|
142
|
-
expect(logs).to be_empty
|
|
143
|
-
|
|
144
|
-
bundle_gem_specs = ::Bundler.rubygems.installed_specs
|
|
145
|
-
rack_spec = bundle_gem_specs.find { |s| s.name == "rack" }
|
|
146
|
-
rake_spec = bundle_gem_specs.find { |s| s.name == "rake" }
|
|
147
|
-
expect_environment_metadata("ruby_rack_version", rack_spec.version.to_s)
|
|
148
|
-
expect_environment_metadata("ruby_rake_version", rake_spec.version.to_s)
|
|
149
|
-
expect(rack_spec.version.to_s).to_not be_empty
|
|
150
|
-
expect(rake_spec.version.to_s).to_not be_empty
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
context "when something unforeseen errors" do
|
|
154
|
-
it "does not re-raise the error and writes it to the log" do
|
|
155
|
-
expect(Bundler).to receive(:rubygems).and_raise(RuntimeError, "bundler error")
|
|
156
|
-
|
|
157
|
-
logs = capture_logs { described_class.report_supported_gems }
|
|
158
|
-
expect(logs).to contains_log(
|
|
159
|
-
:error,
|
|
160
|
-
"Unable to report supported gems:\nRuntimeError: bundler error"
|
|
161
|
-
)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
describe ".report_enabled" do
|
|
167
|
-
it "reports a feature being enabled" do
|
|
168
|
-
logs = capture_logs { described_class.report_enabled("a_test") }
|
|
169
|
-
|
|
170
|
-
expect(logs).to be_empty
|
|
171
|
-
expect_environment_metadata("ruby_a_test_enabled", "true")
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
context "when something unforeseen errors" do
|
|
175
|
-
it "does not re-raise the error and writes it to the log" do
|
|
176
|
-
klass = Class.new do
|
|
177
|
-
def to_s
|
|
178
|
-
raise "to_s error"
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
logs = capture_logs { described_class.report_enabled(klass.new) }
|
|
183
|
-
expect(logs).to contains_log(
|
|
184
|
-
:error,
|
|
185
|
-
"Unable to report integration enabled:\nRuntimeError: to_s error"
|
|
186
|
-
)
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::ActionView::RenderFormatter do
|
|
2
|
-
let(:klass) { Appsignal::EventFormatter::ActionView::RenderFormatter }
|
|
3
|
-
|
|
4
|
-
if DependencyHelper.rails_present?
|
|
5
|
-
require "action_view"
|
|
6
|
-
|
|
7
|
-
context "when in a Rails app" do
|
|
8
|
-
let(:formatter) { klass.new }
|
|
9
|
-
before { allow(Rails.root).to receive(:to_s).and_return("/var/www/app/20130101") }
|
|
10
|
-
|
|
11
|
-
it "registers render_partial.action_view and render_template.action_view" do
|
|
12
|
-
expect(Appsignal::EventFormatter.registered?("render_partial.action_view",
|
|
13
|
-
klass)).to be_truthy
|
|
14
|
-
expect(Appsignal::EventFormatter.registered?("render_template.action_view",
|
|
15
|
-
klass)).to be_truthy
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe "#root_path" do
|
|
19
|
-
subject { formatter.root_path }
|
|
20
|
-
|
|
21
|
-
it "returns Rails root path" do
|
|
22
|
-
is_expected.to eq "/var/www/app/20130101/"
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe "#format" do
|
|
27
|
-
subject { formatter.format(payload) }
|
|
28
|
-
|
|
29
|
-
context "with an identifier" do
|
|
30
|
-
let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb" } }
|
|
31
|
-
|
|
32
|
-
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context "with a frozen identifier" do
|
|
36
|
-
let(:payload) do
|
|
37
|
-
{ :identifier => "/var/www/app/20130101/app/views/home/index/html.erb".freeze }
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "without an identifier" do
|
|
44
|
-
let(:payload) { {} }
|
|
45
|
-
|
|
46
|
-
it { is_expected.to be_nil }
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
else
|
|
51
|
-
context "when not in a Rails app" do
|
|
52
|
-
it "does not register the event formatter" do
|
|
53
|
-
expect(Appsignal::EventFormatter.registered?("render_partial.action_view",
|
|
54
|
-
klass)).to be_falsy
|
|
55
|
-
expect(Appsignal::EventFormatter.registered?("render_template.action_view",
|
|
56
|
-
klass)).to be_falsy
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
|
|
2
|
-
let(:klass) { Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter }
|
|
3
|
-
let(:formatter) { klass.new }
|
|
4
|
-
|
|
5
|
-
it "should register instantiation.active_record" do
|
|
6
|
-
expect(Appsignal::EventFormatter.registered?("instantiation.active_record", klass)).to be_truthy
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "#format" do
|
|
10
|
-
let(:payload) do
|
|
11
|
-
{
|
|
12
|
-
:record_count => 1,
|
|
13
|
-
:class_name => "User"
|
|
14
|
-
}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
subject { formatter.format(payload) }
|
|
18
|
-
|
|
19
|
-
it { is_expected.to eq ["User", nil] }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::ActiveRecord::SqlFormatter do
|
|
2
|
-
let(:klass) { described_class }
|
|
3
|
-
let(:formatter) { klass.new }
|
|
4
|
-
|
|
5
|
-
it "should register sql.active_record" do
|
|
6
|
-
expect(Appsignal::EventFormatter.registered?("sql.active_record", klass)).to be_truthy
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "#format" do
|
|
10
|
-
let(:payload) do
|
|
11
|
-
{
|
|
12
|
-
:name => "User load",
|
|
13
|
-
:sql => "SELECT * FROM users"
|
|
14
|
-
}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
subject { formatter.format(payload) }
|
|
18
|
-
|
|
19
|
-
it { is_expected.to eq ["User load", "SELECT * FROM users", 1] }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::ElasticSearch::SearchFormatter do
|
|
2
|
-
let(:klass) { Appsignal::EventFormatter::ElasticSearch::SearchFormatter }
|
|
3
|
-
let(:formatter) { klass.new }
|
|
4
|
-
|
|
5
|
-
it "should register search.elasticsearch" do
|
|
6
|
-
expect(
|
|
7
|
-
Appsignal::EventFormatter.registered?("search.elasticsearch", klass)
|
|
8
|
-
).to be_truthy
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe "#format" do
|
|
12
|
-
let(:payload) do
|
|
13
|
-
{
|
|
14
|
-
:name => "Search",
|
|
15
|
-
:klass => "User",
|
|
16
|
-
:search => { :index => "users", :type => "user", :q => "John Doe" }
|
|
17
|
-
}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should return a payload with name and sanitized body" do
|
|
21
|
-
expect(formatter.format(payload)).to eql([
|
|
22
|
-
"Search: User",
|
|
23
|
-
"{:index=>\"users\", :type=>\"user\", :q=>\"?\"}"
|
|
24
|
-
])
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe "#sanitized_search" do
|
|
29
|
-
let(:search) do
|
|
30
|
-
{
|
|
31
|
-
:index => "users",
|
|
32
|
-
:type => "user",
|
|
33
|
-
:q => "John Doe",
|
|
34
|
-
:other => "Other"
|
|
35
|
-
}
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should sanitize non-allowlisted params" do
|
|
39
|
-
expect(
|
|
40
|
-
formatter.sanitized_search(search)
|
|
41
|
-
).to eql(:index => "users", :type => "user", :q => "?", :other => "?")
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "should return nil string when search is nil" do
|
|
45
|
-
expect(formatter.sanitized_search(nil)).to be_nil
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should return nil string when search is not a hash" do
|
|
49
|
-
expect(formatter.sanitized_search([])).to be_nil
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::Faraday::RequestFormatter do
|
|
2
|
-
let(:klass) { Appsignal::EventFormatter::Faraday::RequestFormatter }
|
|
3
|
-
let(:formatter) { klass.new }
|
|
4
|
-
|
|
5
|
-
it "should register request.faraday" do
|
|
6
|
-
expect(Appsignal::EventFormatter.registered?("request.faraday", klass)).to be_truthy
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "#format" do
|
|
10
|
-
let(:payload) do
|
|
11
|
-
{
|
|
12
|
-
:method => :get,
|
|
13
|
-
:url => URI.parse("http://example.org/hello/world?some=param")
|
|
14
|
-
}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
subject { formatter.format(payload) }
|
|
18
|
-
|
|
19
|
-
it { is_expected.to eq ["GET http://example.org", "GET http://example.org/hello/world"] }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter do
|
|
2
|
-
let(:formatter) { Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter }
|
|
3
|
-
|
|
4
|
-
describe ".format" do
|
|
5
|
-
let(:strategy) { :find }
|
|
6
|
-
let(:command) do
|
|
7
|
-
{
|
|
8
|
-
"find" => "users",
|
|
9
|
-
"filter" => { "_id" => 1 }
|
|
10
|
-
}
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should apply a strategy for each key" do
|
|
14
|
-
# TODO: additional curly brackets required for issue
|
|
15
|
-
# https://github.com/rspec/rspec-mocks/issues/1460
|
|
16
|
-
expect(formatter).to receive(:apply_strategy)
|
|
17
|
-
.with(:sanitize_document, { "_id" => 1 })
|
|
18
|
-
expect(formatter).to receive(:apply_strategy)
|
|
19
|
-
.with(:allow, "users")
|
|
20
|
-
|
|
21
|
-
formatter.format(strategy, command)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "when strategy is unknown" do
|
|
25
|
-
let(:strategy) { :bananas }
|
|
26
|
-
|
|
27
|
-
it "should return an empty hash" do
|
|
28
|
-
expect(formatter.format(strategy, command)).to eql({})
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context "when command is not a hash " do
|
|
33
|
-
let(:command) { :bananas }
|
|
34
|
-
|
|
35
|
-
it "should return an empty hash" do
|
|
36
|
-
expect(formatter.format(strategy, command)).to eql({})
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe ".apply_strategy" do
|
|
42
|
-
context "when strategy is allow" do
|
|
43
|
-
let(:strategy) { :allow }
|
|
44
|
-
let(:value) { { "_id" => 1 } }
|
|
45
|
-
|
|
46
|
-
it "should return the given value" do
|
|
47
|
-
expect(formatter.apply_strategy(strategy, value)).to eql(value)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
context "when strategy is sanitize_document" do
|
|
52
|
-
let(:strategy) { :sanitize_document }
|
|
53
|
-
let(:value) do
|
|
54
|
-
{
|
|
55
|
-
"_id" => 1,
|
|
56
|
-
"authors" => [
|
|
57
|
-
{ "name" => "BarBaz" },
|
|
58
|
-
{ "name" => "FooBar" },
|
|
59
|
-
{ "name" => "BarFoo", "surname" => "Baz" }
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "should return a sanitized document" do
|
|
65
|
-
expect(formatter.apply_strategy(strategy, value)).to eql(
|
|
66
|
-
"_id" => "?",
|
|
67
|
-
"authors" => [
|
|
68
|
-
{ "name" => "?" },
|
|
69
|
-
{ "name" => "?", "surname" => "?" }
|
|
70
|
-
]
|
|
71
|
-
)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
context "when strategy is missing" do
|
|
76
|
-
let(:strategy) { nil }
|
|
77
|
-
let(:value) { { "_id" => 1 } }
|
|
78
|
-
|
|
79
|
-
it "should return a '?'" do
|
|
80
|
-
expect(formatter.apply_strategy(strategy, value)).to eql("?")
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe Appsignal::EventFormatter::Rom::SqlFormatter do
|
|
4
|
-
let(:klass) { described_class }
|
|
5
|
-
let(:formatter) { klass.new }
|
|
6
|
-
|
|
7
|
-
it "registers the sql event formatter" do
|
|
8
|
-
expect(Appsignal::EventFormatter.registered?("sql.dry", klass)).to be_truthy
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe "#format" do
|
|
12
|
-
let(:payload) do
|
|
13
|
-
{
|
|
14
|
-
:name => "postgres",
|
|
15
|
-
:query => "SELECT * FROM users"
|
|
16
|
-
}
|
|
17
|
-
end
|
|
18
|
-
subject { formatter.format(payload) }
|
|
19
|
-
|
|
20
|
-
it { is_expected.to eq ["query.postgres", "SELECT * FROM users", 1] }
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::Sequel::SqlFormatter do
|
|
2
|
-
let(:klass) { described_class }
|
|
3
|
-
let(:formatter) { klass.new }
|
|
4
|
-
|
|
5
|
-
it "registers the sql.sequel event formatter" do
|
|
6
|
-
expect(Appsignal::EventFormatter.registered?("sql.sequel", klass)).to be_truthy
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "#format" do
|
|
10
|
-
before do
|
|
11
|
-
stub_const(
|
|
12
|
-
"SequelDatabaseTypeClass",
|
|
13
|
-
Class.new do
|
|
14
|
-
def self.to_s
|
|
15
|
-
"SequelDatabaseTypeClassToString"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
)
|
|
19
|
-
end
|
|
20
|
-
let(:payload) do
|
|
21
|
-
{
|
|
22
|
-
:name => SequelDatabaseTypeClass,
|
|
23
|
-
:sql => "SELECT * FROM users"
|
|
24
|
-
}
|
|
25
|
-
end
|
|
26
|
-
subject { formatter.format(payload) }
|
|
27
|
-
|
|
28
|
-
it { is_expected.to eq ["SequelDatabaseTypeClassToString", "SELECT * FROM users", 1] }
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
describe Appsignal::EventFormatter::ViewComponent::RenderFormatter do
|
|
2
|
-
let(:klass) { Appsignal::EventFormatter::ViewComponent::RenderFormatter }
|
|
3
|
-
|
|
4
|
-
if DependencyHelper.rails_present?
|
|
5
|
-
context "when in a Rails app" do
|
|
6
|
-
let(:formatter) { klass.new }
|
|
7
|
-
before { allow(Rails.root).to receive(:to_s).and_return("/var/www/app/20130101") }
|
|
8
|
-
|
|
9
|
-
it "registers render.view_component and (deprecated) !render.view_component" do
|
|
10
|
-
expect(Appsignal::EventFormatter.registered?("render.view_component",
|
|
11
|
-
klass)).to be_truthy
|
|
12
|
-
expect(Appsignal::EventFormatter.registered?("!render.view_component",
|
|
13
|
-
klass)).to be_truthy
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe "#format" do
|
|
17
|
-
subject { formatter.format(payload) }
|
|
18
|
-
|
|
19
|
-
context "with a name and identifier" do
|
|
20
|
-
let(:payload) do
|
|
21
|
-
{
|
|
22
|
-
:name => "WhateverComponent",
|
|
23
|
-
:identifier => "/var/www/app/20130101/app/components/whatever_component.rb"
|
|
24
|
-
}
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it { is_expected.to eq ["WhateverComponent", "app/components/whatever_component.rb"] }
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
else
|
|
32
|
-
context "when not in a Rails app" do
|
|
33
|
-
it "does not register the event formatter" do
|
|
34
|
-
expect(Appsignal::EventFormatter.registered?("render.view_component",
|
|
35
|
-
klass)).to be_falsy
|
|
36
|
-
expect(Appsignal::EventFormatter.registered?("!render.view_component",
|
|
37
|
-
klass)).to be_falsy
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|