appsignal 3.0.21.alpha.1-java → 3.0.21-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab615abe5b6e300341b57c3bc85147eba95e99730d382df8087eb636f777dd94
4
- data.tar.gz: 38099b1d602f9aed9b67d38e24cee1fa7b63cf069ad806e218b8d360f4655806
3
+ metadata.gz: d06f2baec0dd5d4ddc29c70448bc5bf2631b229f7a09b3e3348b30222b801c9d
4
+ data.tar.gz: 4bf2cdd9526d816434467686959ca3f2af27413ab3389253dfb7c7a5a0f0218c
5
5
  SHA512:
6
- metadata.gz: 3b0c2f190ea004672a780140a513c585d9bf543aab1caab1b2a4a9504da364efe552a7bd9d9f63d7f72e7249f78f9ca743120cb4c5d7382ffa9b605051a8a457
7
- data.tar.gz: 85e43d5094ac8247abe40cade7fe61665a8fc1f0d655db63277db1a9875fa61ab675f35ef48f04f17a77882d80003b1c0d0dac4aff10f2ef6a25957b5f70796f
6
+ metadata.gz: 24e9204497e65b7131724c37e67a1ffa106992244be8aa17ac0055869ea166a5679ff982dc1e726c95045efab17488d6c9c3b679c44314fa2f9a3accd9420734
7
+ data.tar.gz: fcd17e8dd7d8cfbd68ea2f51e2809553629cac960d3b75ce78ac42c8d5c2773faf665f7eb70886f0ffec39c9b6058cf1693dbc3d2e9112c4a98394c1e12ca15c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.0.21
4
+
5
+ ### Changed
6
+
7
+ - [548dd6f4](https://github.com/appsignal/appsignal-ruby/commit/548dd6f4c61ae3be24995a200dc3e5bea1a5f58c) patch - Add config override source. Track final decisions made by the Ruby gem in the configuration in the `override` config source. This will help us track new config options which are being set by their deprecated predecessors in the diagnose report.
8
+
9
+ ### Removed
10
+
11
+ - [3f503ade](https://github.com/appsignal/appsignal-ruby/commit/3f503ade83f22f4b0d86d76ea00e5f4dd3c56b6f) patch - Remove internal `Appsignal.extensions` system. It was unused.
12
+
3
13
  ## 3.0.21.alpha.1
4
14
 
5
15
  ### Changed
@@ -471,7 +471,8 @@ module Appsignal
471
471
  :system => config.system_config,
472
472
  :initial => config.initial_config,
473
473
  :file => config.file_config,
474
- :env => config.env_config
474
+ :env => config.env_config,
475
+ :override => config.override_config
475
476
  }
476
477
  }
477
478
  print_config_options(config)
@@ -170,7 +170,7 @@ module Appsignal
170
170
  # @return [Hash]
171
171
 
172
172
  attr_reader :root_path, :env, :config_hash, :system_config,
173
- :initial_config, :file_config, :env_config
173
+ :initial_config, :file_config, :env_config, :override_config
174
174
  attr_accessor :logger
175
175
 
176
176
  # Initialize a new configuration object for AppSignal.
@@ -231,6 +231,9 @@ module Appsignal
231
231
  # Load config from environment variables
232
232
  @env_config = load_from_environment
233
233
  merge(env_config)
234
+ # Load config overrides
235
+ @override_config = determine_overrides
236
+ merge(override_config)
234
237
  # Handle deprecated config options
235
238
  maintain_backwards_compatibility
236
239
  # Validate that we have a correct config
@@ -396,37 +399,23 @@ module Appsignal
396
399
 
397
400
  # Maintain backwards compatibility with deprecated config options.
398
401
  #
399
- # Add deprecated config options here with the behavior of setting its
400
- # replacement, if the replacement option is not configured by the user.
402
+ # Add warnings for deprecated config options here if they have no
403
+ # replacement, or should be non-functional.
404
+ #
405
+ # Add them to {determine_overrides} if replacement config options should be
406
+ # set instead.
401
407
  #
402
408
  # Make sure to remove the contents of this method in the next major
403
409
  # version, but the method itself with an empty body can stick around as a
404
410
  # structure for future deprecations.
405
411
  def maintain_backwards_compatibility
406
- skip_session_data = config_hash[:skip_session_data]
407
- send_session_data = config_hash[:send_session_data]
408
- if skip_session_data.nil? # Deprecated option is not set
409
- if send_session_data.nil? # Not configured by user
410
- @system_config[:send_session_data] = true
411
- merge(:send_session_data => true) # Set default value
412
- end
413
- else
414
- if send_session_data.nil? # Not configured by user
415
- @system_config[:send_session_data] = !skip_session_data
416
- merge(:send_session_data => !skip_session_data)
417
- end
418
- deprecation_message "The `skip_session_data` config option is " \
419
- "deprecated. Please use `send_session_data` instead.",
420
- logger
421
- end
412
+ return unless config_hash.key?(:working_dir_path)
422
413
 
423
- if config_hash.key?(:working_dir_path) # rubocop:disable Style/GuardClause
424
- deprecation_message \
425
- "The `working_dir_path` option is deprecated, please use " \
426
- "`working_directory_path` instead and specify the " \
427
- "full path to the working directory",
428
- logger
429
- end
414
+ deprecation_message \
415
+ "The `working_dir_path` option is deprecated, please use " \
416
+ "`working_directory_path` instead and specify the " \
417
+ "full path to the working directory",
418
+ logger
430
419
  end
431
420
 
432
421
  def load_from_environment
@@ -456,6 +445,31 @@ module Appsignal
456
445
  config
457
446
  end
458
447
 
448
+ # Set config options based on the final user config. Fix any conflicting
449
+ # config or set new config options based on deprecated config options.
450
+ #
451
+ # Make sure to remove behavior for deprecated config options in this method
452
+ # in the next major version, but the method itself with an empty body can
453
+ # stick around as a structure for future deprecations.
454
+ def determine_overrides
455
+ config = {}
456
+ skip_session_data = config_hash[:skip_session_data]
457
+ send_session_data = config_hash[:send_session_data]
458
+ if skip_session_data.nil? # Deprecated option is not set
459
+ if send_session_data.nil? # Not configured by user
460
+ config[:send_session_data] = true # Set default value
461
+ end
462
+ else
463
+ deprecation_message "The `skip_session_data` config option is " \
464
+ "deprecated. Please use `send_session_data` instead.",
465
+ logger
466
+ # Not configured by user
467
+ config[:send_session_data] = !skip_session_data if send_session_data.nil?
468
+ end
469
+
470
+ config
471
+ end
472
+
459
473
  def merge(new_config)
460
474
  new_config.each do |key, value|
461
475
  unless config_hash[key].nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.0.21.alpha.1".freeze
4
+ VERSION = "3.0.21".freeze
5
5
  end
data/lib/appsignal.rb CHANGED
@@ -58,20 +58,6 @@ module Appsignal
58
58
  # @see start_logger
59
59
  attr_writer :logger
60
60
 
61
- # @api private
62
- def extensions
63
- @extensions ||= []
64
- end
65
-
66
- # @api private
67
- def initialize_extensions
68
- Appsignal.logger.debug("Initializing extensions")
69
- extensions.each do |extension|
70
- Appsignal.logger.debug("Initializing #{extension}")
71
- extension.initializer
72
- end
73
- end
74
-
75
61
  # @api private
76
62
  def testing?
77
63
  false
@@ -123,7 +109,6 @@ module Appsignal
123
109
  config.write_to_environment
124
110
  Appsignal::Extension.start
125
111
  Appsignal::Hooks.load_hooks
126
- initialize_extensions
127
112
 
128
113
  if config[:enable_allocation_tracking] && !Appsignal::System.jruby?
129
114
  Appsignal::Extension.install_allocation_event_hook
@@ -772,10 +772,11 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
772
772
  "options" => default_config.merge("env" => "", "send_session_data" => true),
773
773
  "sources" => {
774
774
  "default" => default_config,
775
- "system" => { "send_session_data" => true },
775
+ "system" => {},
776
776
  "initial" => { "env" => "" },
777
777
  "file" => {},
778
- "env" => {}
778
+ "env" => {},
779
+ "override" => { "send_session_data" => true }
779
780
  }
780
781
  )
781
782
  end
@@ -890,10 +891,11 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
890
891
  "options" => hash_with_string_keys(final_config),
891
892
  "sources" => {
892
893
  "default" => hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG),
893
- "system" => { "send_session_data" => true },
894
+ "system" => {},
894
895
  "initial" => hash_with_string_keys(config.initial_config.merge(additional_initial_config)),
895
896
  "file" => hash_with_string_keys(config.file_config),
896
- "env" => {}
897
+ "env" => {},
898
+ "override" => { "send_session_data" => true }
897
899
  }
898
900
  )
899
901
  end
@@ -917,10 +919,11 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
917
919
  "options" => hash_with_string_keys(config.config_hash).merge("env" => "foobar"),
918
920
  "sources" => {
919
921
  "default" => hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG),
920
- "system" => { "send_session_data" => true },
922
+ "system" => {},
921
923
  "initial" => hash_with_string_keys(config.initial_config),
922
924
  "file" => hash_with_string_keys(config.file_config),
923
- "env" => {}
925
+ "env" => {},
926
+ "override" => { "send_session_data" => true }
924
927
  }
925
928
  )
926
929
  end
@@ -434,6 +434,87 @@ describe Appsignal::Config do
434
434
  end
435
435
  end
436
436
 
437
+ describe "with config based on overrides" do
438
+ let(:log_stream) { StringIO.new }
439
+ let(:logger) { test_logger(log_stream) }
440
+ let(:logs) { log_contents(log_stream) }
441
+ let(:config) do
442
+ described_class.new(Dir.pwd, "production", config_options, logger)
443
+ end
444
+
445
+ describe "skip_session_data" do
446
+ let(:err_stream) { std_stream }
447
+ let(:stderr) { err_stream.read }
448
+ let(:deprecation_message) do
449
+ "The `skip_session_data` config option is deprecated. Please use " \
450
+ "`send_session_data` instead."
451
+ end
452
+ before do
453
+ capture_std_streams(std_stream, err_stream) { config }
454
+ end
455
+
456
+ context "when not set" do
457
+ let(:config_options) { {} }
458
+
459
+ it "sets the default send_session_data value" do
460
+ expect(config[:skip_session_data]).to be_nil
461
+ expect(config[:send_session_data]).to eq(true)
462
+ expect(config.override_config[:send_session_data]).to eq(true)
463
+ end
464
+
465
+ it "does not print a deprecation warning" do
466
+ expect(stderr).to_not include("appsignal WARNING: #{deprecation_message}")
467
+ expect(logs).to_not include(deprecation_message)
468
+ end
469
+ end
470
+
471
+ context "when set to true" do
472
+ let(:config_options) { { :skip_session_data => true } }
473
+
474
+ it "sets send_session_data if send_session_data is not set by the user" do
475
+ expect(config[:skip_session_data]).to eq(true)
476
+ expect(config[:send_session_data]).to eq(false)
477
+ expect(config.override_config[:send_session_data]).to eq(false)
478
+ end
479
+
480
+ it "prints a deprecation warning" do
481
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
482
+ expect(logs).to include(deprecation_message)
483
+ end
484
+ end
485
+
486
+ context "when set to false" do
487
+ let(:config_options) { { :skip_session_data => false } }
488
+
489
+ it "sets send_session_data if send_session_data is not set by the user" do
490
+ expect(config[:skip_session_data]).to eq(false)
491
+ expect(config[:send_session_data]).to eq(true)
492
+ expect(config.override_config[:send_session_data]).to eq(true)
493
+ end
494
+
495
+ it "prints a deprecation warning" do
496
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
497
+ expect(logs).to include(deprecation_message)
498
+ end
499
+ end
500
+
501
+ context "when skip_session_data and send_session_data are both set" do
502
+ let(:config_options) { { :skip_session_data => true, :send_session_data => true } }
503
+
504
+ it "does not overwrite the send_session_data value" do
505
+ expect(config[:skip_session_data]).to eq(true)
506
+ expect(config[:send_session_data]).to eq(true)
507
+ expect(config.override_config[:send_session_data]).to be_nil
508
+ end
509
+
510
+ it "prints a deprecation warning" do
511
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
512
+ expect(logs).to include(deprecation_message)
513
+ end
514
+ end
515
+ end
516
+ end
517
+
437
518
  describe "config keys" do
438
519
  describe ":endpoint" do
439
520
  subject { config[:endpoint] }
@@ -789,78 +870,6 @@ describe Appsignal::Config do
789
870
  end
790
871
  end
791
872
  end
792
-
793
- describe "skip_session_data" do
794
- let(:err_stream) { std_stream }
795
- let(:stderr) { err_stream.read }
796
- let(:deprecation_message) do
797
- "The `skip_session_data` config option is deprecated. Please use " \
798
- "`send_session_data` instead."
799
- end
800
- before do
801
- capture_std_streams(std_stream, err_stream) { config }
802
- end
803
-
804
- context "when not set" do
805
- let(:config_options) { {} }
806
-
807
- it "sets the default send_session_data value" do
808
- expect(config[:skip_session_data]).to be_nil
809
- expect(config[:send_session_data]).to eq(true)
810
- expect(config.system_config[:send_session_data]).to eq(true)
811
- end
812
-
813
- it "does not print a deprecation warning" do
814
- expect(stderr).to_not include("appsignal WARNING: #{deprecation_message}")
815
- expect(logs).to_not include(deprecation_message)
816
- end
817
- end
818
-
819
- context "when set to true" do
820
- let(:config_options) { { :skip_session_data => true } }
821
-
822
- it "sets send_session_data if send_session_data is not set by the user" do
823
- expect(config[:skip_session_data]).to eq(true)
824
- expect(config[:send_session_data]).to eq(false)
825
- expect(config.system_config[:send_session_data]).to eq(false)
826
- end
827
-
828
- it "prints a deprecation warning" do
829
- expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
830
- expect(logs).to include(deprecation_message)
831
- end
832
- end
833
-
834
- context "when set to false" do
835
- let(:config_options) { { :skip_session_data => false } }
836
-
837
- it "sets send_session_data if send_session_data is not set by the user" do
838
- expect(config[:skip_session_data]).to eq(false)
839
- expect(config[:send_session_data]).to eq(true)
840
- expect(config.system_config[:send_session_data]).to eq(true)
841
- end
842
-
843
- it "prints a deprecation warning" do
844
- expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
845
- expect(logs).to include(deprecation_message)
846
- end
847
- end
848
-
849
- context "when skip_session_data and send_session_data are both set" do
850
- let(:config_options) { { :skip_session_data => true, :send_session_data => true } }
851
-
852
- it "does not overwrite the send_session_data value" do
853
- expect(config[:skip_session_data]).to eq(true)
854
- expect(config[:send_session_data]).to eq(true)
855
- expect(config.system_config[:send_session_data]).to be_nil
856
- end
857
-
858
- it "prints a deprecation warning" do
859
- expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
860
- expect(logs).to include(deprecation_message)
861
- end
862
- end
863
- end
864
873
  end
865
874
 
866
875
  describe "#validate" do
@@ -5,7 +5,6 @@ describe Appsignal do
5
5
  # Make sure we have a clean state because we want to test
6
6
  # initialization here.
7
7
  Appsignal.config = nil
8
- Appsignal.extensions.clear
9
8
  end
10
9
 
11
10
  let(:transaction) { http_request_transaction }
@@ -20,14 +19,6 @@ describe Appsignal do
20
19
  end
21
20
  end
22
21
 
23
- describe ".extensions" do
24
- it "should keep a list of extensions" do
25
- expect(Appsignal.extensions).to be_empty
26
- Appsignal.extensions << Appsignal::MockExtension
27
- expect(Appsignal.extensions.size).to eq(1)
28
- end
29
- end
30
-
31
22
  describe ".start" do
32
23
  context "with no config set beforehand" do
33
24
  it "should do nothing when config is not set and there is no valid config in the env" do
@@ -63,15 +54,6 @@ describe Appsignal do
63
54
  Appsignal.start
64
55
  end
65
56
 
66
- context "with an extension" do
67
- before { Appsignal.extensions << Appsignal::MockExtension }
68
-
69
- it "should call the extension's initializer" do
70
- expect(Appsignal::MockExtension).to receive(:initializer)
71
- Appsignal.start
72
- end
73
- end
74
-
75
57
  context "when allocation tracking and gc instrumentation have been enabled" do
76
58
  before do
77
59
  allow(GC::Profiler).to receive(:enable)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.21.alpha.1
4
+ version: 3.0.21
5
5
  platform: java
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-02-14 00:00:00.000000000 Z
13
+ date: 2022-02-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -405,7 +405,6 @@ files:
405
405
  - spec/support/matchers/contains_log.rb
406
406
  - spec/support/matchers/have_colorized_text.rb
407
407
  - spec/support/mocks/fake_gc_profiler.rb
408
- - spec/support/mocks/mock_extension.rb
409
408
  - spec/support/mocks/mock_probe.rb
410
409
  - spec/support/rails/my_app.rb
411
410
  - spec/support/shared_examples/instrument.rb
@@ -437,9 +436,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
437
436
  version: '2.0'
438
437
  required_rubygems_version: !ruby/object:Gem::Requirement
439
438
  requirements:
440
- - - ">"
439
+ - - ">="
441
440
  - !ruby/object:Gem::Version
442
- version: 1.3.1
441
+ version: '0'
443
442
  requirements: []
444
443
  rubygems_version: 3.1.6
445
444
  signing_key:
@@ -559,7 +558,6 @@ test_files:
559
558
  - spec/support/matchers/contains_log.rb
560
559
  - spec/support/matchers/have_colorized_text.rb
561
560
  - spec/support/mocks/fake_gc_profiler.rb
562
- - spec/support/mocks/mock_extension.rb
563
561
  - spec/support/mocks/mock_probe.rb
564
562
  - spec/support/rails/my_app.rb
565
563
  - spec/support/shared_examples/instrument.rb
@@ -1,6 +0,0 @@
1
- module Appsignal
2
- module MockExtension
3
- def self.initializer
4
- end
5
- end
6
- end