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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +43 -0
  4. data/.rubocop_todo.yml +289 -0
  5. data/.travis.yml +4 -0
  6. data/CHANGELOG.md +11 -1
  7. data/Gemfile +1 -1
  8. data/LICENSE +1 -1
  9. data/appsignal.gemspec +1 -0
  10. data/bin/appsignal +2 -2
  11. data/ext/agent.yml +11 -11
  12. data/ext/extconf.rb +33 -33
  13. data/gemfiles/rails-4.2.gemfile +4 -0
  14. data/gemfiles/resque.gemfile +4 -0
  15. data/lib/appsignal.rb +58 -54
  16. data/lib/appsignal/auth_check.rb +15 -16
  17. data/lib/appsignal/capistrano.rb +4 -4
  18. data/lib/appsignal/cli.rb +28 -28
  19. data/lib/appsignal/cli/diagnose.rb +11 -11
  20. data/lib/appsignal/cli/helpers.rb +1 -1
  21. data/lib/appsignal/cli/install.rb +38 -38
  22. data/lib/appsignal/cli/notify_of_deploy.rb +1 -1
  23. data/lib/appsignal/config.rb +73 -71
  24. data/lib/appsignal/event_formatter.rb +8 -8
  25. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +4 -4
  26. data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +1 -1
  27. data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +1 -1
  28. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +9 -7
  29. data/lib/appsignal/event_formatter/faraday/request_formatter.rb +1 -1
  30. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +6 -6
  31. data/lib/appsignal/event_formatter/moped/query_formatter.rb +56 -43
  32. data/lib/appsignal/extension.rb +5 -5
  33. data/lib/appsignal/hooks.rb +28 -26
  34. data/lib/appsignal/hooks/active_support_notifications.rb +2 -2
  35. data/lib/appsignal/hooks/celluloid.rb +1 -1
  36. data/lib/appsignal/hooks/data_mapper.rb +2 -2
  37. data/lib/appsignal/hooks/delayed_job.rb +1 -1
  38. data/lib/appsignal/hooks/mongo_ruby_driver.rb +1 -1
  39. data/lib/appsignal/hooks/net_http.rb +4 -4
  40. data/lib/appsignal/hooks/passenger.rb +2 -2
  41. data/lib/appsignal/hooks/puma.rb +4 -4
  42. data/lib/appsignal/hooks/rake.rb +1 -1
  43. data/lib/appsignal/hooks/redis.rb +1 -1
  44. data/lib/appsignal/hooks/sequel.rb +2 -2
  45. data/lib/appsignal/hooks/shoryuken.rb +8 -8
  46. data/lib/appsignal/hooks/sidekiq.rb +16 -15
  47. data/lib/appsignal/hooks/unicorn.rb +1 -1
  48. data/lib/appsignal/hooks/webmachine.rb +1 -1
  49. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +6 -6
  50. data/lib/appsignal/integrations/data_mapper.rb +2 -3
  51. data/lib/appsignal/integrations/delayed_job_plugin.rb +5 -5
  52. data/lib/appsignal/integrations/mongo_ruby_driver.rb +6 -6
  53. data/lib/appsignal/integrations/padrino.rb +8 -8
  54. data/lib/appsignal/integrations/railtie.rb +5 -5
  55. data/lib/appsignal/integrations/resque.rb +4 -5
  56. data/lib/appsignal/integrations/resque_active_job.rb +3 -6
  57. data/lib/appsignal/integrations/sinatra.rb +2 -2
  58. data/lib/appsignal/integrations/webmachine.rb +2 -3
  59. data/lib/appsignal/js_exception_transaction.rb +10 -10
  60. data/lib/appsignal/marker.rb +3 -3
  61. data/lib/appsignal/rack/generic_instrumentation.rb +10 -9
  62. data/lib/appsignal/rack/js_exception_catcher.rb +7 -6
  63. data/lib/appsignal/rack/rails_instrumentation.rb +9 -8
  64. data/lib/appsignal/rack/sinatra_instrumentation.rb +19 -17
  65. data/lib/appsignal/rack/streaming_listener.rb +9 -8
  66. data/lib/appsignal/system.rb +19 -17
  67. data/lib/appsignal/transaction.rb +97 -40
  68. data/lib/appsignal/transmitter.rb +23 -30
  69. data/lib/appsignal/utils.rb +3 -3
  70. data/lib/appsignal/utils/params_sanitizer.rb +1 -1
  71. data/lib/appsignal/utils/query_params_sanitizer.rb +1 -1
  72. data/lib/appsignal/version.rb +2 -2
  73. data/spec/.rubocop.yml +4 -0
  74. data/spec/lib/appsignal/auth_check_spec.rb +7 -7
  75. data/spec/lib/appsignal/capistrano2_spec.rb +41 -41
  76. data/spec/lib/appsignal/capistrano3_spec.rb +43 -44
  77. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +9 -11
  78. data/spec/lib/appsignal/cli_spec.rb +9 -9
  79. data/spec/lib/appsignal/config_spec.rb +88 -86
  80. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +9 -9
  81. data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +4 -4
  82. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +4 -4
  83. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +12 -12
  84. data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +4 -4
  85. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +23 -23
  86. data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +29 -30
  87. data/spec/lib/appsignal/event_formatter_spec.rb +28 -28
  88. data/spec/lib/appsignal/extension_spec.rb +15 -15
  89. data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +6 -5
  90. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +12 -12
  91. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +34 -34
  92. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +3 -3
  93. data/spec/lib/appsignal/hooks/net_http_spec.rb +10 -10
  94. data/spec/lib/appsignal/hooks/rake_spec.rb +7 -7
  95. data/spec/lib/appsignal/hooks/redis_spec.rb +6 -6
  96. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +21 -22
  97. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +48 -45
  98. data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -2
  99. data/spec/lib/appsignal/hooks_spec.rb +16 -17
  100. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +7 -8
  101. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +19 -19
  102. data/spec/lib/appsignal/integrations/object_spec.rb +3 -3
  103. data/spec/lib/appsignal/integrations/padrino_spec.rb +44 -44
  104. data/spec/lib/appsignal/integrations/railtie_spec.rb +13 -13
  105. data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +7 -7
  106. data/spec/lib/appsignal/integrations/resque_spec.rb +8 -8
  107. data/spec/lib/appsignal/integrations/sinatra_spec.rb +7 -7
  108. data/spec/lib/appsignal/integrations/webmachine_spec.rb +15 -15
  109. data/spec/lib/appsignal/js_exception_transaction_spec.rb +23 -23
  110. data/spec/lib/appsignal/marker_spec.rb +8 -8
  111. data/spec/lib/appsignal/minutely_spec.rb +6 -6
  112. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +7 -7
  113. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +13 -13
  114. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +11 -11
  115. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +21 -21
  116. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +36 -36
  117. data/spec/lib/appsignal/system/container_spec.rb +1 -1
  118. data/spec/lib/appsignal/transaction_spec.rb +213 -184
  119. data/spec/lib/appsignal/transmitter_spec.rb +20 -20
  120. data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +19 -19
  121. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +41 -41
  122. data/spec/lib/appsignal/utils_spec.rb +41 -37
  123. data/spec/lib/appsignal_spec.rb +150 -142
  124. data/spec/spec_helper.rb +18 -18
  125. data/spec/support/delegate_matcher.rb +6 -6
  126. data/spec/support/helpers/api_request_helper.rb +2 -2
  127. data/spec/support/helpers/config_helpers.rb +3 -3
  128. data/spec/support/helpers/dependency_helper.rb +13 -13
  129. data/spec/support/helpers/directory_helper.rb +5 -5
  130. data/spec/support/helpers/env_helpers.rb +14 -14
  131. data/spec/support/helpers/system_helpers.rb +3 -3
  132. data/spec/support/helpers/transaction_helpers.rb +10 -10
  133. metadata +20 -2
@@ -57,10 +57,8 @@ describe Appsignal::CLI::NotifyOfDeploy do
57
57
  let(:config) { project_fixture_config }
58
58
  before do
59
59
  config[:name] = options[:name] if options[:name]
60
- stub_api_request config, "markers", {
61
- :revision => options[:revision],
60
+ stub_api_request config, "markers", :revision => options[:revision],
62
61
  :user => options[:user]
63
- }
64
62
  end
65
63
  around do |example|
66
64
  Dir.chdir project_fixture_path do
@@ -69,7 +67,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
69
67
  end
70
68
 
71
69
  context "without environment" do
72
- let(:options) { {:environment => "", :revision => "foo", :user => "thijs"} }
70
+ let(:options) { { :environment => "", :revision => "foo", :user => "thijs" } }
73
71
  before do
74
72
  # Makes the config "active"
75
73
  ENV["APPSIGNAL_PUSH_API_KEY"] = "foo"
@@ -83,7 +81,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
83
81
  end
84
82
 
85
83
  context "without known environment" do
86
- let(:options) { {:environment => "foo"} }
84
+ let(:options) { { :environment => "foo" } }
87
85
 
88
86
  it "prints a config error" do
89
87
  expect { run }.to raise_error(SystemExit)
@@ -95,7 +93,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
95
93
 
96
94
  context "with known environment" do
97
95
  context "without required options" do
98
- let(:options) { {:environment => "production"} }
96
+ let(:options) { { :environment => "production" } }
99
97
 
100
98
  it "prints a missing required options error" do
101
99
  expect { run }.to raise_error(SystemExit)
@@ -105,7 +103,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
105
103
  end
106
104
 
107
105
  context "with empty required option" do
108
- let(:options) { {:environment => "production", :revision => "foo", :user => ""} }
106
+ let(:options) { { :environment => "production", :revision => "foo", :user => "" } }
109
107
 
110
108
  it "prints a missing required option error" do
111
109
  expect { run }.to raise_error(SystemExit)
@@ -117,7 +115,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
117
115
  end
118
116
 
119
117
  context "with required options" do
120
- let(:options) { {:environment => "production", :revision => "aaaaa", :user => "thijs"} }
118
+ let(:options) { { :environment => "production", :revision => "aaaaa", :user => "thijs" } }
121
119
 
122
120
  it "notifies of a deploy" do
123
121
  run
@@ -130,7 +128,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
130
128
  before { ENV["APPSIGNAL_APP_NAME"] = "" }
131
129
 
132
130
  context "without name option" do
133
- let(:options) { {:environment => "production", :revision => "aaaaa", :user => "thijs"} }
131
+ let(:options) { { :environment => "production", :revision => "aaaaa", :user => "thijs" } }
134
132
 
135
133
  it "requires name option" do
136
134
  expect { run }.to raise_error(SystemExit)
@@ -141,7 +139,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
141
139
  end
142
140
 
143
141
  context "with name option" do
144
- let(:options) { {:environment => "production", :revision => "aaaaa", :user => "thijs", :name => "foo"} }
142
+ let(:options) { { :environment => "production", :revision => "aaaaa", :user => "thijs", :name => "foo" } }
145
143
 
146
144
  it "notifies of a deploy with a custom name" do
147
145
  run
@@ -154,7 +152,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
154
152
 
155
153
  context "with name option" do
156
154
  let(:options) do
157
- {:environment => "production", :revision => "aaaaa", :user => "thijs", :name => "foo"}
155
+ { :environment => "production", :revision => "aaaaa", :user => "thijs", :name => "foo" }
158
156
  end
159
157
 
160
158
  it "notifies of a deploy with a custom name" do
@@ -1,4 +1,4 @@
1
- require 'appsignal/cli'
1
+ require "appsignal/cli"
2
2
 
3
3
  describe Appsignal::CLI do
4
4
  let(:out_stream) { std_stream }
@@ -7,36 +7,36 @@ describe Appsignal::CLI do
7
7
  before { Dir.stub(:pwd => project_fixture_path) }
8
8
 
9
9
  it "should print the help with no arguments, -h and --help" do
10
- [nil, '-h', '--help'].each do |arg|
10
+ [nil, "-h", "--help"].each do |arg|
11
11
  expect do
12
12
  capture_stdout(out_stream) do
13
13
  cli.run([arg].compact)
14
14
  end
15
15
  end.to raise_error(SystemExit)
16
16
 
17
- expect(output).to include 'appsignal <command> [options]'
17
+ expect(output).to include "appsignal <command> [options]"
18
18
  expect(output).to include \
19
- 'Available commands: demo, diagnose, install, notify_of_deploy'
19
+ "Available commands: demo, diagnose, install, notify_of_deploy"
20
20
  end
21
21
  end
22
22
 
23
23
  it "should print the version with -v and --version" do
24
- ['-v', '--version'].each do |arg|
24
+ ["-v", "--version"].each do |arg|
25
25
  expect do
26
26
  capture_stdout(out_stream) do
27
27
  cli.run([arg])
28
28
  end
29
29
  end.to raise_error(SystemExit)
30
30
 
31
- expect(output).to include 'AppSignal'
32
- expect(output).to include '.'
31
+ expect(output).to include "AppSignal"
32
+ expect(output).to include "."
33
33
  end
34
34
  end
35
35
 
36
36
  it "should print a notice if a command does not exist" do
37
37
  expect do
38
38
  capture_stdout(out_stream) do
39
- cli.run(['nonsense'])
39
+ cli.run(["nonsense"])
40
40
  end
41
41
  end.to raise_error(SystemExit)
42
42
 
@@ -49,7 +49,7 @@ describe Appsignal::CLI do
49
49
  Appsignal::CLI::Diagnose.should_receive(:run)
50
50
 
51
51
  cli.run([
52
- 'diagnose'
52
+ "diagnose"
53
53
  ])
54
54
  end
55
55
  end
@@ -114,7 +114,7 @@ describe Appsignal::Config do
114
114
  it "merges with the default config" do
115
115
  expect(config.config_hash).to eq(
116
116
  :debug => false,
117
- :log => 'file',
117
+ :log => "file",
118
118
  :ignore_errors => [],
119
119
  :ignore_actions => [],
120
120
  :filter_parameters => [],
@@ -123,19 +123,19 @@ describe Appsignal::Config do
123
123
  :instrument_sequel => true,
124
124
  :skip_session_data => false,
125
125
  :send_params => true,
126
- :endpoint => 'https://push.appsignal.com',
127
- :push_api_key => 'abc',
128
- :name => 'TestApp',
126
+ :endpoint => "https://push.appsignal.com",
127
+ :push_api_key => "abc",
128
+ :name => "TestApp",
129
129
  :active => true,
130
130
  :enable_frontend_error_catching => false,
131
- :frontend_error_catching_path => '/appsignal_error_catcher',
131
+ :frontend_error_catching_path => "/appsignal_error_catcher",
132
132
  :enable_allocation_tracking => true,
133
133
  :enable_gc_instrumentation => false,
134
134
  :running_in_container => false,
135
135
  :enable_host_metrics => true,
136
136
  :enable_minutely_probes => false,
137
137
  :hostname => Socket.gethostname,
138
- :ca_file_path => File.join(resources_dir, 'cacert.pem')
138
+ :ca_file_path => File.join(resources_dir, "cacert.pem")
139
139
  )
140
140
  end
141
141
 
@@ -177,7 +177,7 @@ describe Appsignal::Config do
177
177
  end
178
178
 
179
179
  context "when root path is nil" do
180
- let(:config) { described_class.new(nil, 'production') }
180
+ let(:config) { described_class.new(nil, "production") }
181
181
 
182
182
  it "is not valid or active" do
183
183
  expect(config.valid?).to be_false
@@ -186,7 +186,7 @@ describe Appsignal::Config do
186
186
  end
187
187
 
188
188
  context "without config file" do
189
- let(:config) { described_class.new(tmp_dir, 'production') }
189
+ let(:config) { described_class.new(tmp_dir, "production") }
190
190
 
191
191
  it "is not valid or active" do
192
192
  expect(config.valid?).to be_false
@@ -195,7 +195,7 @@ describe Appsignal::Config do
195
195
  end
196
196
 
197
197
  context "with a config file" do
198
- let(:config) { project_fixture_config('production') }
198
+ let(:config) { project_fixture_config("production") }
199
199
 
200
200
  it "is not valid or active" do
201
201
  expect(config.valid?).to be_true
@@ -231,12 +231,12 @@ describe Appsignal::Config do
231
231
  expect(config.valid?).to be_true
232
232
  expect(config.active?).to be_true
233
233
 
234
- expect(config[:push_api_key]).to eq('abc')
234
+ expect(config[:push_api_key]).to eq("abc")
235
235
  end
236
236
  end
237
237
 
238
238
  context "without the selected env" do
239
- let(:config) { project_fixture_config('nonsense') }
239
+ let(:config) { project_fixture_config("nonsense") }
240
240
 
241
241
  it "is not valid or active" do
242
242
  expect(config.valid?).to be_false
@@ -257,18 +257,18 @@ describe Appsignal::Config do
257
257
  subject { config[:push_api_key] }
258
258
 
259
259
  context "without :push_api_key" do
260
- let(:config) { project_fixture_config('old_config') }
260
+ let(:config) { project_fixture_config("old_config") }
261
261
 
262
262
  it "sets the :push_api_key with the old :api_key value" do
263
- expect(subject).to eq 'def'
263
+ expect(subject).to eq "def"
264
264
  end
265
265
  end
266
266
 
267
267
  context "with :push_api_key" do
268
- let(:config) { project_fixture_config('old_config_mixed_with_new_config') }
268
+ let(:config) { project_fixture_config("old_config_mixed_with_new_config") }
269
269
 
270
270
  it "ignores the :api_key config" do
271
- expect(subject).to eq 'ghi'
271
+ expect(subject).to eq "ghi"
272
272
  end
273
273
  end
274
274
  end
@@ -277,18 +277,18 @@ describe Appsignal::Config do
277
277
  subject { config[:ignore_errors] }
278
278
 
279
279
  context "without :ignore_errors" do
280
- let(:config) { project_fixture_config('old_config') }
280
+ let(:config) { project_fixture_config("old_config") }
281
281
 
282
282
  it "sets :ignore_errors with the old :ignore_exceptions value" do
283
- expect(subject).to eq ['StandardError']
283
+ expect(subject).to eq ["StandardError"]
284
284
  end
285
285
  end
286
286
 
287
287
  context "with :ignore_errors" do
288
- let(:config) { project_fixture_config('old_config_mixed_with_new_config') }
288
+ let(:config) { project_fixture_config("old_config_mixed_with_new_config") }
289
289
 
290
290
  it "ignores the :ignore_exceptions config" do
291
- expect(subject).to eq ['NoMethodError']
291
+ expect(subject).to eq ["NoMethodError"]
292
292
  end
293
293
  end
294
294
  end
@@ -305,12 +305,12 @@ describe Appsignal::Config do
305
305
  )
306
306
  end
307
307
  before do
308
- ENV['APPSIGNAL_RUNNING_IN_CONTAINER'] = 'true'
309
- ENV['APPSIGNAL_PUSH_API_KEY'] = 'aaa-bbb-ccc'
310
- ENV['APPSIGNAL_ACTIVE'] = 'true'
311
- ENV['APPSIGNAL_APP_NAME'] = 'App name'
312
- ENV['APPSIGNAL_DEBUG'] = 'true'
313
- ENV['APPSIGNAL_IGNORE_ACTIONS'] = 'action1,action2'
308
+ ENV["APPSIGNAL_RUNNING_IN_CONTAINER"] = "true"
309
+ ENV["APPSIGNAL_PUSH_API_KEY"] = "aaa-bbb-ccc"
310
+ ENV["APPSIGNAL_ACTIVE"] = "true"
311
+ ENV["APPSIGNAL_APP_NAME"] = "App name"
312
+ ENV["APPSIGNAL_DEBUG"] = "true"
313
+ ENV["APPSIGNAL_IGNORE_ACTIONS"] = "action1,action2"
314
314
  end
315
315
  around { |example| recognize_as_container(:none) { example.run } }
316
316
 
@@ -319,11 +319,11 @@ describe Appsignal::Config do
319
319
  expect(config.active?).to be_true
320
320
 
321
321
  expect(config[:running_in_container]).to be_true
322
- expect(config[:push_api_key]).to eq 'aaa-bbb-ccc'
322
+ expect(config[:push_api_key]).to eq "aaa-bbb-ccc"
323
323
  expect(config[:active]).to be_true
324
- expect(config[:name]).to eq 'App name'
324
+ expect(config[:name]).to eq "App name"
325
325
  expect(config[:debug]).to be_true
326
- expect(config[:ignore_actions]).to eq ['action1', 'action2']
326
+ expect(config[:ignore_actions]).to eq ["action1", "action2"]
327
327
  end
328
328
  end
329
329
 
@@ -333,30 +333,30 @@ describe Appsignal::Config do
333
333
 
334
334
  context "with an pre-0.12-style endpoint" do
335
335
  let(:config) do
336
- project_fixture_config('production', :endpoint => 'https://push.appsignal.com/1')
336
+ project_fixture_config("production", :endpoint => "https://push.appsignal.com/1")
337
337
  end
338
338
 
339
339
  it "strips off the path" do
340
- expect(subject).to eq 'https://push.appsignal.com'
340
+ expect(subject).to eq "https://push.appsignal.com"
341
341
  end
342
342
  end
343
343
 
344
344
  context "with a non-standard port" do
345
- let(:config) { project_fixture_config('production', :endpoint => 'http://localhost:4567') }
345
+ let(:config) { project_fixture_config("production", :endpoint => "http://localhost:4567") }
346
346
 
347
347
  it "keeps the port" do
348
- expect(subject).to eq 'http://localhost:4567'
348
+ expect(subject).to eq "http://localhost:4567"
349
349
  end
350
350
  end
351
351
  end
352
352
  end
353
353
 
354
354
  describe "#[]" do
355
- let(:config) { project_fixture_config(:none, :push_api_key => 'foo') }
355
+ let(:config) { project_fixture_config(:none, :push_api_key => "foo") }
356
356
 
357
357
  context "with existing key" do
358
358
  it "gets the value" do
359
- expect(config[:push_api_key]).to eq 'foo'
359
+ expect(config[:push_api_key]).to eq "foo"
360
360
  end
361
361
  end
362
362
 
@@ -373,16 +373,16 @@ describe Appsignal::Config do
373
373
  context "with existing key" do
374
374
  it "changes the value" do
375
375
  expect(config[:push_api_key]).to be_nil
376
- config[:push_api_key] = 'abcde'
377
- expect(config[:push_api_key]).to eq 'abcde'
376
+ config[:push_api_key] = "abcde"
377
+ expect(config[:push_api_key]).to eq "abcde"
378
378
  end
379
379
  end
380
380
 
381
381
  context "with new key" do
382
382
  it "sets the value" do
383
383
  expect(config[:foo]).to be_nil
384
- config[:foo] = 'bar'
385
- expect(config[:foo]).to eq 'bar'
384
+ config[:foo] = "bar"
385
+ expect(config[:foo]).to eq "bar"
386
386
  end
387
387
  end
388
388
  end
@@ -390,48 +390,50 @@ describe Appsignal::Config do
390
390
  describe "#write_to_environment" do
391
391
  let(:config) { project_fixture_config(:production) }
392
392
  before do
393
- config[:http_proxy] = 'http://localhost'
394
- config[:ignore_actions] = ['action1', 'action2']
395
- config[:log_path] = '/tmp'
396
- config[:hostname] = 'app1.local'
393
+ config[:http_proxy] = "http://localhost"
394
+ config[:ignore_actions] = ["action1", "action2"]
395
+ config[:ignore_errors] = ["VerySpecificError", "AnotherError"]
396
+ config[:log_path] = "/tmp"
397
+ config[:hostname] = "app1.local"
397
398
  config[:filter_parameters] = %w(password confirm_password)
398
399
  config[:running_in_container] = false
399
400
  config.write_to_environment
400
401
  end
401
402
 
402
403
  it "writes the current config to environment variables" do
403
- expect(ENV['APPSIGNAL_ACTIVE']).to eq 'true'
404
- expect(ENV['APPSIGNAL_APP_PATH']).to end_with('spec/support/project_fixture')
405
- expect(ENV['APPSIGNAL_AGENT_PATH']).to end_with('/ext')
406
- expect(ENV['APPSIGNAL_DEBUG_LOGGING']).to eq 'false'
407
- expect(ENV['APPSIGNAL_LOG_FILE_PATH']).to end_with('/tmp/appsignal.log')
408
- expect(ENV['APPSIGNAL_PUSH_API_ENDPOINT']).to eq 'https://push.appsignal.com'
409
- expect(ENV['APPSIGNAL_PUSH_API_KEY']).to eq 'abc'
410
- expect(ENV['APPSIGNAL_APP_NAME']).to eq 'TestApp'
411
- expect(ENV['APPSIGNAL_ENVIRONMENT']).to eq 'production'
412
- expect(ENV['APPSIGNAL_AGENT_VERSION']).to eq Appsignal::Extension.agent_version
413
- expect(ENV['APPSIGNAL_LANGUAGE_INTEGRATION_VERSION']).to eq "ruby-#{Appsignal::VERSION}"
414
- expect(ENV['APPSIGNAL_HTTP_PROXY']).to eq 'http://localhost'
415
- expect(ENV['APPSIGNAL_IGNORE_ACTIONS']).to eq 'action1,action2'
416
- expect(ENV['APPSIGNAL_FILTER_PARAMETERS']).to eq 'password,confirm_password'
417
- expect(ENV['APPSIGNAL_SEND_PARAMS']).to eq 'true'
418
- expect(ENV['APPSIGNAL_RUNNING_IN_CONTAINER']).to eq 'false'
419
- expect(ENV['APPSIGNAL_ENABLE_HOST_METRICS']).to eq 'true'
420
- expect(ENV['APPSIGNAL_ENABLE_MINUTELY_PROBES']).to eq 'false'
421
- expect(ENV['APPSIGNAL_HOSTNAME']).to eq 'app1.local'
422
- expect(ENV['APPSIGNAL_PROCESS_NAME']).to include 'rspec'
423
- expect(ENV['APPSIGNAL_CA_FILE_PATH']).to eq File.join(resources_dir, "cacert.pem")
424
- expect(ENV).to_not have_key('APPSIGNAL_WORKING_DIR_PATH')
404
+ expect(ENV["APPSIGNAL_ACTIVE"]).to eq "true"
405
+ expect(ENV["APPSIGNAL_APP_PATH"]).to end_with("spec/support/project_fixture")
406
+ expect(ENV["APPSIGNAL_AGENT_PATH"]).to end_with("/ext")
407
+ expect(ENV["APPSIGNAL_DEBUG_LOGGING"]).to eq "false"
408
+ expect(ENV["APPSIGNAL_LOG_FILE_PATH"]).to end_with("/tmp/appsignal.log")
409
+ expect(ENV["APPSIGNAL_PUSH_API_ENDPOINT"]).to eq "https://push.appsignal.com"
410
+ expect(ENV["APPSIGNAL_PUSH_API_KEY"]).to eq "abc"
411
+ expect(ENV["APPSIGNAL_APP_NAME"]).to eq "TestApp"
412
+ expect(ENV["APPSIGNAL_ENVIRONMENT"]).to eq "production"
413
+ expect(ENV["APPSIGNAL_AGENT_VERSION"]).to eq Appsignal::Extension.agent_version
414
+ expect(ENV["APPSIGNAL_LANGUAGE_INTEGRATION_VERSION"]).to eq "ruby-#{Appsignal::VERSION}"
415
+ expect(ENV["APPSIGNAL_HTTP_PROXY"]).to eq "http://localhost"
416
+ expect(ENV["APPSIGNAL_IGNORE_ACTIONS"]).to eq "action1,action2"
417
+ expect(ENV["APPSIGNAL_IGNORE_ERRORS"]).to eq "VerySpecificError,AnotherError"
418
+ expect(ENV["APPSIGNAL_FILTER_PARAMETERS"]).to eq "password,confirm_password"
419
+ expect(ENV["APPSIGNAL_SEND_PARAMS"]).to eq "true"
420
+ expect(ENV["APPSIGNAL_RUNNING_IN_CONTAINER"]).to eq "false"
421
+ expect(ENV["APPSIGNAL_ENABLE_HOST_METRICS"]).to eq "true"
422
+ expect(ENV["APPSIGNAL_ENABLE_MINUTELY_PROBES"]).to eq "false"
423
+ expect(ENV["APPSIGNAL_HOSTNAME"]).to eq "app1.local"
424
+ expect(ENV["APPSIGNAL_PROCESS_NAME"]).to include "rspec"
425
+ expect(ENV["APPSIGNAL_CA_FILE_PATH"]).to eq File.join(resources_dir, "cacert.pem")
426
+ expect(ENV).to_not have_key("APPSIGNAL_WORKING_DIR_PATH")
425
427
  end
426
428
 
427
429
  context "with :working_dir_path" do
428
430
  before do
429
- config[:working_dir_path] = '/tmp/appsignal2'
431
+ config[:working_dir_path] = "/tmp/appsignal2"
430
432
  config.write_to_environment
431
433
  end
432
434
 
433
435
  it "sets the modified :working_dir_path" do
434
- expect(ENV['APPSIGNAL_WORKING_DIR_PATH']).to eq '/tmp/appsignal2'
436
+ expect(ENV["APPSIGNAL_WORKING_DIR_PATH"]).to eq "/tmp/appsignal2"
435
437
  end
436
438
  end
437
439
  end
@@ -439,7 +441,7 @@ describe Appsignal::Config do
439
441
  describe "#log_file_path" do
440
442
  let(:out_stream) { std_stream }
441
443
  let(:output) { out_stream.read }
442
- let(:config) { project_fixture_config('production', :log_path => log_path) }
444
+ let(:config) { project_fixture_config("production", :log_path => log_path) }
443
445
  subject { capture_stdout(out_stream) { config.log_file_path } }
444
446
  around do |example|
445
447
  recognize_as_container(:none) do
@@ -448,12 +450,12 @@ describe Appsignal::Config do
448
450
  end
449
451
 
450
452
  context "when path is writable" do
451
- let(:log_path) { File.join(tmp_dir, 'writable-path') }
453
+ let(:log_path) { File.join(tmp_dir, "writable-path") }
452
454
  before { FileUtils.mkdir_p(log_path, :mode => 0755) }
453
455
  after { FileUtils.rm_rf(log_path) }
454
456
 
455
457
  it "returns log file path" do
456
- expect(subject).to eq File.join(log_path, 'appsignal.log')
458
+ expect(subject).to eq File.join(log_path, "appsignal.log")
457
459
  end
458
460
 
459
461
  it "prints no warning" do
@@ -462,7 +464,7 @@ describe Appsignal::Config do
462
464
  end
463
465
  end
464
466
 
465
- shared_examples '#log_file_path: tmp path' do
467
+ shared_examples "#log_file_path: tmp path" do
466
468
  let(:system_tmp_dir) { described_class::SYSTEM_TMP_DIR }
467
469
  before { FileUtils.mkdir_p(system_tmp_dir) }
468
470
  after { FileUtils.rm_rf(system_tmp_dir) }
@@ -471,7 +473,7 @@ describe Appsignal::Config do
471
473
  before { FileUtils.chmod(0777, system_tmp_dir) }
472
474
 
473
475
  it "returns returns the tmp location" do
474
- expect(subject).to eq(File.join(system_tmp_dir, 'appsignal.log'))
476
+ expect(subject).to eq(File.join(system_tmp_dir, "appsignal.log"))
475
477
  end
476
478
 
477
479
  it "prints a warning" do
@@ -502,12 +504,12 @@ describe Appsignal::Config do
502
504
  context "when root_path is nil" do
503
505
  before { allow(config).to receive(:root_path).and_return(nil) }
504
506
 
505
- include_examples '#log_file_path: tmp path'
507
+ include_examples "#log_file_path: tmp path"
506
508
  end
507
509
 
508
510
  context "when root_path is set" do
509
511
  it "returns returns the project log location" do
510
- expect(subject).to eq File.join(config.root_path, 'log/appsignal.log')
512
+ expect(subject).to eq File.join(config.root_path, "log/appsignal.log")
511
513
  end
512
514
 
513
515
  it "prints no warning" do
@@ -518,33 +520,33 @@ describe Appsignal::Config do
518
520
  end
519
521
 
520
522
  context "when path does not exist" do
521
- let(:log_path) { '/non-existing' }
523
+ let(:log_path) { "/non-existing" }
522
524
 
523
- include_examples '#log_file_path: tmp path'
525
+ include_examples "#log_file_path: tmp path"
524
526
  end
525
527
 
526
528
  context "when path is not writable" do
527
- let(:log_path) { File.join(tmp_dir, 'not-writable-path') }
529
+ let(:log_path) { File.join(tmp_dir, "not-writable-path") }
528
530
  before { FileUtils.mkdir_p(log_path, :mode => 0555) }
529
531
  after { FileUtils.rm_rf(log_path) }
530
532
 
531
- include_examples '#log_file_path: tmp path'
533
+ include_examples "#log_file_path: tmp path"
532
534
  end
533
535
 
534
536
  context "when path is a symlink" do
535
537
  context "when linked path does not exist" do
536
- let(:real_path) { File.join(tmp_dir, 'real-path') }
537
- let(:log_path) { File.join(tmp_dir, 'symlink-path') }
538
+ let(:real_path) { File.join(tmp_dir, "real-path") }
539
+ let(:log_path) { File.join(tmp_dir, "symlink-path") }
538
540
  before { File.symlink(real_path, log_path) }
539
541
  after { FileUtils.rm(log_path) }
540
542
 
541
- include_examples '#log_file_path: tmp path'
543
+ include_examples "#log_file_path: tmp path"
542
544
  end
543
545
 
544
546
  context "when linked path exists" do
545
547
  context "when linked path is not writable" do
546
- let(:real_path) { File.join(tmp_dir, 'real-path') }
547
- let(:log_path) { File.join(tmp_dir, 'symlink-path') }
548
+ let(:real_path) { File.join(tmp_dir, "real-path") }
549
+ let(:log_path) { File.join(tmp_dir, "symlink-path") }
548
550
  before do
549
551
  FileUtils.mkdir_p(real_path)
550
552
  FileUtils.chmod(0444, real_path)
@@ -555,12 +557,12 @@ describe Appsignal::Config do
555
557
  FileUtils.rm(log_path)
556
558
  end
557
559
 
558
- include_examples '#log_file_path: tmp path'
560
+ include_examples "#log_file_path: tmp path"
559
561
  end
560
562
 
561
563
  context "when linked path is writable" do
562
- let(:real_path) { File.join(tmp_dir, 'real-path') }
563
- let(:log_path) { File.join(tmp_dir, 'symlink-path') }
564
+ let(:real_path) { File.join(tmp_dir, "real-path") }
565
+ let(:log_path) { File.join(tmp_dir, "symlink-path") }
564
566
  before do
565
567
  FileUtils.mkdir_p(real_path)
566
568
  File.symlink(real_path, log_path)
@@ -571,7 +573,7 @@ describe Appsignal::Config do
571
573
  end
572
574
 
573
575
  it "returns real path of log path" do
574
- expect(subject).to eq(File.join(real_path, 'appsignal.log'))
576
+ expect(subject).to eq(File.join(real_path, "appsignal.log"))
575
577
  end
576
578
  end
577
579
  end