appsignal 3.0.16-java → 3.0.20-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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -3
  3. data/.semaphore/semaphore.yml +512 -103
  4. data/CHANGELOG.md +37 -0
  5. data/appsignal.gemspec +0 -2
  6. data/build_matrix.yml +44 -16
  7. data/ext/agent.yml +25 -25
  8. data/ext/base.rb +3 -2
  9. data/gemfiles/rails-6.1.gemfile +7 -0
  10. data/gemfiles/rails-7.0.gemfile +7 -0
  11. data/lib/appsignal/cli/diagnose/utils.rb +0 -14
  12. data/lib/appsignal/cli/diagnose.rb +4 -4
  13. data/lib/appsignal/config.rb +65 -20
  14. data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +24 -0
  15. data/lib/appsignal/integrations/sidekiq.rb +5 -1
  16. data/lib/appsignal/system.rb +0 -4
  17. data/lib/appsignal/transaction.rb +2 -2
  18. data/lib/appsignal/version.rb +1 -1
  19. data/lib/appsignal.rb +4 -10
  20. data/spec/lib/appsignal/cli/diagnose_spec.rb +11 -11
  21. data/spec/lib/appsignal/config_spec.rb +208 -10
  22. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
  23. data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +30 -0
  24. data/spec/lib/appsignal/event_formatter_spec.rb +2 -2
  25. data/spec/lib/appsignal/hooks/activejob_spec.rb +17 -6
  26. data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
  27. data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -2
  28. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +23 -5
  29. data/spec/lib/appsignal/transaction_spec.rb +2 -2
  30. data/spec/lib/appsignal/utils/data_spec.rb +0 -2
  31. data/spec/lib/appsignal/utils/json_spec.rb +0 -2
  32. data/spec/lib/appsignal_spec.rb +2 -3
  33. data/spec/support/helpers/activejob_helpers.rb +27 -0
  34. data/spec/support/helpers/dependency_helper.rb +13 -1
  35. metadata +10 -3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
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
+
18
+ ## 3.0.19
19
+
20
+ ### Changed
21
+
22
+ - [2587eae3](https://github.com/appsignal/appsignal-ruby/commit/2587eae30f17e0f0b5e27cb61982301220cc77b1) patch - Store the extension install report as JSON, instead of YAML. Reduces internal complexity.
23
+
24
+ ### Fixed
25
+
26
+ - [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.
27
+
28
+ ## 3.0.18
29
+
30
+ ### Added
31
+
32
+ - [d7bfcdf1](https://github.com/appsignal/appsignal-ruby/commit/d7bfcdf11a66df1ec5f54ac9342e5566062013b5) patch - Add Ruby 3.1.0 support. There was an issue with `YAML.load` arguments when parsing the `appsignal.yml` config file.
33
+
34
+ ## 3.0.17
35
+
36
+ ### Fixed
37
+
38
+ - [f9d57752](https://github.com/appsignal/appsignal-ruby/commit/f9d5775217400c59a70d98e9aa96e3dcd06cb1f9) patch - Use the `log_level` option for the Ruby gem logger. Previously it only configured the extension and agent loggers. Also fixes the `debug` and `transaction_debug_mode` option if no `log_level` is configured by the app.
39
+
3
40
  ## 3.0.16
4
41
 
5
42
  ### Added
data/appsignal.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require File.expand_path("../lib/appsignal/version", __FILE__)
4
2
 
5
3
  Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
data/build_matrix.yml CHANGED
@@ -52,7 +52,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
52
52
  - name: Validate CI setup
53
53
  env_vars:
54
54
  - name: RUBY_VERSION
55
- value: 2.6.6
55
+ value: 2.6.9
56
56
  - name: GEMSET
57
57
  value: no_dependencies
58
58
  - name: BUNDLE_GEMFILE
@@ -76,7 +76,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
76
76
  - name: RuboCop
77
77
  env_vars:
78
78
  - name: RUBY_VERSION
79
- value: 2.6.6
79
+ value: 2.6.9
80
80
  - name: GEMSET
81
81
  value: no_dependencies
82
82
  - name: BUNDLE_GEMFILE
@@ -164,6 +164,8 @@ matrix:
164
164
  - "no_dependencies"
165
165
  - "rails-5.2"
166
166
  - "rails-6.0"
167
+ - "rails-6.1"
168
+ - "rails-7.0"
167
169
 
168
170
  ruby:
169
171
  - ruby: "2.0.0-p648"
@@ -184,9 +186,10 @@ matrix:
184
186
  gems: "none"
185
187
  - ruby: "2.5.8"
186
188
  gems: "minimal"
187
- - ruby: "2.6.6"
188
- - ruby: "2.7.3"
189
- - ruby: "3.0.1"
189
+ - ruby: "2.6.9"
190
+ - ruby: "2.7.5"
191
+ - ruby: "3.0.3"
192
+ - ruby: "3.1.0"
190
193
  - ruby: "jruby-9.2.19.0"
191
194
  gems: "minimal"
192
195
  env_vars:
@@ -204,28 +207,33 @@ matrix:
204
207
  bundler: "1.17.3"
205
208
  exclude:
206
209
  ruby:
207
- - "2.6.6"
208
- - "2.7.3"
209
- - "3.0.1"
210
+ - "2.6.9"
211
+ - "2.7.5"
212
+ - "3.0.3"
213
+ - "3.1.0"
210
214
  - gem: "rails-4.2"
211
215
  bundler: "1.17.3"
212
216
  exclude:
213
217
  ruby:
214
- - "2.6.6"
215
- - "2.7.3"
216
- - "3.0.1"
218
+ - "2.6.9"
219
+ - "2.7.5"
220
+ - "3.0.3"
221
+ - "3.1.0"
217
222
  - gem: "rails-5.0"
218
223
  exclude:
219
224
  ruby:
220
- - "3.0.1"
225
+ - "3.0.3"
226
+ - "3.1.0"
221
227
  - gem: "rails-5.1"
222
228
  exclude:
223
229
  ruby:
224
- - "3.0.1"
230
+ - "3.0.3"
231
+ - "3.1.0"
225
232
  - gem: "rails-5.2"
226
233
  exclude:
227
234
  ruby:
228
- - "3.0.1"
235
+ - "3.0.3"
236
+ - "3.1.0"
229
237
  - gem: "rails-6.0"
230
238
  exclude:
231
239
  ruby:
@@ -233,16 +241,36 @@ matrix:
233
241
  - "2.2.10"
234
242
  - "2.3.8"
235
243
  - "2.4.10"
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"
252
+ - gem: "rails-7.0"
253
+ exclude:
254
+ ruby:
255
+ - "2.1.10"
256
+ - "2.2.10"
257
+ - "2.3.8"
258
+ - "2.4.10"
259
+ - "2.5.8"
260
+ - "2.6.9"
261
+ - "jruby-9.2.19.0"
236
262
  - gem: "resque-1"
237
263
  bundler: "1.17.3"
238
264
  exclude:
239
265
  ruby:
240
- - "3.0.1"
266
+ - "3.0.3"
267
+ - "3.1.0"
241
268
  - gem: "resque-2"
242
269
  - gem: "sequel"
243
270
  - gem: "sequel-435"
244
271
  exclude:
245
272
  ruby:
246
- - "3.0.1"
273
+ - "3.0.3"
274
+ - "3.1.0"
247
275
  - gem: "sinatra"
248
276
  - gem: "webmachine"
data/ext/agent.yml CHANGED
@@ -3,92 +3,92 @@
3
3
  # appsignal-agent repository.
4
4
  # Modifications to this file will be overwritten with the next agent release.
5
5
  ---
6
- version: 0db01c2
6
+ version: 15ee07b
7
7
  mirrors:
8
8
  - https://appsignal-agent-releases.global.ssl.fastly.net
9
9
  - https://d135dj0rjqvssy.cloudfront.net
10
10
  triples:
11
11
  x86_64-darwin:
12
12
  static:
13
- checksum: 8a7cf35f8c9aa98e7778b720f33b38bfbdedcdedb0047035259ab187517be971
13
+ checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
14
14
  filename: appsignal-x86_64-darwin-all-static.tar.gz
15
15
  dynamic:
16
- checksum: 4330f83a44db6f092b3f437d942204e9bf7f7022ae2cc24ade4e7b4137905d03
16
+ checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
17
17
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
18
18
  universal-darwin:
19
19
  static:
20
- checksum: 8a7cf35f8c9aa98e7778b720f33b38bfbdedcdedb0047035259ab187517be971
20
+ checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
21
21
  filename: appsignal-x86_64-darwin-all-static.tar.gz
22
22
  dynamic:
23
- checksum: 4330f83a44db6f092b3f437d942204e9bf7f7022ae2cc24ade4e7b4137905d03
23
+ checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
24
24
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
25
25
  aarch64-darwin:
26
26
  static:
27
- checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
27
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
28
28
  filename: appsignal-aarch64-darwin-all-static.tar.gz
29
29
  dynamic:
30
- checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
30
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
31
31
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
32
32
  arm64-darwin:
33
33
  static:
34
- checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
34
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
35
35
  filename: appsignal-aarch64-darwin-all-static.tar.gz
36
36
  dynamic:
37
- checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
37
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
38
38
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
39
39
  arm-darwin:
40
40
  static:
41
- checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
41
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
42
42
  filename: appsignal-aarch64-darwin-all-static.tar.gz
43
43
  dynamic:
44
- checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
44
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
45
45
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
46
46
  aarch64-linux:
47
47
  static:
48
- checksum: edf43f1a6b340c0afa07c7b71963def9bb68bd8d62d17cb64a7f7a36f84a4517
48
+ checksum: 12c5659d5a5d67ee641bdb1c38ef842b7687811fdec1f9edf8e196a2ed596405
49
49
  filename: appsignal-aarch64-linux-all-static.tar.gz
50
50
  dynamic:
51
- checksum: 8390561e1a41e4b8bba8e4f92b9b49f957650eca21d281589143b9c3764f504e
51
+ checksum: 8301ab5f64af1c185860314682fbfd89027ea5e4850d8beb222613ca5455358a
52
52
  filename: appsignal-aarch64-linux-all-dynamic.tar.gz
53
53
  i686-linux:
54
54
  static:
55
- checksum: 4179334f88dc32e00ce62aa196b3e47b4258b12ec48dd3cf722d4f6eeb4dc2c0
55
+ checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
56
56
  filename: appsignal-i686-linux-all-static.tar.gz
57
57
  dynamic:
58
- checksum: 7c6bcc88e5d218c1986d1a9f1c9ad728c72e68a440656b2e9228d432ba300f86
58
+ checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
59
59
  filename: appsignal-i686-linux-all-dynamic.tar.gz
60
60
  x86-linux:
61
61
  static:
62
- checksum: 4179334f88dc32e00ce62aa196b3e47b4258b12ec48dd3cf722d4f6eeb4dc2c0
62
+ checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
63
63
  filename: appsignal-i686-linux-all-static.tar.gz
64
64
  dynamic:
65
- checksum: 7c6bcc88e5d218c1986d1a9f1c9ad728c72e68a440656b2e9228d432ba300f86
65
+ checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
66
66
  filename: appsignal-i686-linux-all-dynamic.tar.gz
67
67
  x86_64-linux:
68
68
  static:
69
- checksum: d602823277cac752bdea742d928112cef457bc61ee05b960b316fc052f0cc714
69
+ checksum: 563eb5c9daeec67a760ac236b2848aee4ec0e39dca1368150a6d99844d4d665f
70
70
  filename: appsignal-x86_64-linux-all-static.tar.gz
71
71
  dynamic:
72
- checksum: 2e9e955672dec266b408770638c0503a072410e03526b1eef2170326b083a42f
72
+ checksum: 74940f06f4c92582262014a9967f298bccee3ca94e3a490ddc40787573c91ed0
73
73
  filename: appsignal-x86_64-linux-all-dynamic.tar.gz
74
74
  x86_64-linux-musl:
75
75
  static:
76
- checksum: dfbdff116339b99613fff6ed4092b772e58f0d3e667b7de347b4215fb7ea9d62
76
+ checksum: 2ecad2b2bdd362d9d871322eac79370d12314e3d32a53c83be17d054e91f188d
77
77
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
78
78
  dynamic:
79
- checksum: 560835ec657b471d50c765a932385cd0e3b6bdca54d2a5e28b4203e43869cf3d
79
+ checksum: 5e4c4096ca7b0c7a97fe03f684c0678396c97f24c2065dc961081d022a8ad2a7
80
80
  filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
81
81
  x86_64-freebsd:
82
82
  static:
83
- checksum: e31a7d89798193857247bd3590a554782fcff64b65d3da86d9c451d3147e961a
83
+ checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
84
84
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
85
85
  dynamic:
86
- checksum: e7f007cc385a23977ca93b58439dc720d703b7cc5929ef52a7acd59f74703b92
86
+ checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
87
87
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
88
88
  amd64-freebsd:
89
89
  static:
90
- checksum: e31a7d89798193857247bd3590a554782fcff64b65d3da86d9c451d3147e961a
90
+ checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
91
91
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
92
92
  dynamic:
93
- checksum: e7f007cc385a23977ca93b58439dc720d703b7cc5929ef52a7acd59f74703b92
93
+ checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
94
94
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
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["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
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 YAML.dump(report)
64
+ file.write JSON.generate(report)
64
65
  end
65
66
  end
66
67
 
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 6.1.0"
4
+ gem "net-smtp", require: false
5
+ gem "sidekiq"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', "~> 7.0.1"
4
+ gem "sidekiq"
5
+ gem "rake", "> 12.2"
6
+
7
+ gemspec :path => '../'
@@ -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
- Utils.parse_yaml(raw_report)
356
- rescue StandardError, Psych::SyntaxError => e # rubocop:disable Lint/ShadowedException
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"].to_s, :level => 2
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["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
 
@@ -30,7 +30,6 @@ module Appsignal
30
30
  :instrument_redis => true,
31
31
  :instrument_sequel => true,
32
32
  :log => "file",
33
- :log_level => "info",
34
33
  :request_headers => %w[
35
34
  HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
36
35
  HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_CONNECTION
@@ -40,10 +39,23 @@ module Appsignal
40
39
  ],
41
40
  :send_environment_metadata => true,
42
41
  :send_params => true,
43
- :skip_session_data => false,
44
42
  :transaction_debug_mode => false
45
43
  }.freeze
46
44
 
45
+ # @api private
46
+ DEFAULT_LOG_LEVEL = Logger::INFO
47
+ # Map from the `log_level` config option to Ruby's Logger level value.
48
+ #
49
+ # The trace level doesn't exist in the Ruby logger so it's mapped to debug.
50
+ # @api private
51
+ LOG_LEVEL_MAP = {
52
+ "error" => Logger::ERROR,
53
+ "warn" => Logger::WARN,
54
+ "info" => Logger::INFO,
55
+ "debug" => Logger::DEBUG,
56
+ "trace" => Logger::DEBUG
57
+ }.freeze
58
+
47
59
  ENV_TO_KEY_MAPPING = {
48
60
  "APPSIGNAL_ACTIVE" => :active,
49
61
  "APPSIGNAL_APP_NAME" => :name,
@@ -75,6 +87,7 @@ module Appsignal
75
87
  "APPSIGNAL_RUNNING_IN_CONTAINER" => :running_in_container,
76
88
  "APPSIGNAL_SEND_ENVIRONMENT_METADATA" => :send_environment_metadata,
77
89
  "APPSIGNAL_SEND_PARAMS" => :send_params,
90
+ "APPSIGNAL_SEND_SESSION_DATA" => :send_session_data,
78
91
  "APPSIGNAL_SKIP_SESSION_DATA" => :skip_session_data,
79
92
  "APPSIGNAL_TRANSACTION_DEBUG_MODE" => :transaction_debug_mode,
80
93
  "APPSIGNAL_WORKING_DIRECTORY_PATH" => :working_directory_path,
@@ -112,6 +125,7 @@ module Appsignal
112
125
  APPSIGNAL_RUNNING_IN_CONTAINER
113
126
  APPSIGNAL_SEND_ENVIRONMENT_METADATA
114
127
  APPSIGNAL_SEND_PARAMS
128
+ APPSIGNAL_SEND_SESSION_DATA
115
129
  APPSIGNAL_SKIP_SESSION_DATA
116
130
  APPSIGNAL_TRANSACTION_DEBUG_MODE
117
131
  ].freeze
@@ -217,6 +231,8 @@ module Appsignal
217
231
  # Load config from environment variables
218
232
  @env_config = load_from_environment
219
233
  merge(env_config)
234
+ # Handle deprecated config options
235
+ maintain_backwards_compatibility
220
236
  # Validate that we have a correct config
221
237
  validate
222
238
  # Track origin of env
@@ -242,6 +258,18 @@ module Appsignal
242
258
  config_hash[key] = value
243
259
  end
244
260
 
261
+ def log_level
262
+ if config_hash[:debug] || config_hash[:transaction_debug_mode]
263
+ level = Logger::DEBUG
264
+ end
265
+ option = config_hash[:log_level]
266
+ if option
267
+ log_level_option = LOG_LEVEL_MAP[option]
268
+ level = log_level_option if log_level_option
269
+ end
270
+ level.nil? ? Appsignal::Config::DEFAULT_LOG_LEVEL : level
271
+ end
272
+
245
273
  def log_file_path
246
274
  path = config_hash[:log_path] || root_path && File.join(root_path, "log")
247
275
  if path && File.writable?(path)
@@ -345,15 +373,13 @@ module Appsignal
345
373
  def load_from_disk
346
374
  return if !config_file || !File.exist?(config_file)
347
375
 
348
- configurations = YAML.load(ERB.new(IO.read(config_file)).result)
376
+ read_options = RUBY_VERSION >= "3.1.0" ? { :aliases => true } : {}
377
+ configurations = YAML.load(ERB.new(IO.read(config_file)).result, **read_options)
349
378
  config_for_this_env = configurations[env]
350
379
  if config_for_this_env
351
- config_for_this_env =
352
- config_for_this_env.each_with_object({}) do |(key, value), hash|
353
- hash[key.to_sym] = value # convert keys to symbols
354
- end
355
-
356
- 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
357
383
  else
358
384
  logger.error "Not loading from config file: config for '#{env}' not found"
359
385
  nil
@@ -368,19 +394,38 @@ module Appsignal
368
394
  nil
369
395
  end
370
396
 
371
- # Maintain backwards compatibility with config files generated by earlier
372
- # versions of the gem
397
+ # Maintain backwards compatibility with deprecated config options.
398
+ #
399
+ # Add deprecated config options here with the behavior of setting its
400
+ # replacement, if the replacement option is not configured by the user.
373
401
  #
374
- # Used by {#load_from_disk}. No compatibility for env variables or initial config currently.
375
- def maintain_backwards_compatibility(configuration)
376
- configuration.tap do |config|
377
- if config.include?(:working_dir_path)
378
- deprecation_message \
379
- "'working_dir_path' is deprecated, please use " \
380
- "'working_directory_path' instead and specify the " \
381
- "full path to the working directory",
382
- logger
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
383
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
384
429
  end
385
430
  end
386
431
 
@@ -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
+ )
@@ -158,7 +158,11 @@ module Appsignal
158
158
 
159
159
  # Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L403-L412
160
160
  def safe_load(content, default)
161
- yield(*YAML.load(content))
161
+ if RUBY_VERSION >= "3.1.0"
162
+ yield(*YAML.unsafe_load(content))
163
+ else
164
+ yield(*YAML.load(content))
165
+ end
162
166
  rescue => error
163
167
  # Sidekiq issue #1761: in dev mode, it's possible to have jobs enqueued
164
168
  # which haven't been loaded into memory yet so the YAML can't be
@@ -106,9 +106,5 @@ module Appsignal
106
106
  def self.jruby?
107
107
  RUBY_PLATFORM == "java"
108
108
  end
109
-
110
- def self.ruby_2_7_or_newer?
111
- RUBY_VERSION > "2.7"
112
- end
113
109
  end
114
110
  end
@@ -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.16".freeze
4
+ VERSION = "3.0.20".freeze
5
5
  end
data/lib/appsignal.rb CHANGED
@@ -116,12 +116,7 @@ module Appsignal
116
116
  )
117
117
 
118
118
  if config.valid?
119
- logger.level =
120
- if config[:debug]
121
- Logger::DEBUG
122
- else
123
- Logger::INFO
124
- end
119
+ logger.level = config.log_level
125
120
  if config.active?
126
121
  logger.info "Starting AppSignal #{Appsignal::VERSION} "\
127
122
  "(#{$PROGRAM_NAME}, Ruby #{RUBY_VERSION}, #{RUBY_PLATFORM})"
@@ -230,12 +225,11 @@ module Appsignal
230
225
  end
231
226
 
232
227
  logger.level =
233
- if config && config[:debug]
234
- Logger::DEBUG
228
+ if config
229
+ config.log_level
235
230
  else
236
- Logger::INFO
231
+ Appsignal::Config::DEFAULT_LOG_LEVEL
237
232
  end
238
-
239
233
  logger << @in_memory_log.string if @in_memory_log
240
234
  end
241
235