appsignal 3.0.19 → 3.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/ext/base.rb +1 -1
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +37 -18
- data/lib/appsignal/transaction.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +7 -7
- data/spec/lib/appsignal/config_spec.rb +129 -9
- data/spec/lib/appsignal/transaction_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e505270b1fc0966691e2d270ae08fbe7157ee4fde1708dd3252e7da69c7c9e
|
4
|
+
data.tar.gz: 37340595960a772bd6e094a6fc04d4f8940ac0ef96ecb3e848d7ce58f3f5019e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4caeabfd901dfaae05d3aece53d2f346a80cb7e7134a98e59cc9c52788d0536ec3866dbb0371e5da8f3514a2b1e6301686670604c7b43c2a30c0ea24dd78ae2
|
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["
|
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["
|
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
|
|
data/lib/appsignal/config.rb
CHANGED
@@ -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
|
-
|
379
|
-
|
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
|
398
|
-
# versions of the gem
|
397
|
+
# Maintain backwards compatibility with deprecated config options.
|
399
398
|
#
|
400
|
-
#
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
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 `:
|
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[:
|
484
|
+
return if !Appsignal.config[:send_session_data] ||
|
485
485
|
!request.respond_to?(:session)
|
486
486
|
session = request.session
|
487
487
|
return unless session
|
data/lib/appsignal/version.rb
CHANGED
@@ -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["
|
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["
|
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["
|
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
|
73
|
-
expect(config.system_config).to
|
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
|
86
|
-
expect(config.system_config).
|
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
|
99
|
-
expect(config.system_config).
|
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
|
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).
|
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
|
-
:
|
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
|
1286
|
-
before { Appsignal.config[:
|
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.
|
4
|
+
version: 3.0.20
|
5
5
|
platform: ruby
|
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-
|
13
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|