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
@@ -1,4 +1,81 @@
|
|
1
1
|
describe Appsignal::Config do
|
2
|
+
describe ".add_loader_defaults" do
|
3
|
+
it "adds loader defaults to the list" do
|
4
|
+
described_class.add_loader_defaults(:loader1)
|
5
|
+
|
6
|
+
expect(described_class.loader_defaults).to include(
|
7
|
+
:name => :loader1,
|
8
|
+
:root_path => nil,
|
9
|
+
:env => nil,
|
10
|
+
:options => {}
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "registers multiple loaders in order of registration" do
|
15
|
+
described_class.add_loader_defaults(:loader1)
|
16
|
+
described_class.add_loader_defaults(:loader2)
|
17
|
+
|
18
|
+
expect(described_class.loader_defaults).to eq([
|
19
|
+
{
|
20
|
+
:name => :loader1,
|
21
|
+
:root_path => nil,
|
22
|
+
:env => nil,
|
23
|
+
:options => {}
|
24
|
+
},
|
25
|
+
{
|
26
|
+
:name => :loader2,
|
27
|
+
:root_path => nil,
|
28
|
+
:env => nil,
|
29
|
+
:options => {}
|
30
|
+
}
|
31
|
+
])
|
32
|
+
end
|
33
|
+
|
34
|
+
it "adds loader with env and root_path" do
|
35
|
+
described_class.add_loader_defaults(
|
36
|
+
:loader1,
|
37
|
+
:root_path => "/some-path",
|
38
|
+
:env => "loader_env1"
|
39
|
+
)
|
40
|
+
|
41
|
+
expect(described_class.loader_defaults).to include(
|
42
|
+
:name => :loader1,
|
43
|
+
:root_path => "/some-path",
|
44
|
+
:env => "loader_env1",
|
45
|
+
:options => {}
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "adds loader with options" do
|
50
|
+
described_class.add_loader_defaults(
|
51
|
+
:loader1,
|
52
|
+
:my_option1 => "some value1",
|
53
|
+
:my_option2 => "some value2"
|
54
|
+
)
|
55
|
+
|
56
|
+
expect(described_class.loader_defaults).to include(
|
57
|
+
:name => :loader1,
|
58
|
+
:root_path => nil,
|
59
|
+
:env => nil,
|
60
|
+
:options => {
|
61
|
+
:my_option1 => "some value1",
|
62
|
+
:my_option2 => "some value2"
|
63
|
+
}
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "does not set any nil options" do
|
68
|
+
described_class.add_loader_defaults(:loader1, :nil_option => nil)
|
69
|
+
|
70
|
+
expect(described_class.loader_defaults).to include(
|
71
|
+
:name => :loader1,
|
72
|
+
:root_path => nil,
|
73
|
+
:env => nil,
|
74
|
+
:options => {}
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
2
79
|
describe ".determine_env" do
|
3
80
|
context "with env argument" do
|
4
81
|
before { clear_integration_env_vars! }
|
@@ -126,15 +203,8 @@ describe Appsignal::Config do
|
|
126
203
|
let(:env_env) { "my_env_env" }
|
127
204
|
before { ENV["APPSIGNAL_APP_ENV"] = env_env }
|
128
205
|
|
129
|
-
it "uses the environment variable" do
|
130
|
-
expect(config.env).to eq(env_env)
|
131
|
-
end
|
132
|
-
|
133
206
|
it "sets the environment as loaded through the env_config" do
|
134
|
-
expect(config.initial_config).to eq(:env => env)
|
135
207
|
expect(config.env_config).to eq(:env => env_env)
|
136
|
-
expect(config.config_hash).to_not have_key(:env)
|
137
|
-
expect(config.config_hash).to_not have_key(:root_path)
|
138
208
|
end
|
139
209
|
end
|
140
210
|
end
|
@@ -142,7 +212,7 @@ describe Appsignal::Config do
|
|
142
212
|
end
|
143
213
|
|
144
214
|
describe "config based on the system" do
|
145
|
-
let(:config) { silence {
|
215
|
+
let(:config) { silence { build_config(:env => :none) } }
|
146
216
|
|
147
217
|
describe ":active" do
|
148
218
|
subject { config[:active] }
|
@@ -222,101 +292,59 @@ describe Appsignal::Config do
|
|
222
292
|
end
|
223
293
|
end
|
224
294
|
|
225
|
-
describe "
|
226
|
-
let(:
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
295
|
+
describe "loader default config" do
|
296
|
+
let(:config) { described_class.new("some-path", "production") }
|
297
|
+
before do
|
298
|
+
define_loader(:options_loader) do
|
299
|
+
def on_load
|
300
|
+
register_config_defaults(
|
301
|
+
:env => "loader_env",
|
302
|
+
:root_path => "loader-path",
|
303
|
+
:ignore_actions => ["loader-action"],
|
304
|
+
:my_option => "my_value",
|
305
|
+
:nil_option => nil
|
306
|
+
)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
load_loader(:options_loader)
|
237
310
|
end
|
238
311
|
|
239
|
-
it "
|
240
|
-
expect(config
|
241
|
-
:active => true,
|
242
|
-
:activejob_report_errors => "all",
|
243
|
-
:ca_file_path => File.join(resources_dir, "cacert.pem"),
|
244
|
-
:debug => false,
|
245
|
-
:dns_servers => [],
|
246
|
-
:enable_allocation_tracking => true,
|
247
|
-
:enable_gvl_global_timer => true,
|
248
|
-
:enable_gvl_waiting_threads => true,
|
249
|
-
:enable_host_metrics => true,
|
250
|
-
:enable_minutely_probes => true,
|
251
|
-
:enable_statsd => true,
|
252
|
-
:enable_nginx_metrics => false,
|
253
|
-
:enable_rails_error_reporter => true,
|
254
|
-
:enable_rake_performance_instrumentation => false,
|
255
|
-
:endpoint => "https://push.appsignal.com",
|
256
|
-
:files_world_accessible => true,
|
257
|
-
:filter_metadata => [],
|
258
|
-
:filter_parameters => [],
|
259
|
-
:filter_session_data => [],
|
260
|
-
:ignore_actions => [],
|
261
|
-
:ignore_errors => [],
|
262
|
-
:ignore_logs => [],
|
263
|
-
:ignore_namespaces => [],
|
264
|
-
:instrument_http_rb => true,
|
265
|
-
:instrument_net_http => true,
|
266
|
-
:instrument_redis => true,
|
267
|
-
:instrument_sequel => true,
|
268
|
-
:log => "file",
|
269
|
-
:logging_endpoint => "https://appsignal-endpoint.net",
|
270
|
-
:name => "TestApp",
|
271
|
-
:push_api_key => "abc",
|
272
|
-
:request_headers => [],
|
273
|
-
:revision => "v2.5.1",
|
274
|
-
:send_environment_metadata => true,
|
275
|
-
:send_params => true,
|
276
|
-
:send_session_data => true,
|
277
|
-
:sidekiq_report_errors => "all",
|
278
|
-
:transaction_debug_mode => false
|
279
|
-
)
|
312
|
+
it "overrides the default config option values" do
|
313
|
+
expect(config[:ignore_actions]).to eq(["loader-action"])
|
280
314
|
end
|
281
315
|
|
282
|
-
it "
|
283
|
-
expect(config.
|
316
|
+
it "does not set any nil values" do
|
317
|
+
expect(config.config_hash).to_not have_key(:nil_option)
|
284
318
|
end
|
285
319
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
"non-existing-path",
|
291
|
-
"production",
|
292
|
-
:running_in_container => true
|
293
|
-
)
|
294
|
-
end
|
295
|
-
subject { config[:running_in_container] }
|
296
|
-
|
297
|
-
it "overrides system detected config" do
|
298
|
-
expect(subject).to be_truthy
|
299
|
-
end
|
300
|
-
end
|
320
|
+
it "does not set the env" do
|
321
|
+
# This is done by Config.determine_env
|
322
|
+
expect(config.env).to eq("production")
|
323
|
+
end
|
301
324
|
|
302
|
-
|
303
|
-
|
325
|
+
it "does not set the root_path" do
|
326
|
+
# This is done by Config.determine_root_path
|
327
|
+
expect(config.root_path).to eq("some-path")
|
328
|
+
end
|
304
329
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
:
|
311
|
-
:
|
330
|
+
context "with multiple loaders" do
|
331
|
+
before do
|
332
|
+
define_loader(:options_loader2) do
|
333
|
+
def on_load
|
334
|
+
register_config_defaults(
|
335
|
+
:my_option => "second_value",
|
336
|
+
:second_option => "second_value"
|
312
337
|
)
|
313
338
|
end
|
314
|
-
before { ENV["APPSIGNAL_PUSH_API_KEY"] = "abc" }
|
315
|
-
|
316
|
-
it "sets given config rather than env variable" do
|
317
|
-
expect(subject).to be_falsy
|
318
|
-
end
|
319
339
|
end
|
340
|
+
load_loader(:options_loader2)
|
341
|
+
end
|
342
|
+
|
343
|
+
it "makes the first loader's config leading" do
|
344
|
+
expect(config.config_hash).to include(
|
345
|
+
:my_option => "my_value",
|
346
|
+
:second_option => "second_value"
|
347
|
+
)
|
320
348
|
end
|
321
349
|
end
|
322
350
|
end
|
@@ -340,7 +368,7 @@ describe Appsignal::Config do
|
|
340
368
|
end
|
341
369
|
|
342
370
|
context "with a config file" do
|
343
|
-
let(:config) {
|
371
|
+
let(:config) { build_config(:env => "production") }
|
344
372
|
|
345
373
|
context "with valid config" do
|
346
374
|
it "is valid and active" do
|
@@ -354,79 +382,32 @@ describe Appsignal::Config do
|
|
354
382
|
end
|
355
383
|
end
|
356
384
|
|
357
|
-
context "with an overridden config file" do
|
358
|
-
let(:config) do
|
359
|
-
project_fixture_config("production", {}, Appsignal.internal_logger,
|
360
|
-
File.join(project_fixture_path, "config", "appsignal.yml"))
|
361
|
-
end
|
362
|
-
|
363
|
-
it "is valid and active" do
|
364
|
-
expect(config.valid?).to be_truthy
|
365
|
-
expect(config.active?).to be_truthy
|
366
|
-
end
|
367
|
-
|
368
|
-
context "with an invalid overridden config file" do
|
369
|
-
let(:config) do
|
370
|
-
project_fixture_config("production", {}, Appsignal.internal_logger,
|
371
|
-
File.join(project_fixture_path, "config", "missing.yml"))
|
372
|
-
end
|
373
|
-
|
374
|
-
it "is not valid" do
|
375
|
-
expect(config.valid?).to be_falsy
|
376
|
-
end
|
377
|
-
end
|
378
|
-
end
|
379
|
-
|
380
385
|
context "with the config file causing an error" do
|
381
386
|
let(:config_path) do
|
382
387
|
File.expand_path(
|
383
388
|
File.join(File.dirname(__FILE__), "../../support/fixtures/projects/broken")
|
384
389
|
)
|
385
390
|
end
|
386
|
-
let(:config) {
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
context "when APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR=1 is set" do
|
410
|
-
it "does not start AppSignal, logs & prints an error" do
|
411
|
-
stdout = std_stream
|
412
|
-
stderr = std_stream
|
413
|
-
ENV["APPSIGNAL_ACTIVE"] = "true"
|
414
|
-
ENV["APPSIGNAL_APP_NAME"] = "My app"
|
415
|
-
ENV["APPSIGNAL_APP_ENV"] = "dev"
|
416
|
-
ENV["APPSIGNAL_PUSH_API_KEY"] = "something valid"
|
417
|
-
ENV["APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR"] = "1"
|
418
|
-
log = capture_logs { capture_std_streams(stdout, stderr) { config } }
|
419
|
-
message = "An error occurred while loading the AppSignal config file. " \
|
420
|
-
"Not starting AppSignal because APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR is set.\n" \
|
421
|
-
"File: #{File.join(config_path, "config", "appsignal.yml").inspect}\n" \
|
422
|
-
"KeyError: key not found"
|
423
|
-
expect(log).to contains_log :error, message
|
424
|
-
expect(log).to include("/appsignal/config.rb:") # Backtrace
|
425
|
-
expect(stdout.read).to_not include("appsignal:")
|
426
|
-
expect(stderr.read).to include "appsignal: #{message}"
|
427
|
-
expect(config.file_config).to eql({})
|
428
|
-
expect(config.active?).to be(false)
|
429
|
-
end
|
391
|
+
let(:config) { described_class.new(config_path, "production") }
|
392
|
+
|
393
|
+
it "does not start AppSignal, logs & prints an error" do
|
394
|
+
stdout = std_stream
|
395
|
+
stderr = std_stream
|
396
|
+
ENV["APPSIGNAL_ACTIVE"] = "true"
|
397
|
+
ENV["APPSIGNAL_APP_NAME"] = "My app"
|
398
|
+
ENV["APPSIGNAL_APP_ENV"] = "dev"
|
399
|
+
ENV["APPSIGNAL_PUSH_API_KEY"] = "something valid"
|
400
|
+
log = capture_logs { capture_std_streams(stdout, stderr) { config } }
|
401
|
+
message = "An error occurred while loading the AppSignal config file. " \
|
402
|
+
"Not starting AppSignal.\n" \
|
403
|
+
"File: #{File.join(config_path, "config", "appsignal.yml").inspect}\n" \
|
404
|
+
"KeyError: key not found"
|
405
|
+
expect(log).to contains_log :error, message
|
406
|
+
expect(log).to include("/appsignal/config.rb:") # Backtrace
|
407
|
+
expect(stdout.read).to_not include("appsignal:")
|
408
|
+
expect(stderr.read).to include "appsignal: #{message}"
|
409
|
+
expect(config.file_config).to eql({})
|
410
|
+
expect(config.active?).to be(false)
|
430
411
|
end
|
431
412
|
end
|
432
413
|
|
@@ -436,19 +417,20 @@ describe Appsignal::Config do
|
|
436
417
|
:active => true,
|
437
418
|
:push_api_key => "abc",
|
438
419
|
:name => "TestApp",
|
439
|
-
:request_headers => kind_of(Array),
|
440
420
|
:enable_minutely_probes => false
|
441
421
|
)
|
442
422
|
end
|
443
423
|
|
444
424
|
describe "overriding system and defaults config" do
|
445
425
|
let(:config) do
|
446
|
-
|
447
|
-
"non-existing-path",
|
448
|
-
"production",
|
449
|
-
:
|
450
|
-
|
451
|
-
|
426
|
+
build_config(
|
427
|
+
:root_path => "non-existing-path",
|
428
|
+
:env => "production",
|
429
|
+
:options => {
|
430
|
+
:running_in_container => true,
|
431
|
+
:debug => true,
|
432
|
+
:log_level => "debug"
|
433
|
+
}
|
452
434
|
)
|
453
435
|
end
|
454
436
|
|
@@ -460,7 +442,7 @@ describe Appsignal::Config do
|
|
460
442
|
end
|
461
443
|
|
462
444
|
context "with the env name as a symbol" do
|
463
|
-
let(:config) {
|
445
|
+
let(:config) { build_config(:env => :production) }
|
464
446
|
|
465
447
|
it "loads the config" do
|
466
448
|
expect(config.valid?).to be_truthy
|
@@ -471,9 +453,7 @@ describe Appsignal::Config do
|
|
471
453
|
end
|
472
454
|
|
473
455
|
context "without the selected env" do
|
474
|
-
let(:config) {
|
475
|
-
let(:log_stream) { std_stream }
|
476
|
-
let(:log) { log_contents(log_stream) }
|
456
|
+
let(:config) { build_config(:env => :nonsense) }
|
477
457
|
|
478
458
|
it "is not valid or active" do
|
479
459
|
expect(config.valid?).to be_falsy
|
@@ -481,10 +461,10 @@ describe Appsignal::Config do
|
|
481
461
|
end
|
482
462
|
|
483
463
|
it "logs an error" do
|
484
|
-
|
485
|
-
expect(
|
464
|
+
logs = capture_logs { config }
|
465
|
+
expect(logs)
|
486
466
|
.to contains_log(:error, "Not loading from config file: config for 'nonsense' not found")
|
487
|
-
expect(
|
467
|
+
expect(logs)
|
488
468
|
.to contains_log(:error, "Push API key not set after loading config")
|
489
469
|
end
|
490
470
|
end
|
@@ -494,10 +474,8 @@ describe Appsignal::Config do
|
|
494
474
|
let(:config) do
|
495
475
|
described_class.new(
|
496
476
|
"non-existing-path",
|
497
|
-
"production"
|
498
|
-
|
499
|
-
:debug => true
|
500
|
-
)
|
477
|
+
"production"
|
478
|
+
).tap(&:validate)
|
501
479
|
end
|
502
480
|
let(:working_directory_path) { File.join(tmp_dir, "test_working_directory_path") }
|
503
481
|
let(:env_config) do
|
@@ -507,9 +485,9 @@ describe Appsignal::Config do
|
|
507
485
|
:bind_address => "0.0.0.0",
|
508
486
|
:ca_file_path => "/some/path",
|
509
487
|
:cpu_count => 1.5,
|
510
|
-
:debug => true,
|
511
488
|
:dns_servers => ["8.8.8.8", "8.8.4.4"],
|
512
489
|
:enable_allocation_tracking => false,
|
490
|
+
:enable_at_exit_reporter => false,
|
513
491
|
:enable_gvl_global_timer => false,
|
514
492
|
:enable_gvl_waiting_threads => false,
|
515
493
|
:enable_host_metrics => false,
|
@@ -547,10 +525,7 @@ describe Appsignal::Config do
|
|
547
525
|
:send_params => false,
|
548
526
|
:send_session_data => false,
|
549
527
|
:sidekiq_report_errors => "all",
|
550
|
-
:skip_session_data => false,
|
551
528
|
:statsd_port => "7890",
|
552
|
-
:transaction_debug_mode => false,
|
553
|
-
:working_dir_path => "/some/path",
|
554
529
|
:working_directory_path => working_directory_path
|
555
530
|
}
|
556
531
|
end
|
@@ -573,13 +548,12 @@ describe Appsignal::Config do
|
|
573
548
|
"APPSIGNAL_SIDEKIQ_REPORT_ERRORS" => "all",
|
574
549
|
"APPSIGNAL_STATSD_PORT" => "7890",
|
575
550
|
"APPSIGNAL_WORKING_DIRECTORY_PATH" => working_directory_path,
|
576
|
-
"APPSIGNAL_WORKING_DIR_PATH" => "/some/path",
|
577
551
|
"APP_REVISION" => "v2.5.1",
|
578
552
|
|
579
553
|
# Booleans
|
580
554
|
"APPSIGNAL_ACTIVE" => "true",
|
581
|
-
"APPSIGNAL_DEBUG" => "true",
|
582
555
|
"APPSIGNAL_ENABLE_ALLOCATION_TRACKING" => "false",
|
556
|
+
"APPSIGNAL_ENABLE_AT_EXIT_REPORTER" => "false",
|
583
557
|
"APPSIGNAL_ENABLE_GVL_GLOBAL_TIMER" => "false",
|
584
558
|
"APPSIGNAL_ENABLE_GVL_WAITING_THREADS" => "false",
|
585
559
|
"APPSIGNAL_ENABLE_HOST_METRICS" => "false",
|
@@ -597,8 +571,6 @@ describe Appsignal::Config do
|
|
597
571
|
"APPSIGNAL_SEND_ENVIRONMENT_METADATA" => "false",
|
598
572
|
"APPSIGNAL_SEND_PARAMS" => "false",
|
599
573
|
"APPSIGNAL_SEND_SESSION_DATA" => "false",
|
600
|
-
"APPSIGNAL_SKIP_SESSION_DATA" => "false",
|
601
|
-
"APPSIGNAL_TRANSACTION_DEBUG_MODE" => "false",
|
602
574
|
|
603
575
|
# Arrays
|
604
576
|
"APPSIGNAL_DNS_SERVERS" => "8.8.8.8,8.8.4.4",
|
@@ -665,12 +637,12 @@ describe Appsignal::Config do
|
|
665
637
|
|
666
638
|
context "with mixed case `true` env variables values" do
|
667
639
|
before do
|
668
|
-
ENV["
|
640
|
+
ENV["APPSIGNAL_ENABLE_RAKE_PERFORMANCE_INSTRUMENTATION"] = "TRUE"
|
669
641
|
ENV["APPSIGNAL_INSTRUMENT_SEQUEL"] = "True"
|
670
642
|
end
|
671
643
|
|
672
644
|
it "accepts mixed case `true` values" do
|
673
|
-
expect(config[:
|
645
|
+
expect(config[:enable_rake_performance_instrumentation]).to eq(true)
|
674
646
|
expect(config[:instrument_sequel]).to eq(true)
|
675
647
|
end
|
676
648
|
end
|
@@ -680,146 +652,125 @@ describe Appsignal::Config do
|
|
680
652
|
end
|
681
653
|
end
|
682
654
|
|
683
|
-
describe "
|
684
|
-
let(:
|
685
|
-
|
686
|
-
|
655
|
+
describe "DSL config" do
|
656
|
+
let(:dsl_config) do
|
657
|
+
{
|
658
|
+
:push_api_key => "abc",
|
659
|
+
:name => "TestApp",
|
660
|
+
:active => true,
|
661
|
+
:revision => "v2.5.1",
|
662
|
+
:request_headers => []
|
663
|
+
}
|
664
|
+
end
|
687
665
|
let(:config) do
|
688
|
-
|
666
|
+
build_config(
|
667
|
+
:root_path => "non-existing-path",
|
668
|
+
:env => "production",
|
669
|
+
:options => dsl_config
|
670
|
+
)
|
689
671
|
end
|
690
672
|
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
context "when set to false" do
|
733
|
-
let(:config_options) { { :skip_session_data => false } }
|
734
|
-
|
735
|
-
it "sets send_session_data if send_session_data is not set by the user" do
|
736
|
-
expect(config[:skip_session_data]).to eq(false)
|
737
|
-
expect(config[:send_session_data]).to eq(true)
|
738
|
-
expect(config.override_config[:send_session_data]).to eq(true)
|
739
|
-
end
|
740
|
-
|
741
|
-
it "prints a deprecation warning" do
|
742
|
-
expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
|
743
|
-
expect(logs).to include(deprecation_message)
|
744
|
-
end
|
745
|
-
end
|
673
|
+
it "merges with the default config" do
|
674
|
+
expect(config.config_hash).to eq(
|
675
|
+
:active => true,
|
676
|
+
:activejob_report_errors => "all",
|
677
|
+
:ca_file_path => File.join(resources_dir, "cacert.pem"),
|
678
|
+
:dns_servers => [],
|
679
|
+
:enable_allocation_tracking => true,
|
680
|
+
:enable_at_exit_reporter => true,
|
681
|
+
:enable_gvl_global_timer => true,
|
682
|
+
:enable_gvl_waiting_threads => true,
|
683
|
+
:enable_host_metrics => true,
|
684
|
+
:enable_minutely_probes => true,
|
685
|
+
:enable_statsd => true,
|
686
|
+
:enable_nginx_metrics => false,
|
687
|
+
:enable_rails_error_reporter => true,
|
688
|
+
:enable_rake_performance_instrumentation => false,
|
689
|
+
:endpoint => "https://push.appsignal.com",
|
690
|
+
:files_world_accessible => true,
|
691
|
+
:filter_metadata => [],
|
692
|
+
:filter_parameters => [],
|
693
|
+
:filter_session_data => [],
|
694
|
+
:ignore_actions => [],
|
695
|
+
:ignore_errors => [],
|
696
|
+
:ignore_logs => [],
|
697
|
+
:ignore_namespaces => [],
|
698
|
+
:instrument_http_rb => true,
|
699
|
+
:instrument_net_http => true,
|
700
|
+
:instrument_redis => true,
|
701
|
+
:instrument_sequel => true,
|
702
|
+
:log => "file",
|
703
|
+
:logging_endpoint => "https://appsignal-endpoint.net",
|
704
|
+
:name => "TestApp",
|
705
|
+
:push_api_key => "abc",
|
706
|
+
:request_headers => [],
|
707
|
+
:revision => "v2.5.1",
|
708
|
+
:send_environment_metadata => true,
|
709
|
+
:send_params => true,
|
710
|
+
:send_session_data => true,
|
711
|
+
:sidekiq_report_errors => "all"
|
712
|
+
)
|
713
|
+
end
|
746
714
|
|
747
|
-
|
748
|
-
|
715
|
+
it "sets the dsl_config" do
|
716
|
+
expect(config.dsl_config).to eq(dsl_config)
|
717
|
+
end
|
749
718
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
end
|
719
|
+
describe "overriding system detected config" do
|
720
|
+
describe ":running_in_container" do
|
721
|
+
let(:dsl_config) { { :running_in_container => true } }
|
722
|
+
subject { config[:running_in_container] }
|
755
723
|
|
756
|
-
it "
|
757
|
-
expect(
|
758
|
-
expect(logs).to include(deprecation_message)
|
724
|
+
it "overrides system detected config" do
|
725
|
+
expect(subject).to be_truthy
|
759
726
|
end
|
760
727
|
end
|
761
|
-
end
|
762
728
|
|
763
|
-
|
764
|
-
|
729
|
+
describe ":active" do
|
730
|
+
subject { config[:active] }
|
765
731
|
|
766
|
-
|
767
|
-
|
732
|
+
context "with APPSIGNAL_PUSH_API_KEY env variable" do
|
733
|
+
let(:dsl_config) { { :active => false } }
|
734
|
+
before { ENV["APPSIGNAL_PUSH_API_KEY"] = "abc" }
|
768
735
|
|
769
|
-
|
770
|
-
|
771
|
-
it "does not override the activejob_report_errors value" do
|
772
|
-
expect(config[:activejob_report_errors]).to eq("discard")
|
773
|
-
expect(config.override_config[:activejob_report_errors]).to be_nil
|
774
|
-
end
|
775
|
-
end
|
776
|
-
else
|
777
|
-
context "when Active Job < 7.1 and 'discard'" do
|
778
|
-
it "sets activejob_report_errors to 'all'" do
|
779
|
-
expect(config[:activejob_report_errors]).to eq("all")
|
780
|
-
expect(config.override_config[:activejob_report_errors]).to eq("all")
|
781
|
-
end
|
736
|
+
it "sets given config rather than env variable" do
|
737
|
+
expect(subject).to be_falsy
|
782
738
|
end
|
783
739
|
end
|
784
740
|
end
|
785
741
|
end
|
786
742
|
|
787
|
-
|
788
|
-
let(:
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
743
|
+
describe "overriding loader config" do
|
744
|
+
let(:config) do
|
745
|
+
build_config(
|
746
|
+
:root_path => "non-existing-path",
|
747
|
+
:env => "production",
|
748
|
+
:options => { :my_option => "initial value" }
|
749
|
+
)
|
793
750
|
end
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
expect(config[:sidekiq_report_errors]).to eq("discard")
|
800
|
-
expect(config.override_config[:sidekiq_report_errors]).to be_nil
|
751
|
+
before do
|
752
|
+
define_loader(:test_loader) do
|
753
|
+
def on_load
|
754
|
+
register_config_defaults(:my_option => "loader value")
|
755
|
+
end
|
801
756
|
end
|
757
|
+
load_loader(:test_loader)
|
802
758
|
end
|
803
759
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
it "sets sidekiq_report_errors to 'all'" do
|
808
|
-
expect(config[:sidekiq_report_errors]).to eq("all")
|
809
|
-
expect(config.override_config[:sidekiq_report_errors]).to eq("all")
|
810
|
-
end
|
760
|
+
it "overrides loader config" do
|
761
|
+
expect(config[:my_option]).to eq("initial value")
|
811
762
|
end
|
812
763
|
end
|
813
764
|
end
|
814
765
|
|
815
766
|
describe "config keys" do
|
767
|
+
let(:config) { build_config(:options => options) }
|
768
|
+
|
816
769
|
describe ":endpoint" do
|
817
770
|
subject { config[:endpoint] }
|
818
771
|
|
819
772
|
context "with an pre-0.12-style endpoint" do
|
820
|
-
let(:
|
821
|
-
project_fixture_config("production", :endpoint => "https://push.appsignal.com/1")
|
822
|
-
end
|
773
|
+
let(:options) { { :endpoint => "https://push.appsignal.com/1" } }
|
823
774
|
|
824
775
|
it "strips off the path" do
|
825
776
|
expect(subject).to eq "https://push.appsignal.com"
|
@@ -827,7 +778,7 @@ describe Appsignal::Config do
|
|
827
778
|
end
|
828
779
|
|
829
780
|
context "with a non-standard port" do
|
830
|
-
let(:
|
781
|
+
let(:options) { { :endpoint => "http://localhost:4567" } }
|
831
782
|
|
832
783
|
it "keeps the port" do
|
833
784
|
expect(subject).to eq "http://localhost:4567"
|
@@ -839,7 +790,7 @@ describe Appsignal::Config do
|
|
839
790
|
subject { config[:logging_endpoint] }
|
840
791
|
|
841
792
|
context "with a non-standard port" do
|
842
|
-
let(:
|
793
|
+
let(:options) { { :logging_endpoint => "http://localhost:4567" } }
|
843
794
|
|
844
795
|
it "keeps the port" do
|
845
796
|
expect(subject).to eq "http://localhost:4567"
|
@@ -849,7 +800,9 @@ describe Appsignal::Config do
|
|
849
800
|
end
|
850
801
|
|
851
802
|
describe "#[]" do
|
852
|
-
let(:config)
|
803
|
+
let(:config) do
|
804
|
+
build_config(:env => :none, :options => { :push_api_key => "foo", :request_headers => [] })
|
805
|
+
end
|
853
806
|
|
854
807
|
context "with existing key" do
|
855
808
|
it "gets the value" do
|
@@ -865,7 +818,7 @@ describe Appsignal::Config do
|
|
865
818
|
end
|
866
819
|
|
867
820
|
describe "#[]=" do
|
868
|
-
let(:config) {
|
821
|
+
let(:config) { build_config(:env => :none) }
|
869
822
|
|
870
823
|
context "with existing key" do
|
871
824
|
it "changes the value" do
|
@@ -885,7 +838,7 @@ describe Appsignal::Config do
|
|
885
838
|
end
|
886
839
|
|
887
840
|
describe "#write_to_environment" do
|
888
|
-
let(:config) {
|
841
|
+
let(:config) { build_config }
|
889
842
|
before do
|
890
843
|
config[:bind_address] = "0.0.0.0"
|
891
844
|
config[:cpu_count] = 1.5
|
@@ -914,7 +867,6 @@ describe Appsignal::Config do
|
|
914
867
|
expect(ENV.fetch("_APPSIGNAL_AGENT_PATH", nil)).to end_with("/ext")
|
915
868
|
expect(ENV.fetch("_APPSIGNAL_BIND_ADDRESS", nil)).to eq("0.0.0.0")
|
916
869
|
expect(ENV.fetch("_APPSIGNAL_CPU_COUNT", nil)).to eq("1.5")
|
917
|
-
expect(ENV.fetch("_APPSIGNAL_DEBUG_LOGGING", nil)).to eq "false"
|
918
870
|
expect(ENV.fetch("_APPSIGNAL_LOG", nil)).to eq "stdout"
|
919
871
|
expect(ENV.fetch("_APPSIGNAL_LOG_FILE_PATH", nil)).to end_with("/tmp/appsignal.log")
|
920
872
|
expect(ENV.fetch("_APPSIGNAL_LOGGING_ENDPOINT", nil)).to eq "http://localhost:123"
|
@@ -938,13 +890,11 @@ describe Appsignal::Config do
|
|
938
890
|
.to eq File.join(resources_dir, "cacert.pem")
|
939
891
|
expect(ENV.fetch("_APPSIGNAL_DNS_SERVERS", nil)).to eq "8.8.8.8,8.8.4.4"
|
940
892
|
expect(ENV.fetch("_APPSIGNAL_FILES_WORLD_ACCESSIBLE", nil)).to eq "true"
|
941
|
-
expect(ENV.fetch("_APPSIGNAL_TRANSACTION_DEBUG_MODE", nil)).to eq "true"
|
942
893
|
expect(ENV.fetch("_APPSIGNAL_SEND_ENVIRONMENT_METADATA", nil)).to eq "false"
|
943
894
|
expect(ENV.fetch("_APPSIGNAL_STATSD_PORT", nil)).to eq ""
|
944
895
|
expect(ENV.fetch("_APPSIGNAL_FILTER_PARAMETERS", nil)).to eq "password,confirm_password"
|
945
896
|
expect(ENV.fetch("_APPSIGNAL_FILTER_SESSION_DATA", nil)).to eq "key1,key2"
|
946
897
|
expect(ENV.fetch("_APP_REVISION", nil)).to eq "v2.5.1"
|
947
|
-
expect(ENV).to_not have_key("_APPSIGNAL_WORKING_DIR_PATH")
|
948
898
|
expect(ENV).to_not have_key("_APPSIGNAL_WORKING_DIRECTORY_PATH")
|
949
899
|
end
|
950
900
|
|
@@ -970,17 +920,6 @@ describe Appsignal::Config do
|
|
970
920
|
end
|
971
921
|
end
|
972
922
|
|
973
|
-
context "with :working_dir_path" do
|
974
|
-
before do
|
975
|
-
config[:working_dir_path] = "/tmp/appsignal2"
|
976
|
-
config.write_to_environment
|
977
|
-
end
|
978
|
-
|
979
|
-
it "sets the modified :working_dir_path" do
|
980
|
-
expect(ENV.fetch("_APPSIGNAL_WORKING_DIR_PATH", nil)).to eq "/tmp/appsignal2"
|
981
|
-
end
|
982
|
-
end
|
983
|
-
|
984
923
|
context "with :working_directory_path" do
|
985
924
|
before do
|
986
925
|
config[:working_directory_path] = "/tmp/appsignal2"
|
@@ -1007,7 +946,7 @@ describe Appsignal::Config do
|
|
1007
946
|
describe "#log_file_path" do
|
1008
947
|
let(:out_stream) { std_stream }
|
1009
948
|
let(:output) { out_stream.read }
|
1010
|
-
let(:config) {
|
949
|
+
let(:config) { build_config(:options => { :log_path => log_path }) }
|
1011
950
|
|
1012
951
|
def log_file_path
|
1013
952
|
capture_stdout(out_stream) { config.log_file_path }
|
@@ -1190,59 +1129,62 @@ describe Appsignal::Config do
|
|
1190
1129
|
end
|
1191
1130
|
end
|
1192
1131
|
|
1193
|
-
describe "#
|
1194
|
-
|
1195
|
-
let(:logger) { test_logger(log_stream) }
|
1196
|
-
let(:logs) { log_contents(log_stream) }
|
1132
|
+
describe "#validate" do
|
1133
|
+
subject { config.valid? }
|
1197
1134
|
let(:config) do
|
1198
|
-
|
1135
|
+
build_config(:root_path => Dir.pwd, :env => "production", :options => config_options)
|
1199
1136
|
end
|
1200
1137
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
let(:stderr) { err_stream.read }
|
1204
|
-
let(:deprecation_message) do
|
1205
|
-
"The `working_dir_path` option is deprecated, please use " \
|
1206
|
-
"`working_directory_path` instead and specify the " \
|
1207
|
-
"full path to the working directory"
|
1208
|
-
end
|
1209
|
-
before do
|
1210
|
-
capture_std_streams(std_stream, err_stream) { config }
|
1211
|
-
end
|
1138
|
+
if DependencyHelper.rails_present?
|
1139
|
+
require "active_job"
|
1212
1140
|
|
1213
|
-
context "
|
1214
|
-
let(:config_options) { {} }
|
1141
|
+
context "activejob_report_errors" do
|
1142
|
+
let(:config_options) { { :activejob_report_errors => "discard" } }
|
1215
1143
|
|
1216
|
-
|
1217
|
-
|
1144
|
+
if DependencyHelper.rails_version >= Gem::Version.new("7.1.0")
|
1145
|
+
context "when Active Job >= 7.1 and 'discard'" do
|
1146
|
+
it "does not override the activejob_report_errors value" do
|
1147
|
+
expect(config[:activejob_report_errors]).to eq("discard")
|
1148
|
+
expect(config.override_config[:activejob_report_errors]).to be_nil
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
else
|
1152
|
+
context "when Active Job < 7.1 and 'discard'" do
|
1153
|
+
it "sets activejob_report_errors to 'all'" do
|
1154
|
+
expect(config[:activejob_report_errors]).to eq("all")
|
1155
|
+
expect(config.override_config[:activejob_report_errors]).to eq("all")
|
1156
|
+
end
|
1157
|
+
end
|
1218
1158
|
end
|
1159
|
+
end
|
1160
|
+
end
|
1219
1161
|
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1162
|
+
context "sidekiq_report_errors" do
|
1163
|
+
let(:config_options) { { :sidekiq_report_errors => "discard" } }
|
1164
|
+
before do
|
1165
|
+
if Appsignal::Hooks::SidekiqHook.instance_variable_defined?(:@version_5_1_or_higher)
|
1166
|
+
Appsignal::Hooks::SidekiqHook.remove_instance_variable(:@version_5_1_or_higher)
|
1223
1167
|
end
|
1224
1168
|
end
|
1225
1169
|
|
1226
|
-
context "when
|
1227
|
-
|
1170
|
+
context "when Sidekiq >= 5.1 and 'discard'" do
|
1171
|
+
before { stub_const("Sidekiq::VERSION", "5.1.0") }
|
1228
1172
|
|
1229
|
-
it "
|
1230
|
-
expect(config[:
|
1173
|
+
it "does not override the sidekiq_report_errors value" do
|
1174
|
+
expect(config[:sidekiq_report_errors]).to eq("discard")
|
1175
|
+
expect(config.override_config[:sidekiq_report_errors]).to be_nil
|
1231
1176
|
end
|
1177
|
+
end
|
1232
1178
|
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1179
|
+
context "when Sidekiq < 5.1 and 'discard'" do
|
1180
|
+
before { stub_const("Sidekiq::VERSION", "5.0.0") }
|
1181
|
+
|
1182
|
+
it "sets sidekiq_report_errors to 'all'" do
|
1183
|
+
expect(config[:sidekiq_report_errors]).to eq("all")
|
1184
|
+
expect(config.override_config[:sidekiq_report_errors]).to eq("all")
|
1236
1185
|
end
|
1237
1186
|
end
|
1238
1187
|
end
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
describe "#validate" do
|
1242
|
-
subject { config.valid? }
|
1243
|
-
let(:config) do
|
1244
|
-
described_class.new(Dir.pwd, "production", config_options)
|
1245
|
-
end
|
1246
1188
|
|
1247
1189
|
describe "push_api_key" do
|
1248
1190
|
let(:config_options) { { :push_api_key => push_api_key, :request_headers => [] } }
|
@@ -1284,7 +1226,7 @@ describe Appsignal::Config do
|
|
1284
1226
|
|
1285
1227
|
describe "#log_level" do
|
1286
1228
|
let(:options) { {} }
|
1287
|
-
let(:config) {
|
1229
|
+
let(:config) { build_config(:root_path => "", :env => nil, :options => options) }
|
1288
1230
|
subject { config.log_level }
|
1289
1231
|
|
1290
1232
|
context "without any config" do
|
@@ -1293,16 +1235,6 @@ describe Appsignal::Config do
|
|
1293
1235
|
end
|
1294
1236
|
end
|
1295
1237
|
|
1296
|
-
context "with debug set to true" do
|
1297
|
-
let(:options) { { :debug => true } }
|
1298
|
-
it { is_expected.to eq(Logger::DEBUG) }
|
1299
|
-
end
|
1300
|
-
|
1301
|
-
context "with transaction_debug_mode set to true" do
|
1302
|
-
let(:options) { { :transaction_debug_mode => true } }
|
1303
|
-
it { is_expected.to eq(Logger::DEBUG) }
|
1304
|
-
end
|
1305
|
-
|
1306
1238
|
context "with log_level set to error" do
|
1307
1239
|
let(:options) { { :log_level => "error" } }
|
1308
1240
|
it { is_expected.to eq(Logger::ERROR) }
|
@@ -1350,20 +1282,12 @@ describe Appsignal::Config do
|
|
1350
1282
|
it "prints a warning and doesn't use the log_level" do
|
1351
1283
|
is_expected.to eql(Logger::INFO)
|
1352
1284
|
end
|
1353
|
-
|
1354
|
-
context "with debug option set to true" do
|
1355
|
-
let(:options) { { :log_level => "fatal", :debug => true } }
|
1356
|
-
|
1357
|
-
it "prints a warning and sets it to debug" do
|
1358
|
-
is_expected.to eql(Logger::DEBUG)
|
1359
|
-
end
|
1360
|
-
end
|
1361
1285
|
end
|
1362
1286
|
end
|
1363
1287
|
|
1364
1288
|
describe Appsignal::Config::ConfigDSL do
|
1365
1289
|
let(:env) { :production }
|
1366
|
-
let(:config) {
|
1290
|
+
let(:config) { build_config(:env => env) }
|
1367
1291
|
let(:dsl) { described_class.new(config) }
|
1368
1292
|
|
1369
1293
|
describe "default options" do
|
@@ -1453,9 +1377,10 @@ describe Appsignal::Config do
|
|
1453
1377
|
end
|
1454
1378
|
|
1455
1379
|
it "logs a deprecation warning" do
|
1456
|
-
logs =
|
1457
|
-
|
1458
|
-
|
1380
|
+
logs =
|
1381
|
+
capture_logs do
|
1382
|
+
silence { dsl.app_path = "foo" }
|
1383
|
+
end
|
1459
1384
|
|
1460
1385
|
expect(logs).to contains_log(
|
1461
1386
|
:warn,
|