appsignal 2.1.0.alpha.3 → 2.1.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +43 -0
- data/.rubocop_todo.yml +289 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +11 -1
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/appsignal.gemspec +1 -0
- data/bin/appsignal +2 -2
- data/ext/agent.yml +11 -11
- data/ext/extconf.rb +33 -33
- data/gemfiles/rails-4.2.gemfile +4 -0
- data/gemfiles/resque.gemfile +4 -0
- data/lib/appsignal.rb +58 -54
- data/lib/appsignal/auth_check.rb +15 -16
- data/lib/appsignal/capistrano.rb +4 -4
- data/lib/appsignal/cli.rb +28 -28
- data/lib/appsignal/cli/diagnose.rb +11 -11
- data/lib/appsignal/cli/helpers.rb +1 -1
- data/lib/appsignal/cli/install.rb +38 -38
- data/lib/appsignal/cli/notify_of_deploy.rb +1 -1
- data/lib/appsignal/config.rb +73 -71
- data/lib/appsignal/event_formatter.rb +8 -8
- data/lib/appsignal/event_formatter/action_view/render_formatter.rb +4 -4
- data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +1 -1
- data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +1 -1
- data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +9 -7
- data/lib/appsignal/event_formatter/faraday/request_formatter.rb +1 -1
- data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +6 -6
- data/lib/appsignal/event_formatter/moped/query_formatter.rb +56 -43
- data/lib/appsignal/extension.rb +5 -5
- data/lib/appsignal/hooks.rb +28 -26
- data/lib/appsignal/hooks/active_support_notifications.rb +2 -2
- data/lib/appsignal/hooks/celluloid.rb +1 -1
- data/lib/appsignal/hooks/data_mapper.rb +2 -2
- data/lib/appsignal/hooks/delayed_job.rb +1 -1
- data/lib/appsignal/hooks/mongo_ruby_driver.rb +1 -1
- data/lib/appsignal/hooks/net_http.rb +4 -4
- data/lib/appsignal/hooks/passenger.rb +2 -2
- data/lib/appsignal/hooks/puma.rb +4 -4
- data/lib/appsignal/hooks/rake.rb +1 -1
- data/lib/appsignal/hooks/redis.rb +1 -1
- data/lib/appsignal/hooks/sequel.rb +2 -2
- data/lib/appsignal/hooks/shoryuken.rb +8 -8
- data/lib/appsignal/hooks/sidekiq.rb +16 -15
- data/lib/appsignal/hooks/unicorn.rb +1 -1
- data/lib/appsignal/hooks/webmachine.rb +1 -1
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +6 -6
- data/lib/appsignal/integrations/data_mapper.rb +2 -3
- data/lib/appsignal/integrations/delayed_job_plugin.rb +5 -5
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +6 -6
- data/lib/appsignal/integrations/padrino.rb +8 -8
- data/lib/appsignal/integrations/railtie.rb +5 -5
- data/lib/appsignal/integrations/resque.rb +4 -5
- data/lib/appsignal/integrations/resque_active_job.rb +3 -6
- data/lib/appsignal/integrations/sinatra.rb +2 -2
- data/lib/appsignal/integrations/webmachine.rb +2 -3
- data/lib/appsignal/js_exception_transaction.rb +10 -10
- data/lib/appsignal/marker.rb +3 -3
- data/lib/appsignal/rack/generic_instrumentation.rb +10 -9
- data/lib/appsignal/rack/js_exception_catcher.rb +7 -6
- data/lib/appsignal/rack/rails_instrumentation.rb +9 -8
- data/lib/appsignal/rack/sinatra_instrumentation.rb +19 -17
- data/lib/appsignal/rack/streaming_listener.rb +9 -8
- data/lib/appsignal/system.rb +19 -17
- data/lib/appsignal/transaction.rb +97 -40
- data/lib/appsignal/transmitter.rb +23 -30
- data/lib/appsignal/utils.rb +3 -3
- data/lib/appsignal/utils/params_sanitizer.rb +1 -1
- data/lib/appsignal/utils/query_params_sanitizer.rb +1 -1
- data/lib/appsignal/version.rb +2 -2
- data/spec/.rubocop.yml +4 -0
- data/spec/lib/appsignal/auth_check_spec.rb +7 -7
- data/spec/lib/appsignal/capistrano2_spec.rb +41 -41
- data/spec/lib/appsignal/capistrano3_spec.rb +43 -44
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +9 -11
- data/spec/lib/appsignal/cli_spec.rb +9 -9
- data/spec/lib/appsignal/config_spec.rb +88 -86
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +9 -9
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +4 -4
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +4 -4
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +12 -12
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +4 -4
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +23 -23
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +29 -30
- data/spec/lib/appsignal/event_formatter_spec.rb +28 -28
- data/spec/lib/appsignal/extension_spec.rb +15 -15
- data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +6 -5
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +12 -12
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +34 -34
- data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +3 -3
- data/spec/lib/appsignal/hooks/net_http_spec.rb +10 -10
- data/spec/lib/appsignal/hooks/rake_spec.rb +7 -7
- data/spec/lib/appsignal/hooks/redis_spec.rb +6 -6
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +21 -22
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +48 -45
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -2
- data/spec/lib/appsignal/hooks_spec.rb +16 -17
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +7 -8
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +19 -19
- data/spec/lib/appsignal/integrations/object_spec.rb +3 -3
- data/spec/lib/appsignal/integrations/padrino_spec.rb +44 -44
- data/spec/lib/appsignal/integrations/railtie_spec.rb +13 -13
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +7 -7
- data/spec/lib/appsignal/integrations/resque_spec.rb +8 -8
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +7 -7
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +15 -15
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +23 -23
- data/spec/lib/appsignal/marker_spec.rb +8 -8
- data/spec/lib/appsignal/minutely_spec.rb +6 -6
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +7 -7
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +13 -13
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +11 -11
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +21 -21
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +36 -36
- data/spec/lib/appsignal/system/container_spec.rb +1 -1
- data/spec/lib/appsignal/transaction_spec.rb +213 -184
- data/spec/lib/appsignal/transmitter_spec.rb +20 -20
- data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +19 -19
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +41 -41
- data/spec/lib/appsignal/utils_spec.rb +41 -37
- data/spec/lib/appsignal_spec.rb +150 -142
- data/spec/spec_helper.rb +18 -18
- data/spec/support/delegate_matcher.rb +6 -6
- data/spec/support/helpers/api_request_helper.rb +2 -2
- data/spec/support/helpers/config_helpers.rb +3 -3
- data/spec/support/helpers/dependency_helper.rb +13 -13
- data/spec/support/helpers/directory_helper.rb +5 -5
- data/spec/support/helpers/env_helpers.rb +14 -14
- data/spec/support/helpers/system_helpers.rb +3 -3
- data/spec/support/helpers/transaction_helpers.rb +10 -10
- metadata +20 -2
@@ -2,7 +2,7 @@ if DependencyHelper.rails_present?
|
|
2
2
|
describe Appsignal::Integrations::Railtie do
|
3
3
|
context "after initializing the app" do
|
4
4
|
it "should call initialize_appsignal" do
|
5
|
-
expect(
|
5
|
+
expect(Appsignal::Integrations::Railtie).to receive(:initialize_appsignal)
|
6
6
|
|
7
7
|
MyApp::Application.config.root = project_fixture_path
|
8
8
|
MyApp::Application.initialize!
|
@@ -23,36 +23,36 @@ if DependencyHelper.rails_present?
|
|
23
23
|
context "config" do
|
24
24
|
subject { Appsignal.config }
|
25
25
|
context "basics" do
|
26
|
-
before
|
26
|
+
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
27
27
|
|
28
28
|
it { should be_a(Appsignal::Config) }
|
29
29
|
|
30
30
|
its(:root_path) { should eq Pathname.new(project_fixture_path) }
|
31
|
-
its(:env) { should eq
|
32
|
-
its([:name]) { should eq
|
33
|
-
its([:log_path]) { should eq Pathname.new(File.join(project_fixture_path,
|
31
|
+
its(:env) { should eq "test" }
|
32
|
+
its([:name]) { should eq "TestApp" }
|
33
|
+
its([:log_path]) { should eq Pathname.new(File.join(project_fixture_path, "log")) }
|
34
34
|
end
|
35
35
|
|
36
36
|
context "initial config" do
|
37
37
|
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
38
38
|
subject { Appsignal.config.initial_config }
|
39
39
|
|
40
|
-
its([:name]) { should eq
|
40
|
+
its([:name]) { should eq "MyApp" }
|
41
41
|
end
|
42
42
|
|
43
43
|
context "with APPSIGNAL_APP_ENV ENV var set" do
|
44
44
|
before do
|
45
|
-
ENV.should_receive(:fetch).with(
|
45
|
+
ENV.should_receive(:fetch).with("APPSIGNAL_APP_ENV", "test").and_return("env_test")
|
46
46
|
Appsignal::Integrations::Railtie.initialize_appsignal(app)
|
47
47
|
end
|
48
48
|
|
49
|
-
its(:env) { should eq
|
49
|
+
its(:env) { should eq "env_test" }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
context "listener middleware" do
|
54
54
|
it "should have added the listener middleware" do
|
55
|
-
expect(
|
55
|
+
expect(app.middleware).to receive(:insert_before).with(
|
56
56
|
ActionDispatch::RemoteIp,
|
57
57
|
Appsignal::Rack::RailsInstrumentation
|
58
58
|
)
|
@@ -62,8 +62,8 @@ if DependencyHelper.rails_present?
|
|
62
62
|
let(:config) do
|
63
63
|
Appsignal::Config.new(
|
64
64
|
project_fixture_path,
|
65
|
-
|
66
|
-
:name =>
|
65
|
+
"test",
|
66
|
+
:name => "MyApp",
|
67
67
|
:enable_frontend_error_catching => true
|
68
68
|
)
|
69
69
|
end
|
@@ -73,12 +73,12 @@ if DependencyHelper.rails_present?
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should have added the listener and JSExceptionCatcher middleware" do
|
76
|
-
expect(
|
76
|
+
expect(app.middleware).to receive(:insert_before).with(
|
77
77
|
ActionDispatch::RemoteIp,
|
78
78
|
Appsignal::Rack::RailsInstrumentation
|
79
79
|
)
|
80
80
|
|
81
|
-
expect(
|
81
|
+
expect(app.middleware).to receive(:insert_before).with(
|
82
82
|
Appsignal::Rack::RailsInstrumentation,
|
83
83
|
Appsignal::Rack::JSExceptionCatcher
|
84
84
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
if DependencyHelper.resque_present? && DependencyHelper.active_job_present?
|
2
2
|
describe "Resque ActiveJob integration" do
|
3
|
-
let(:file) { File.expand_path(
|
3
|
+
let(:file) { File.expand_path("lib/appsignal/integrations/resque_active_job.rb") }
|
4
4
|
|
5
5
|
context "with Resque and ActiveJob" do
|
6
6
|
before do
|
@@ -17,17 +17,17 @@ if DependencyHelper.resque_present? && DependencyHelper.active_job_present?
|
|
17
17
|
|
18
18
|
describe :around_perform_plugin do
|
19
19
|
before { SecureRandom.stub(:uuid => 123) }
|
20
|
-
let(:job) { TestActiveJob.new(
|
20
|
+
let(:job) { TestActiveJob.new("moo") }
|
21
21
|
|
22
22
|
it "should wrap in a transaction with the correct params" do
|
23
23
|
Appsignal.should_receive(:monitor_single_transaction).with(
|
24
|
-
|
25
|
-
:class =>
|
26
|
-
:method =>
|
27
|
-
:params => [
|
24
|
+
"perform_job.resque",
|
25
|
+
:class => "TestActiveJob",
|
26
|
+
:method => "perform",
|
27
|
+
:params => ["moo"],
|
28
28
|
:metadata => {
|
29
29
|
:id => 123,
|
30
|
-
:queue =>
|
30
|
+
:queue => "default"
|
31
31
|
}
|
32
32
|
)
|
33
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
if DependencyHelper.resque_present?
|
2
2
|
describe "Resque integration" do
|
3
|
-
let(:file) { File.expand_path(
|
3
|
+
let(:file) { File.expand_path("lib/appsignal/integrations/resque.rb") }
|
4
4
|
|
5
5
|
context "with resque" do
|
6
6
|
before do
|
@@ -24,8 +24,8 @@ if DependencyHelper.resque_present?
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe :around_perform_resque_plugin do
|
27
|
-
let(:transaction) { Appsignal::Transaction.new(
|
28
|
-
let(:job) { ::Resque::Job.new(
|
27
|
+
let(:transaction) { Appsignal::Transaction.new("1", "background", {}, {}) }
|
28
|
+
let(:job) { ::Resque::Job.new("default", "class" => "TestJob") }
|
29
29
|
before do
|
30
30
|
transaction.stub(:complete => true)
|
31
31
|
Appsignal::Transaction.stub(:current => transaction)
|
@@ -39,9 +39,9 @@ if DependencyHelper.resque_present?
|
|
39
39
|
|
40
40
|
it "should wrap in a transaction with the correct params" do
|
41
41
|
Appsignal.should_receive(:monitor_transaction).with(
|
42
|
-
|
43
|
-
:class =>
|
44
|
-
:method =>
|
42
|
+
"perform_job.resque",
|
43
|
+
:class => "TestJob",
|
44
|
+
:method => "perform"
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
@@ -49,11 +49,11 @@ if DependencyHelper.resque_present?
|
|
49
49
|
transaction.should_receive(:complete)
|
50
50
|
end
|
51
51
|
|
52
|
-
after { job.perform
|
52
|
+
after { job.perform }
|
53
53
|
end
|
54
54
|
|
55
55
|
context "with exception" do
|
56
|
-
let(:job) { ::Resque::Job.new(
|
56
|
+
let(:job) { ::Resque::Job.new("default", "class" => "BrokenTestJob") }
|
57
57
|
|
58
58
|
it "should set the exception" do
|
59
59
|
Appsignal::Transaction.any_instance.should_receive(:set_error)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
if DependencyHelper.sinatra_present?
|
2
|
-
ENV[
|
3
|
-
require
|
2
|
+
ENV["APPSIGNAL_PUSH_API_KEY"] = "key"
|
3
|
+
require "appsignal/integrations/sinatra"
|
4
4
|
|
5
5
|
describe "Sinatra integration" do
|
6
6
|
context "Appsignal.logger" do
|
@@ -22,22 +22,22 @@ if DependencyHelper.sinatra_present?
|
|
22
22
|
|
23
23
|
context "without APPSIGNAL_APP_ENV" do
|
24
24
|
before do
|
25
|
-
load File.expand_path(
|
25
|
+
load File.expand_path("lib/appsignal/integrations/sinatra.rb", project_dir)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "uses the app environment" do
|
29
|
-
expect(subject).to eq(
|
29
|
+
expect(subject).to eq("test")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context "with APPSIGNAL_APP_ENV" do
|
34
34
|
before do
|
35
|
-
ENV[
|
36
|
-
load File.expand_path(
|
35
|
+
ENV["APPSIGNAL_APP_ENV"] = "env-staging"
|
36
|
+
load File.expand_path("lib/appsignal/integrations/sinatra.rb", project_dir)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "uses the environment variable" do
|
40
|
-
expect(subject).to eq(
|
40
|
+
expect(subject).to eq("env-staging")
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
if DependencyHelper.webmachine_present?
|
2
|
-
require
|
2
|
+
require "appsignal/integrations/webmachine"
|
3
3
|
|
4
4
|
describe Appsignal::Integrations::WebmachinePlugin::FSM do
|
5
5
|
let(:request) do
|
6
|
-
Webmachine::Request.new(
|
6
|
+
Webmachine::Request.new("GET", "http://google.com:80/foo", {}, nil)
|
7
7
|
end
|
8
8
|
let(:resource) { double(:trace? => false, :handle_exception => true) }
|
9
9
|
let(:response) { double }
|
@@ -14,41 +14,41 @@ if DependencyHelper.webmachine_present?
|
|
14
14
|
# Make sure the request responds to the method we need to get query params.
|
15
15
|
describe "request" do
|
16
16
|
it "should respond to `query`" do
|
17
|
-
expect(
|
17
|
+
expect(request).to respond_to(:query)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "#run_with_appsignal" do
|
22
22
|
before do
|
23
|
-
allow(
|
24
|
-
allow(
|
25
|
-
allow(
|
26
|
-
allow(
|
23
|
+
allow(fsm).to receive(:request).and_return(request)
|
24
|
+
allow(fsm).to receive(:run_without_appsignal).and_return(true)
|
25
|
+
allow(SecureRandom).to receive(:uuid).and_return("uuid")
|
26
|
+
allow(Appsignal::Transaction).to receive(:create).and_return(transaction)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should create a transaction" do
|
30
|
-
expect(
|
31
|
-
|
30
|
+
expect(Appsignal::Transaction).to receive(:create).with(
|
31
|
+
"uuid",
|
32
32
|
Appsignal::Transaction::HTTP_REQUEST,
|
33
33
|
request,
|
34
|
-
|
34
|
+
:params_method => :query
|
35
35
|
).and_return(transaction)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should set the action" do
|
39
|
-
expect(
|
39
|
+
expect(transaction).to receive(:set_action).with("RSpec::Mocks::Mock#GET")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should call the original method" do
|
43
|
-
expect(
|
43
|
+
expect(fsm).to receive(:run_without_appsignal)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should instrument the original method" do
|
47
|
-
expect(
|
47
|
+
expect(Appsignal).to receive(:instrument).with("process_action.webmachine")
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should close the transaction" do
|
51
|
-
expect(
|
51
|
+
expect(Appsignal::Transaction).to receive(:complete_current!)
|
52
52
|
end
|
53
53
|
|
54
54
|
after { fsm.run }
|
@@ -58,7 +58,7 @@ if DependencyHelper.webmachine_present?
|
|
58
58
|
let(:error) { VerySpecificError.new }
|
59
59
|
|
60
60
|
it "should catch the error and send it to AppSignal" do
|
61
|
-
expect(
|
61
|
+
expect(Appsignal).to receive(:set_error).with(error)
|
62
62
|
end
|
63
63
|
|
64
64
|
after do
|
@@ -1,27 +1,27 @@
|
|
1
1
|
describe Appsignal::JSExceptionTransaction do
|
2
|
-
before { SecureRandom.stub(:uuid =>
|
2
|
+
before { SecureRandom.stub(:uuid => "123abc") }
|
3
3
|
|
4
4
|
let!(:transaction) { Appsignal::JSExceptionTransaction.new(data) }
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
"name" => "TypeError",
|
8
|
+
"message" => "foo is not a valid method",
|
9
|
+
"action" => "ExceptionIncidentComponent",
|
10
|
+
"path" => "foo.bar/moo",
|
11
|
+
"environment" => "development",
|
12
|
+
"backtrace" => [
|
13
|
+
"foo.bar/js:11:1",
|
14
|
+
"foo.bar/js:22:2"
|
15
15
|
],
|
16
|
-
|
17
|
-
|
16
|
+
"tags" => [
|
17
|
+
"tag1"
|
18
18
|
]
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "#initialize" do
|
23
23
|
it "should call all required methods" do
|
24
|
-
expect(Appsignal::Extension).to receive(:start_transaction).with(
|
24
|
+
expect(Appsignal::Extension).to receive(:start_transaction).with("123abc", "frontend", 0).and_return(1)
|
25
25
|
|
26
26
|
expect(transaction).to receive(:set_action)
|
27
27
|
expect(transaction).to receive(:set_metadata)
|
@@ -37,7 +37,7 @@ describe Appsignal::JSExceptionTransaction do
|
|
37
37
|
describe "#set_action" do
|
38
38
|
it "should call `Appsignal::Extension.set_action`" do
|
39
39
|
expect(transaction.ext).to receive(:set_action).with(
|
40
|
-
|
40
|
+
"ExceptionIncidentComponent"
|
41
41
|
)
|
42
42
|
|
43
43
|
transaction.set_action
|
@@ -47,8 +47,8 @@ describe Appsignal::JSExceptionTransaction do
|
|
47
47
|
describe "#set_metadata" do
|
48
48
|
it "should call `Appsignal::Extension.set_transaction_metadata`" do
|
49
49
|
expect(transaction.ext).to receive(:set_metadata).with(
|
50
|
-
|
51
|
-
|
50
|
+
"path",
|
51
|
+
"foo.bar/moo"
|
52
52
|
)
|
53
53
|
|
54
54
|
transaction.set_metadata
|
@@ -58,9 +58,9 @@ describe Appsignal::JSExceptionTransaction do
|
|
58
58
|
describe "#set_error" do
|
59
59
|
it "should call `Appsignal::Extension.set_transaction_error`" do
|
60
60
|
expect(transaction.ext).to receive(:set_error).with(
|
61
|
-
|
62
|
-
|
63
|
-
Appsignal::Utils.data_generate([
|
61
|
+
"TypeError",
|
62
|
+
"foo is not a valid method",
|
63
|
+
Appsignal::Utils.data_generate(["foo.bar/js:11:1", "foo.bar/js:22:2"])
|
64
64
|
)
|
65
65
|
|
66
66
|
transaction.set_error
|
@@ -70,8 +70,8 @@ describe Appsignal::JSExceptionTransaction do
|
|
70
70
|
describe "#set_sample_data" do
|
71
71
|
it "should call `Appsignal::Extension.set_transaction_error_data`" do
|
72
72
|
expect(transaction.ext).to receive(:set_sample_data).with(
|
73
|
-
|
74
|
-
Appsignal::Utils.data_generate([
|
73
|
+
"tags",
|
74
|
+
Appsignal::Utils.data_generate(["tag1"])
|
75
75
|
)
|
76
76
|
|
77
77
|
transaction.set_sample_data
|
@@ -79,7 +79,7 @@ describe Appsignal::JSExceptionTransaction do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
context "when sending just the name" do
|
82
|
-
let(:data) { {
|
82
|
+
let(:data) { { "name" => "TypeError" } }
|
83
83
|
|
84
84
|
describe "#set_action" do
|
85
85
|
it "should not call `Appsignal::Extension.set_action`" do
|
@@ -100,8 +100,8 @@ describe Appsignal::JSExceptionTransaction do
|
|
100
100
|
describe "#set_error" do
|
101
101
|
it "should call `Appsignal::Extension.set_transaction_error` with just the name" do
|
102
102
|
expect(transaction.ext).to receive(:set_error).with(
|
103
|
-
|
104
|
-
|
103
|
+
"TypeError",
|
104
|
+
"",
|
105
105
|
Appsignal::Utils.data_generate([])
|
106
106
|
)
|
107
107
|
|
@@ -3,10 +3,10 @@ describe Appsignal::Marker do
|
|
3
3
|
let(:marker) do
|
4
4
|
described_class.new(
|
5
5
|
{
|
6
|
-
:revision =>
|
7
|
-
:repository =>
|
8
|
-
:user =>
|
9
|
-
:rails_env =>
|
6
|
+
:revision => "503ce0923ed177a3ce000005",
|
7
|
+
:repository => "master",
|
8
|
+
:user => "batman",
|
9
|
+
:rails_env => "production"
|
10
10
|
},
|
11
11
|
config
|
12
12
|
)
|
@@ -29,8 +29,8 @@ describe Appsignal::Marker do
|
|
29
29
|
it "outputs success" do
|
30
30
|
run
|
31
31
|
expect(output).to include \
|
32
|
-
|
33
|
-
|
32
|
+
"Notifying AppSignal of deploy with: revision: 503ce0923ed177a3ce000005, user: batman",
|
33
|
+
"AppSignal has been notified of this deploy!"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,11 +40,11 @@ describe Appsignal::Marker do
|
|
40
40
|
it "outputs failure" do
|
41
41
|
run
|
42
42
|
expect(output).to include \
|
43
|
-
|
43
|
+
"Notifying AppSignal of deploy with: revision: 503ce0923ed177a3ce000005, user: batman",
|
44
44
|
"Something went wrong while trying to notify AppSignal: 500 at "\
|
45
45
|
"#{config[:endpoint]}/1/markers"
|
46
46
|
expect(output).to_not include \
|
47
|
-
|
47
|
+
"AppSignal has been notified of this deploy!"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -4,13 +4,13 @@ describe Appsignal::Minutely do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
it "should have a list of probes" do
|
7
|
-
expect(
|
7
|
+
expect(Appsignal::Minutely.probes).to be_instance_of(Array)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe ".start" do
|
11
11
|
it "should call the probes periodically" do
|
12
12
|
probe = double
|
13
|
-
expect(
|
13
|
+
expect(probe).to receive(:call).at_least(:twice)
|
14
14
|
Appsignal::Minutely.probes << probe
|
15
15
|
Appsignal::Minutely.stub(:wait_time => 0.1)
|
16
16
|
|
@@ -23,18 +23,18 @@ describe Appsignal::Minutely do
|
|
23
23
|
describe ".wait_time" do
|
24
24
|
it "should get the time to the next minute" do
|
25
25
|
Time.any_instance.stub(:sec => 30)
|
26
|
-
expect(
|
26
|
+
expect(Appsignal::Minutely.wait_time).to eq 30
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe ".add_gc_probe" do
|
31
31
|
it "should add the gc probe to the list" do
|
32
|
-
expect(
|
32
|
+
expect(Appsignal::Minutely.probes).to be_empty
|
33
33
|
|
34
34
|
Appsignal::Minutely.add_gc_probe
|
35
35
|
|
36
|
-
expect(
|
37
|
-
expect(
|
36
|
+
expect(Appsignal::Minutely.probes).to have(1).item
|
37
|
+
expect(Appsignal::Minutely.probes[0]).to be_instance_of(Appsignal::Minutely::GCProbe)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -4,7 +4,7 @@ describe Appsignal::Rack::GenericInstrumentation do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
let(:app) { double(:call => true) }
|
7
|
-
let(:env) { {:path =>
|
7
|
+
let(:env) { { :path => "/", :method => "GET" } }
|
8
8
|
let(:options) { {} }
|
9
9
|
let(:middleware) { Appsignal::Rack::GenericInstrumentation.new(app, options) }
|
10
10
|
|
@@ -17,7 +17,7 @@ describe Appsignal::Rack::GenericInstrumentation do
|
|
17
17
|
before { Appsignal.stub(:active? => true) }
|
18
18
|
|
19
19
|
it "should call with monitoring" do
|
20
|
-
expect(
|
20
|
+
expect(middleware).to receive(:call_with_appsignal_monitoring).with(env)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,11 +25,11 @@ describe Appsignal::Rack::GenericInstrumentation do
|
|
25
25
|
before { Appsignal.stub(:active? => false) }
|
26
26
|
|
27
27
|
it "should not call with monitoring" do
|
28
|
-
expect(
|
28
|
+
expect(middleware).to_not receive(:call_with_appsignal_monitoring)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should call the stack" do
|
32
|
-
expect(
|
32
|
+
expect(app).to receive(:call).with(env)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -63,16 +63,16 @@ describe Appsignal::Rack::GenericInstrumentation do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should set the action to unknown" do
|
66
|
-
Appsignal::Transaction.any_instance.should_receive(:set_action).with(
|
66
|
+
Appsignal::Transaction.any_instance.should_receive(:set_action).with("unknown")
|
67
67
|
end
|
68
68
|
|
69
69
|
context "with a route specified in the env" do
|
70
70
|
before do
|
71
|
-
env[
|
71
|
+
env["appsignal.route"] = "GET /"
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should set the action" do
|
75
|
-
Appsignal::Transaction.any_instance.should_receive(:set_action).with(
|
75
|
+
Appsignal::Transaction.any_instance.should_receive(:set_action).with("GET /")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|