appsignal 3.0.19-java → 3.0.20-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: 17182fe55720774cc53c63ef15cc346fb581ecdde896d8dee3458d4ba18855f7
4
- data.tar.gz: 6faac0d1b0fa8abefc0908628a98918d3cbec6eae45ae4a7d275c4537eb03b59
3
+ metadata.gz: b93ea1beed4cd181416355731fbc03a8faf20a95cbc25229c38839f3745a4d00
4
+ data.tar.gz: 37340595960a772bd6e094a6fc04d4f8940ac0ef96ecb3e848d7ce58f3f5019e
5
5
  SHA512:
6
- metadata.gz: 90d99750118e1f746a4348ae4f3fc30fdff5a2b0f2c4e2d93bb55bc0f2542ad943eb1c759a6b91657a6164c37b4a5e5b28d43419077722015d1ff4731817863f
7
- data.tar.gz: cf0735657d7c4ebcaff3c28863d7ee8e5b244f8945dbe16d0d764130826d99bce49aca1c13a5adbd62a196acbf23827fcbfe8a3558843298e56585896a3a0812
6
+ metadata.gz: 741aeaab84a7c7eae7f2909a0b07017c2a31d09b3c29916eb79aef176c3178b8545f1aa91b6a0e33fcc909eed4e678ad4c4a7865badf07f2a24807b8f125c756
7
+ data.tar.gz: a3c490e7d04be8896d9513041d3d37e58dd5179664c8725d6939b432f6b516f70d27b3e27f2afde407cf145775a174619745976ab31c50747acbbbc7af29eb55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.0.20
4
+
5
+ ### Added
6
+
7
+ - [35bd83b8](https://github.com/appsignal/appsignal-ruby/commit/35bd83b84fd30f0188d9f134cfd249360b6e281d) patch - Add `send_session_data` option to configure if session data is automatically included transactions. By default this is turned on. It can be disabled by configuring `send_session_data` to `false`.
8
+
9
+ ### Deprecated
10
+
11
+ - [35bd83b8](https://github.com/appsignal/appsignal-ruby/commit/35bd83b84fd30f0188d9f134cfd249360b6e281d) patch - Deprecate `skip_session_data` option in favor of the newly introduced `send_session_data` option. If it is configured it will print a warning on AppSignal load, but will also retain its functionality until the config option is fully removed in the next major release.
12
+ - [e51a8fb6](https://github.com/appsignal/appsignal-ruby/commit/e51a8fb653fccc5a6b72ac7af9c9417e6827e2e9) patch - Warn about the deprecated `working_dir_path` option from all config sources. It previously only printed a warning when it was configured in the `config/appsignal.yml` file, but now also prints the warning if it's set via the Config class initialize options and environment variables. Please use the `working_directory_path` option instead.
13
+
14
+ ### Fixed
15
+
16
+ - [c9000eee](https://github.com/appsignal/appsignal-ruby/commit/c9000eeefec722cb940b2e14f37d31a7827986d6) patch - Fix reported Ruby version in diagnose report. It would report only the first major release of the series, e.g. 2.6.0 for 2.6.1.
17
+
3
18
  ## 3.0.19
4
19
 
5
20
  ### Changed
data/ext/base.rb CHANGED
@@ -31,7 +31,7 @@ def report
31
31
  },
32
32
  "language" => {
33
33
  "name" => "ruby",
34
- "version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
34
+ "version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
35
35
  },
36
36
  "download" => {
37
37
  "checksum" => "unverified",
@@ -443,7 +443,7 @@ module Appsignal
443
443
  save :os, os
444
444
  puts_value "Operating System", os_label
445
445
 
446
- language_version = "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
446
+ language_version = "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
447
447
  save :language_version, language_version
448
448
  puts_format "Ruby version", language_version
449
449
 
@@ -39,7 +39,6 @@ module Appsignal
39
39
  ],
40
40
  :send_environment_metadata => true,
41
41
  :send_params => true,
42
- :skip_session_data => false,
43
42
  :transaction_debug_mode => false
44
43
  }.freeze
45
44
 
@@ -88,6 +87,7 @@ module Appsignal
88
87
  "APPSIGNAL_RUNNING_IN_CONTAINER" => :running_in_container,
89
88
  "APPSIGNAL_SEND_ENVIRONMENT_METADATA" => :send_environment_metadata,
90
89
  "APPSIGNAL_SEND_PARAMS" => :send_params,
90
+ "APPSIGNAL_SEND_SESSION_DATA" => :send_session_data,
91
91
  "APPSIGNAL_SKIP_SESSION_DATA" => :skip_session_data,
92
92
  "APPSIGNAL_TRANSACTION_DEBUG_MODE" => :transaction_debug_mode,
93
93
  "APPSIGNAL_WORKING_DIRECTORY_PATH" => :working_directory_path,
@@ -125,6 +125,7 @@ module Appsignal
125
125
  APPSIGNAL_RUNNING_IN_CONTAINER
126
126
  APPSIGNAL_SEND_ENVIRONMENT_METADATA
127
127
  APPSIGNAL_SEND_PARAMS
128
+ APPSIGNAL_SEND_SESSION_DATA
128
129
  APPSIGNAL_SKIP_SESSION_DATA
129
130
  APPSIGNAL_TRANSACTION_DEBUG_MODE
130
131
  ].freeze
@@ -230,6 +231,8 @@ module Appsignal
230
231
  # Load config from environment variables
231
232
  @env_config = load_from_environment
232
233
  merge(env_config)
234
+ # Handle deprecated config options
235
+ maintain_backwards_compatibility
233
236
  # Validate that we have a correct config
234
237
  validate
235
238
  # Track origin of env
@@ -374,12 +377,9 @@ module Appsignal
374
377
  configurations = YAML.load(ERB.new(IO.read(config_file)).result, **read_options)
375
378
  config_for_this_env = configurations[env]
376
379
  if config_for_this_env
377
- config_for_this_env =
378
- config_for_this_env.each_with_object({}) do |(key, value), hash|
379
- hash[key.to_sym] = value # convert keys to symbols
380
- end
381
-
382
- maintain_backwards_compatibility(config_for_this_env)
380
+ config_for_this_env.each_with_object({}) do |(key, value), hash|
381
+ hash[key.to_sym] = value # convert keys to symbols
382
+ end
383
383
  else
384
384
  logger.error "Not loading from config file: config for '#{env}' not found"
385
385
  nil
@@ -394,19 +394,38 @@ module Appsignal
394
394
  nil
395
395
  end
396
396
 
397
- # Maintain backwards compatibility with config files generated by earlier
398
- # versions of the gem
397
+ # Maintain backwards compatibility with deprecated config options.
399
398
  #
400
- # Used by {#load_from_disk}. No compatibility for env variables or initial config currently.
401
- def maintain_backwards_compatibility(configuration)
402
- configuration.tap do |config|
403
- if config.include?(:working_dir_path)
404
- deprecation_message \
405
- "'working_dir_path' is deprecated, please use " \
406
- "'working_directory_path' instead and specify the " \
407
- "full path to the working directory",
408
- logger
399
+ # Add deprecated config options here with the behavior of setting its
400
+ # replacement, if the replacement option is not configured by the user.
401
+ #
402
+ # Make sure to remove the contents of this method in the next major
403
+ # version, but the method itself with an empty body can stick around as a
404
+ # structure for future deprecations.
405
+ 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
409
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
422
+
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
410
429
  end
411
430
  end
412
431
 
@@ -476,12 +476,12 @@ module Appsignal
476
476
  #
477
477
  # The session data is sanitized by the {Appsignal::Utils::HashSanitizer}.
478
478
  #
479
- # @return [nil] if `:skip_session_data` config is set to `true`.
479
+ # @return [nil] if `:send_session_data` config is set to `false`.
480
480
  # @return [nil] if the {#request} object doesn't respond to `#session`.
481
481
  # @return [nil] if the {#request} session data is `nil`.
482
482
  # @return [Hash<String, Object>]
483
483
  def sanitized_session_data
484
- return if Appsignal.config[:skip_session_data] ||
484
+ return if !Appsignal.config[:send_session_data] ||
485
485
  !request.respond_to?(:session)
486
486
  session = request.session
487
487
  return unless session
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.0.19".freeze
4
+ VERSION = "3.0.20".freeze
5
5
  end
@@ -258,7 +258,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
258
258
  },
259
259
  "language" => {
260
260
  "name" => "ruby",
261
- "version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}",
261
+ "version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}",
262
262
  "implementation" => jruby ? "jruby" : "ruby"
263
263
  },
264
264
  "download" => {
@@ -295,7 +295,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
295
295
  " Status: success",
296
296
  "Language details",
297
297
  " Implementation: \"#{jruby ? "jruby" : "ruby"}\"",
298
- " Ruby version: \"#{"#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
298
+ " Ruby version: \"#{"#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
299
299
  "Download details",
300
300
  " Download URL: \"https://",
301
301
  " Checksum: \"verified\"",
@@ -604,7 +604,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
604
604
 
605
605
  describe "host information" do
606
606
  let(:rbconfig) { RbConfig::CONFIG }
607
- let(:language_version) { "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}" }
607
+ let(:language_version) { "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}" }
608
608
 
609
609
  it "outputs host information" do
610
610
  run
@@ -769,10 +769,10 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
769
769
  it "transmits validation in report" do
770
770
  default_config = hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG)
771
771
  expect(received_report["config"]).to eq(
772
- "options" => default_config.merge("env" => ""),
772
+ "options" => default_config.merge("env" => "", "send_session_data" => true),
773
773
  "sources" => {
774
774
  "default" => default_config,
775
- "system" => {},
775
+ "system" => { "send_session_data" => true },
776
776
  "initial" => { "env" => "" },
777
777
  "file" => {},
778
778
  "env" => {}
@@ -890,7 +890,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
890
890
  "options" => hash_with_string_keys(final_config),
891
891
  "sources" => {
892
892
  "default" => hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG),
893
- "system" => {},
893
+ "system" => { "send_session_data" => true },
894
894
  "initial" => hash_with_string_keys(config.initial_config.merge(additional_initial_config)),
895
895
  "file" => hash_with_string_keys(config.file_config),
896
896
  "env" => {}
@@ -917,7 +917,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
917
917
  "options" => hash_with_string_keys(config.config_hash).merge("env" => "foobar"),
918
918
  "sources" => {
919
919
  "default" => hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG),
920
- "system" => {},
920
+ "system" => { "send_session_data" => true },
921
921
  "initial" => hash_with_string_keys(config.initial_config),
922
922
  "file" => hash_with_string_keys(config.file_config),
923
923
  "env" => {}
@@ -69,8 +69,8 @@ describe Appsignal::Config do
69
69
  end
70
70
 
71
71
  it "sets the push_api_key as loaded through the env_config" do
72
- expect(config.env_config).to eq(:push_api_key => "abc")
73
- expect(config.system_config).to eq(:active => true)
72
+ expect(config.env_config).to include(:push_api_key => "abc")
73
+ expect(config.system_config).to include(:active => true)
74
74
  end
75
75
  end
76
76
 
@@ -82,8 +82,8 @@ describe Appsignal::Config do
82
82
  end
83
83
 
84
84
  it "sets the push_api_key as loaded through the env_config" do
85
- expect(config.env_config).to eq(:push_api_key => "")
86
- expect(config.system_config).to be_empty
85
+ expect(config.env_config).to include(:push_api_key => "")
86
+ expect(config.system_config).to_not have_key(:active)
87
87
  end
88
88
  end
89
89
 
@@ -95,8 +95,8 @@ describe Appsignal::Config do
95
95
  end
96
96
 
97
97
  it "sets the push_api_key as loaded through the env_config" do
98
- expect(config.env_config).to eq(:push_api_key => " ")
99
- expect(config.system_config).to be_empty
98
+ expect(config.env_config).to include(:push_api_key => " ")
99
+ expect(config.system_config).to_not have_key(:active)
100
100
  end
101
101
  end
102
102
  end
@@ -119,7 +119,7 @@ describe Appsignal::Config do
119
119
  end
120
120
 
121
121
  it "sets the log as loaded through the system" do
122
- expect(config.system_config).to eq(:log => "stdout")
122
+ expect(config.system_config).to include(:log => "stdout")
123
123
  end
124
124
  end
125
125
 
@@ -129,7 +129,7 @@ describe Appsignal::Config do
129
129
  end
130
130
 
131
131
  it "does not set log as loaded through the system" do
132
- expect(config.system_config).to eq({})
132
+ expect(config.system_config).to_not have_key(:log)
133
133
  end
134
134
  end
135
135
  end
@@ -177,7 +177,7 @@ describe Appsignal::Config do
177
177
  :revision => "v2.5.1",
178
178
  :send_environment_metadata => true,
179
179
  :send_params => true,
180
- :skip_session_data => false,
180
+ :send_session_data => true,
181
181
  :transaction_debug_mode => false
182
182
  )
183
183
  end
@@ -743,6 +743,126 @@ describe Appsignal::Config do
743
743
  end
744
744
  end
745
745
 
746
+ describe "#maintain_backwards_compatibility" do
747
+ let(:log_stream) { StringIO.new }
748
+ let(:logger) { test_logger(log_stream) }
749
+ let(:logs) { log_contents(log_stream) }
750
+ let(:config) do
751
+ described_class.new(Dir.pwd, "production", config_options, logger)
752
+ end
753
+
754
+ describe "working_dir_path" do
755
+ let(:err_stream) { std_stream }
756
+ let(:stderr) { err_stream.read }
757
+ let(:deprecation_message) do
758
+ "The `working_dir_path` option is deprecated, please use " \
759
+ "`working_directory_path` instead and specify the " \
760
+ "full path to the working directory"
761
+ end
762
+ before do
763
+ capture_std_streams(std_stream, err_stream) { config }
764
+ end
765
+
766
+ context "when not set" do
767
+ let(:config_options) { {} }
768
+
769
+ it "sets the default working_dir_path value" do
770
+ expect(config[:working_dir_path]).to be_nil
771
+ end
772
+
773
+ it "does not print a deprecation warning" do
774
+ expect(stderr).to_not include("appsignal WARNING: #{deprecation_message}")
775
+ expect(logs).to_not include(deprecation_message)
776
+ end
777
+ end
778
+
779
+ context "when set" do
780
+ let(:config_options) { { :working_dir_path => "/tmp/appsignal2" } }
781
+
782
+ it "sets the default working_dir_path value" do
783
+ expect(config[:working_dir_path]).to eq("/tmp/appsignal2")
784
+ end
785
+
786
+ it "does not print a deprecation warning" do
787
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
788
+ expect(logs).to include(deprecation_message)
789
+ end
790
+ end
791
+ 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
+ end
865
+
746
866
  describe "#validate" do
747
867
  subject { config.valid? }
748
868
  let(:config) do
@@ -1282,8 +1282,8 @@ describe Appsignal::Transaction do
1282
1282
  end
1283
1283
  end
1284
1284
 
1285
- context "when skipping session data" do
1286
- before { Appsignal.config[:skip_session_data] = true }
1285
+ context "when not sending session data" do
1286
+ before { Appsignal.config[:send_session_data] = false }
1287
1287
 
1288
1288
  it "does not set any session data on the transaction" do
1289
1289
  expect(subject).to be_nil
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.19
4
+ version: 3.0.20
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-01-07 00:00:00.000000000 Z
13
+ date: 2022-01-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack