appsignal 3.0.18-java → 3.0.21-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +134 -0
- data/CHANGELOG.md +44 -0
- data/appsignal.gemspec +1 -0
- data/build_matrix.yml +8 -1
- data/ext/base.rb +3 -2
- data/gemfiles/rails-6.1.gemfile +7 -0
- data/gemfiles/rails-7.0.gemfile +1 -1
- data/lib/appsignal/cli/diagnose/utils.rb +0 -14
- data/lib/appsignal/cli/diagnose.rb +6 -5
- data/lib/appsignal/config.rb +54 -21
- data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +7 -18
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +24 -0
- data/lib/appsignal/system.rb +0 -4
- data/lib/appsignal/transaction.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +0 -15
- data/spec/lib/appsignal/cli/diagnose_spec.rb +14 -11
- data/spec/lib/appsignal/config_spec.rb +138 -9
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +21 -47
- data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +30 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +2 -19
- data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +5 -1
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +14 -5
- data/spec/lib/appsignal/transaction_spec.rb +2 -2
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -2
- data/spec/lib/appsignal_spec.rb +59 -38
- data/spec/support/helpers/activejob_helpers.rb +27 -0
- data/spec/support/helpers/dependency_helper.rb +13 -1
- data/spec/support/helpers/transaction_helpers.rb +10 -0
- metadata +10 -5
- data/spec/support/mocks/mock_extension.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d06f2baec0dd5d4ddc29c70448bc5bf2631b229f7a09b3e3348b30222b801c9d
|
4
|
+
data.tar.gz: 4bf2cdd9526d816434467686959ca3f2af27413ab3389253dfb7c7a5a0f0218c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e9204497e65b7131724c37e67a1ffa106992244be8aa17ac0055869ea166a5679ff982dc1e726c95045efab17488d6c9c3b679c44314fa2f9a3accd9420734
|
7
|
+
data.tar.gz: fcd17e8dd7d8cfbd68ea2f51e2809553629cac960d3b75ce78ac42c8d5c2773faf665f7eb70886f0ffec39c9b6058cf1693dbc3d2e9112c4a98394c1e12ca15c
|
data/.semaphore/semaphore.yml
CHANGED
@@ -446,6 +446,25 @@ blocks:
|
|
446
446
|
commands:
|
447
447
|
- "./support/bundler_wrapper exec rake test"
|
448
448
|
- "./support/bundler_wrapper exec rake test:failure"
|
449
|
+
- name: Ruby 2.5.8 for rails-6.1
|
450
|
+
env_vars:
|
451
|
+
- *2
|
452
|
+
- *3
|
453
|
+
- *4
|
454
|
+
- *5
|
455
|
+
- name: RUBY_VERSION
|
456
|
+
value: 2.5.8
|
457
|
+
- name: GEMSET
|
458
|
+
value: rails-6.1
|
459
|
+
- name: BUNDLE_GEMFILE
|
460
|
+
value: gemfiles/rails-6.1.gemfile
|
461
|
+
- name: _RUBYGEMS_VERSION
|
462
|
+
value: latest
|
463
|
+
- name: _BUNDLER_VERSION
|
464
|
+
value: latest
|
465
|
+
commands:
|
466
|
+
- "./support/bundler_wrapper exec rake test"
|
467
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
449
468
|
- name: Ruby 2.6.9
|
450
469
|
dependencies:
|
451
470
|
- Validation
|
@@ -683,6 +702,25 @@ blocks:
|
|
683
702
|
commands:
|
684
703
|
- "./support/bundler_wrapper exec rake test"
|
685
704
|
- "./support/bundler_wrapper exec rake test:failure"
|
705
|
+
- name: Ruby 2.6.9 for rails-6.1
|
706
|
+
env_vars:
|
707
|
+
- *2
|
708
|
+
- *3
|
709
|
+
- *4
|
710
|
+
- *5
|
711
|
+
- name: RUBY_VERSION
|
712
|
+
value: 2.6.9
|
713
|
+
- name: GEMSET
|
714
|
+
value: rails-6.1
|
715
|
+
- name: BUNDLE_GEMFILE
|
716
|
+
value: gemfiles/rails-6.1.gemfile
|
717
|
+
- name: _RUBYGEMS_VERSION
|
718
|
+
value: latest
|
719
|
+
- name: _BUNDLER_VERSION
|
720
|
+
value: latest
|
721
|
+
commands:
|
722
|
+
- "./support/bundler_wrapper exec rake test"
|
723
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
686
724
|
- name: Ruby 2.6.9 for resque-1
|
687
725
|
env_vars:
|
688
726
|
- *2
|
@@ -1034,6 +1072,25 @@ blocks:
|
|
1034
1072
|
commands:
|
1035
1073
|
- "./support/bundler_wrapper exec rake test"
|
1036
1074
|
- "./support/bundler_wrapper exec rake test:failure"
|
1075
|
+
- name: Ruby 2.7.5 for rails-6.1
|
1076
|
+
env_vars:
|
1077
|
+
- *2
|
1078
|
+
- *3
|
1079
|
+
- *4
|
1080
|
+
- *5
|
1081
|
+
- name: RUBY_VERSION
|
1082
|
+
value: 2.7.5
|
1083
|
+
- name: GEMSET
|
1084
|
+
value: rails-6.1
|
1085
|
+
- name: BUNDLE_GEMFILE
|
1086
|
+
value: gemfiles/rails-6.1.gemfile
|
1087
|
+
- name: _RUBYGEMS_VERSION
|
1088
|
+
value: latest
|
1089
|
+
- name: _BUNDLER_VERSION
|
1090
|
+
value: latest
|
1091
|
+
commands:
|
1092
|
+
- "./support/bundler_wrapper exec rake test"
|
1093
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
1037
1094
|
- name: Ruby 2.7.5 for rails-7.0
|
1038
1095
|
env_vars:
|
1039
1096
|
- *2
|
@@ -1347,6 +1404,25 @@ blocks:
|
|
1347
1404
|
commands:
|
1348
1405
|
- "./support/bundler_wrapper exec rake test"
|
1349
1406
|
- "./support/bundler_wrapper exec rake test:failure"
|
1407
|
+
- name: Ruby 3.0.3 for rails-6.1
|
1408
|
+
env_vars:
|
1409
|
+
- *2
|
1410
|
+
- *3
|
1411
|
+
- *4
|
1412
|
+
- *5
|
1413
|
+
- name: RUBY_VERSION
|
1414
|
+
value: 3.0.3
|
1415
|
+
- name: GEMSET
|
1416
|
+
value: rails-6.1
|
1417
|
+
- name: BUNDLE_GEMFILE
|
1418
|
+
value: gemfiles/rails-6.1.gemfile
|
1419
|
+
- name: _RUBYGEMS_VERSION
|
1420
|
+
value: latest
|
1421
|
+
- name: _BUNDLER_VERSION
|
1422
|
+
value: latest
|
1423
|
+
commands:
|
1424
|
+
- "./support/bundler_wrapper exec rake test"
|
1425
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
1350
1426
|
- name: Ruby 3.0.3 for rails-7.0
|
1351
1427
|
env_vars:
|
1352
1428
|
- *2
|
@@ -1603,6 +1679,44 @@ blocks:
|
|
1603
1679
|
commands:
|
1604
1680
|
- "./support/bundler_wrapper exec rake test"
|
1605
1681
|
- "./support/bundler_wrapper exec rake test:failure"
|
1682
|
+
- name: Ruby 3.1.0 for rails-6.1
|
1683
|
+
env_vars:
|
1684
|
+
- *2
|
1685
|
+
- *3
|
1686
|
+
- *4
|
1687
|
+
- *5
|
1688
|
+
- name: RUBY_VERSION
|
1689
|
+
value: 3.1.0
|
1690
|
+
- name: GEMSET
|
1691
|
+
value: rails-6.1
|
1692
|
+
- name: BUNDLE_GEMFILE
|
1693
|
+
value: gemfiles/rails-6.1.gemfile
|
1694
|
+
- name: _RUBYGEMS_VERSION
|
1695
|
+
value: latest
|
1696
|
+
- name: _BUNDLER_VERSION
|
1697
|
+
value: latest
|
1698
|
+
commands:
|
1699
|
+
- "./support/bundler_wrapper exec rake test"
|
1700
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
1701
|
+
- name: Ruby 3.1.0 for rails-7.0
|
1702
|
+
env_vars:
|
1703
|
+
- *2
|
1704
|
+
- *3
|
1705
|
+
- *4
|
1706
|
+
- *5
|
1707
|
+
- name: RUBY_VERSION
|
1708
|
+
value: 3.1.0
|
1709
|
+
- name: GEMSET
|
1710
|
+
value: rails-7.0
|
1711
|
+
- name: BUNDLE_GEMFILE
|
1712
|
+
value: gemfiles/rails-7.0.gemfile
|
1713
|
+
- name: _RUBYGEMS_VERSION
|
1714
|
+
value: latest
|
1715
|
+
- name: _BUNDLER_VERSION
|
1716
|
+
value: latest
|
1717
|
+
commands:
|
1718
|
+
- "./support/bundler_wrapper exec rake test"
|
1719
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
1606
1720
|
- name: Ruby 3.1.0 for resque-2
|
1607
1721
|
env_vars:
|
1608
1722
|
- *2
|
@@ -1769,3 +1883,23 @@ blocks:
|
|
1769
1883
|
commands:
|
1770
1884
|
- "./support/bundler_wrapper exec rake test"
|
1771
1885
|
- "./support/bundler_wrapper exec rake test:failure"
|
1886
|
+
- name: Ruby jruby-9.2.19.0 for rails-6.1
|
1887
|
+
env_vars:
|
1888
|
+
- *2
|
1889
|
+
- *3
|
1890
|
+
- *4
|
1891
|
+
- *5
|
1892
|
+
- name: RUBY_VERSION
|
1893
|
+
value: jruby-9.2.19.0
|
1894
|
+
- name: GEMSET
|
1895
|
+
value: rails-6.1
|
1896
|
+
- name: BUNDLE_GEMFILE
|
1897
|
+
value: gemfiles/rails-6.1.gemfile
|
1898
|
+
- name: _RUBYGEMS_VERSION
|
1899
|
+
value: latest
|
1900
|
+
- name: _BUNDLER_VERSION
|
1901
|
+
value: latest
|
1902
|
+
- *6
|
1903
|
+
commands:
|
1904
|
+
- "./support/bundler_wrapper exec rake test"
|
1905
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,49 @@
|
|
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
|
+
|
13
|
+
## 3.0.21.alpha.1
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- [f19d9dcc](https://github.com/appsignal/appsignal-ruby/commit/f19d9dcc1c00103f5dc92951481becf4d4ade39e) patch - The MongoDB query sanitization now shows all the attributes in the query at all levels.
|
18
|
+
Only the actual values are filtered with a `?` character. Less MongoDB queries are now marked
|
19
|
+
as N+1 queries when they weren't the exact same query. This increases the number of unique events
|
20
|
+
AppSignal tracks for MongoDB queries.
|
21
|
+
|
22
|
+
## 3.0.20
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- [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`.
|
27
|
+
|
28
|
+
### Deprecated
|
29
|
+
|
30
|
+
- [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.
|
31
|
+
- [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.
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- [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.
|
36
|
+
|
37
|
+
## 3.0.19
|
38
|
+
|
39
|
+
### Changed
|
40
|
+
|
41
|
+
- [2587eae3](https://github.com/appsignal/appsignal-ruby/commit/2587eae30f17e0f0b5e27cb61982301220cc77b1) patch - Store the extension install report as JSON, instead of YAML. Reduces internal complexity.
|
42
|
+
|
43
|
+
### Fixed
|
44
|
+
|
45
|
+
- [243c1ed4](https://github.com/appsignal/appsignal-ruby/commit/243c1ed444f3351ca158200a47836673f851cb31) patch - Improve compatibility with the sequel-rails gem by tracking the performed SQL query in instrumentation events.
|
46
|
+
|
3
47
|
## 3.0.18
|
4
48
|
|
5
49
|
### Added
|
data/appsignal.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
25
25
|
gem.extensions = %w[ext/extconf.rb]
|
26
26
|
|
27
27
|
gem.metadata = {
|
28
|
+
"rubygems_mfa_required" => "true",
|
28
29
|
"bug_tracker_uri" => "https://github.com/appsignal/appsignal-ruby/issues",
|
29
30
|
"changelog_uri" =>
|
30
31
|
"https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md",
|
data/build_matrix.yml
CHANGED
@@ -164,6 +164,7 @@ matrix:
|
|
164
164
|
- "no_dependencies"
|
165
165
|
- "rails-5.2"
|
166
166
|
- "rails-6.0"
|
167
|
+
- "rails-6.1"
|
167
168
|
- "rails-7.0"
|
168
169
|
|
169
170
|
ruby:
|
@@ -241,6 +242,13 @@ matrix:
|
|
241
242
|
- "2.3.8"
|
242
243
|
- "2.4.10"
|
243
244
|
- "3.1.0"
|
245
|
+
- gem: "rails-6.1"
|
246
|
+
exclude:
|
247
|
+
ruby:
|
248
|
+
- "2.1.10"
|
249
|
+
- "2.2.10"
|
250
|
+
- "2.3.8"
|
251
|
+
- "2.4.10"
|
244
252
|
- gem: "rails-7.0"
|
245
253
|
exclude:
|
246
254
|
ruby:
|
@@ -250,7 +258,6 @@ matrix:
|
|
250
258
|
- "2.4.10"
|
251
259
|
- "2.5.8"
|
252
260
|
- "2.6.9"
|
253
|
-
- "3.1.0"
|
254
261
|
- "jruby-9.2.19.0"
|
255
262
|
- gem: "resque-1"
|
256
263
|
bundler: "1.17.3"
|
data/ext/base.rb
CHANGED
@@ -2,6 +2,7 @@ require "digest"
|
|
2
2
|
require "fileutils"
|
3
3
|
require "open-uri"
|
4
4
|
require "zlib"
|
5
|
+
require "json"
|
5
6
|
require "yaml"
|
6
7
|
require "rubygems/package"
|
7
8
|
require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
|
@@ -30,7 +31,7 @@ def report
|
|
30
31
|
},
|
31
32
|
"language" => {
|
32
33
|
"name" => "ruby",
|
33
|
-
"version" => "#{rbconfig["
|
34
|
+
"version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
|
34
35
|
},
|
35
36
|
"download" => {
|
36
37
|
"checksum" => "unverified",
|
@@ -60,7 +61,7 @@ end
|
|
60
61
|
|
61
62
|
def write_report
|
62
63
|
File.open(File.join(EXT_PATH, "install.report"), "w") do |file|
|
63
|
-
file.write
|
64
|
+
file.write JSON.generate(report)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
data/gemfiles/rails-7.0.gemfile
CHANGED
@@ -32,20 +32,6 @@ module Appsignal
|
|
32
32
|
|
33
33
|
IO.binread(path, length, offset)
|
34
34
|
end
|
35
|
-
|
36
|
-
def self.parse_yaml(contents)
|
37
|
-
if YAML.respond_to? :safe_load
|
38
|
-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
39
|
-
# Use keyword params for Ruby 2.6 and up
|
40
|
-
YAML.safe_load(contents, :permitted_classes => [Time])
|
41
|
-
else
|
42
|
-
YAML.safe_load(contents, [Time])
|
43
|
-
end
|
44
|
-
else
|
45
|
-
# Support for Ruby versions without YAML.safe_load
|
46
|
-
YAML.load(contents) # rubocop:disable Security/YAMLLoad
|
47
|
-
end
|
48
|
-
end
|
49
35
|
end
|
50
36
|
end
|
51
37
|
end
|
@@ -352,8 +352,8 @@ module Appsignal
|
|
352
352
|
def fetch_installation_report
|
353
353
|
path = File.expand_path("../../../../ext/install.report", __FILE__)
|
354
354
|
raw_report = File.read(path)
|
355
|
-
|
356
|
-
rescue StandardError,
|
355
|
+
JSON.parse(raw_report)
|
356
|
+
rescue StandardError, JSON::ParserError => e # rubocop:disable Lint/ShadowedException
|
357
357
|
{
|
358
358
|
"parsing_error" => {
|
359
359
|
"error" => "#{e.class}: #{e}",
|
@@ -411,7 +411,7 @@ module Appsignal
|
|
411
411
|
def print_installation_build_report(report)
|
412
412
|
report = report.fetch("build", {})
|
413
413
|
puts " Build details"
|
414
|
-
puts_format "Install time", report["time"]
|
414
|
+
puts_format "Install time", report["time"], :level => 2
|
415
415
|
puts_format "Architecture", report["architecture"], :level => 2
|
416
416
|
puts_format "Target", report["target"], :level => 2
|
417
417
|
puts_format "Musl override", report["musl_override"], :level => 2
|
@@ -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
|
|
@@ -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)
|
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
|
@@ -169,7 +170,7 @@ module Appsignal
|
|
169
170
|
# @return [Hash]
|
170
171
|
|
171
172
|
attr_reader :root_path, :env, :config_hash, :system_config,
|
172
|
-
:initial_config, :file_config, :env_config
|
173
|
+
:initial_config, :file_config, :env_config, :override_config
|
173
174
|
attr_accessor :logger
|
174
175
|
|
175
176
|
# Initialize a new configuration object for AppSignal.
|
@@ -230,6 +231,11 @@ module Appsignal
|
|
230
231
|
# Load config from environment variables
|
231
232
|
@env_config = load_from_environment
|
232
233
|
merge(env_config)
|
234
|
+
# Load config overrides
|
235
|
+
@override_config = determine_overrides
|
236
|
+
merge(override_config)
|
237
|
+
# Handle deprecated config options
|
238
|
+
maintain_backwards_compatibility
|
233
239
|
# Validate that we have a correct config
|
234
240
|
validate
|
235
241
|
# Track origin of env
|
@@ -374,12 +380,9 @@ module Appsignal
|
|
374
380
|
configurations = YAML.load(ERB.new(IO.read(config_file)).result, **read_options)
|
375
381
|
config_for_this_env = configurations[env]
|
376
382
|
if config_for_this_env
|
377
|
-
config_for_this_env
|
378
|
-
|
379
|
-
|
380
|
-
end
|
381
|
-
|
382
|
-
maintain_backwards_compatibility(config_for_this_env)
|
383
|
+
config_for_this_env.each_with_object({}) do |(key, value), hash|
|
384
|
+
hash[key.to_sym] = value # convert keys to symbols
|
385
|
+
end
|
383
386
|
else
|
384
387
|
logger.error "Not loading from config file: config for '#{env}' not found"
|
385
388
|
nil
|
@@ -394,20 +397,25 @@ module Appsignal
|
|
394
397
|
nil
|
395
398
|
end
|
396
399
|
|
397
|
-
# Maintain backwards compatibility with config
|
398
|
-
# versions of the gem
|
400
|
+
# Maintain backwards compatibility with deprecated config options.
|
399
401
|
#
|
400
|
-
#
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
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.
|
407
|
+
#
|
408
|
+
# Make sure to remove the contents of this method in the next major
|
409
|
+
# version, but the method itself with an empty body can stick around as a
|
410
|
+
# structure for future deprecations.
|
411
|
+
def maintain_backwards_compatibility
|
412
|
+
return unless config_hash.key?(:working_dir_path)
|
413
|
+
|
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
|
411
419
|
end
|
412
420
|
|
413
421
|
def load_from_environment
|
@@ -437,6 +445,31 @@ module Appsignal
|
|
437
445
|
config
|
438
446
|
end
|
439
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
|
+
|
440
473
|
def merge(new_config)
|
441
474
|
new_config.each do |key, value|
|
442
475
|
unless config_hash[key].nil?
|
@@ -21,28 +21,28 @@ module Appsignal
|
|
21
21
|
},
|
22
22
|
"insert" => {
|
23
23
|
"insert" => :allow,
|
24
|
-
"documents" => :
|
24
|
+
"documents" => :sanitize_document,
|
25
25
|
"ordered" => :allow
|
26
26
|
},
|
27
27
|
"update" => {
|
28
28
|
"update" => :allow,
|
29
|
-
"updates" => :
|
29
|
+
"updates" => :sanitize_document,
|
30
30
|
"ordered" => :allow
|
31
31
|
},
|
32
32
|
"findandmodify" => {
|
33
33
|
"findandmodify" => :allow,
|
34
34
|
"query" => :sanitize_document,
|
35
|
-
"update" => :
|
35
|
+
"update" => :sanitize_document,
|
36
36
|
"new" => :allow
|
37
37
|
},
|
38
38
|
"delete" => {
|
39
39
|
"delete" => :allow,
|
40
|
-
"deletes" => :
|
40
|
+
"deletes" => :sanitize_document,
|
41
41
|
"ordered" => :allow
|
42
42
|
},
|
43
43
|
"bulk" => {
|
44
44
|
"q" => :sanitize_document,
|
45
|
-
"u" => :
|
45
|
+
"u" => :sanitize_document,
|
46
46
|
"limit" => :allow,
|
47
47
|
"multi" => :allow,
|
48
48
|
"upsert" => :allow
|
@@ -68,20 +68,9 @@ module Appsignal
|
|
68
68
|
# Applies strategy on hash values based on keys
|
69
69
|
def self.apply_strategy(strategy, val)
|
70
70
|
case strategy
|
71
|
-
when :allow
|
72
|
-
when :deny then "?"
|
73
|
-
when :deny_array then "[?]"
|
71
|
+
when :allow then val
|
74
72
|
when :sanitize_document
|
75
|
-
Appsignal::Utils::QueryParamsSanitizer.sanitize(val,
|
76
|
-
when :sanitize_bulk
|
77
|
-
if val.length > 1
|
78
|
-
[
|
79
|
-
format(:bulk, val.first),
|
80
|
-
"[...]"
|
81
|
-
]
|
82
|
-
else
|
83
|
-
val.map { |v| format(:bulk, v) }
|
84
|
-
end
|
73
|
+
Appsignal::Utils::QueryParamsSanitizer.sanitize(val, false, :mongodb)
|
85
74
|
else "?"
|
86
75
|
end
|
87
76
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
class EventFormatter
|
5
|
+
# @api private
|
6
|
+
module Sequel
|
7
|
+
# Compatability with the sequel-rails gem.
|
8
|
+
# The sequel-rails gem adds its own ActiveSupport::Notifications events
|
9
|
+
# that conflict with our own sequel instrumentor. Without this event
|
10
|
+
# formatter the sequel-rails events are recorded without the SQL query
|
11
|
+
# that's being executed.
|
12
|
+
class SqlFormatter
|
13
|
+
def format(payload)
|
14
|
+
[payload[:name].to_s, payload[:sql], SQL_BODY_FORMAT]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Appsignal::EventFormatter.register(
|
22
|
+
"sql.sequel",
|
23
|
+
Appsignal::EventFormatter::Sequel::SqlFormatter
|
24
|
+
)
|
data/lib/appsignal/system.rb
CHANGED
@@ -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
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
|