appsignal 2.10.4 → 2.10.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.10.8
4
+ - Fix failed checksum error log. PR #609
5
+ - Fix DelayedJob action name detection for objects that listen to the `[]`
6
+ method and return a non-String value. #611
7
+ - CI test build improvements. PR #607, #608, #614
8
+
9
+ ## 2.10.7
10
+ - Revert fix for compatibility with the `http_logger` gem. PR #604.
11
+ For more information, see issue #603 about our reasoning and discussion.
12
+
13
+ ## 2.10.6
14
+ - Check if queued payloads are for correct app and not expired
15
+
16
+ ## 2.10.5
17
+ - Improve Ruby 1.9 compatibility. PR #591
18
+ - Add grape.skip_appsignal_error request env. PR #588
19
+ More information: https://docs.appsignal.com/ruby/integrations/grape.html
20
+ - Fix compatibility with the `http_logger` gem. Fix `SystemStackError`. PR #597
21
+
3
22
  ## 2.10.4
4
23
  - Fix `Appsignal::Transaction#set_http_or_background_action` helper (used by
5
24
  `Appsignal.monitor_transaction`), to allow overwriting the action name of a
data/Rakefile CHANGED
@@ -59,6 +59,7 @@ namespace :build_matrix do
59
59
 
60
60
  env = [
61
61
  env_map("RUBY_VERSION", ruby_version),
62
+ env_map("GEMSET", gem["gem"]),
62
63
  env_map("BUNDLE_GEMFILE", "gemfiles/#{gem["gem"]}.gemfile")
63
64
  ]
64
65
  rubygems = gem["rubygems"] || ruby["rubygems"] || defaults["rubygems"]
@@ -364,7 +365,12 @@ end
364
365
  begin
365
366
  require "rspec/core/rake_task"
366
367
  desc "Run the AppSignal gem test suite."
367
- RSpec::Core::RakeTask.new :test
368
+ RSpec::Core::RakeTask.new :test do |t|
369
+ is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
370
+ unless is_jruby
371
+ t.rspec_opts = "--exclude-pattern=spec/lib/appsignal/extension/jruby_spec.rb"
372
+ end
373
+ end
368
374
  rescue LoadError # rubocop:disable Lint/HandleExceptions
369
375
  # When running rake install, there is no RSpec yet.
370
376
  end
@@ -39,9 +39,12 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
39
39
 
40
40
  gem.add_development_dependency "rake", "~> 11"
41
41
  gem.add_development_dependency "rspec", "~> 3.8"
42
- gem.add_development_dependency "pry"
43
42
  gem.add_development_dependency "timecop"
44
43
  gem.add_development_dependency "webmock"
45
- gem.add_development_dependency "rubocop", "0.50.0"
46
44
  gem.add_development_dependency "yard", ">= 0.9.20"
45
+ is_modern_ruby = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.0.0")
46
+ if is_modern_ruby
47
+ gem.add_development_dependency "pry"
48
+ gem.add_development_dependency "rubocop", "0.50.0"
49
+ end
47
50
  end
@@ -34,15 +34,20 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
34
34
  - checkout
35
35
  - sem-version ruby $RUBY_VERSION
36
36
  - ./support/check_versions
37
- - cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE),$_BUNDLER_CACHE-bundler-$RUBY_VERSION
37
+ - cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE),$_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET,$_BUNDLER_CACHE-bundler-$RUBY_VERSION
38
38
  - cache restore $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE),$_GEMS_CACHE-gems-$RUBY_VERSION
39
39
  - ./support/install_deps
40
+ - bundle config set clean 'true'
40
41
  - ./support/bundler_wrapper install --jobs=3 --retry=3
41
42
  epilogue:
42
43
  on_pass:
43
44
  commands:
44
- - cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) .bundle
45
+ - cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE) .bundle
45
46
  - cache store $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) $HOME/.gem
47
+ on_fail:
48
+ commands:
49
+ - "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'"
50
+ - "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
46
51
 
47
52
  blocks:
48
53
  - name: Validation
@@ -53,6 +58,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
53
58
  env_vars:
54
59
  - name: RUBY_VERSION
55
60
  value: 2.6.5
61
+ - name: GEMSET
62
+ value: no_dependencies
56
63
  - name: BUNDLE_GEMFILE
57
64
  value: gemfiles/no_dependencies.gemfile
58
65
  commands:
@@ -65,6 +72,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
65
72
  env_vars:
66
73
  - name: RUBY_VERSION
67
74
  value: 2.6.5
75
+ - name: GEMSET
76
+ value: no_dependencies
68
77
  - name: BUNDLE_GEMFILE
69
78
  value: gemfiles/no_dependencies.gemfile
70
79
  commands:
@@ -81,8 +90,13 @@ matrix:
81
90
  minimal:
82
91
  - "no_dependencies"
83
92
  - "rails-5.2"
93
+ - "rails-6.0"
84
94
 
85
95
  ruby:
96
+ - ruby: "1.9.3-p551"
97
+ rubygems: "2.7.8"
98
+ bundler: "1.17.3"
99
+ gems: "none"
86
100
  - ruby: "2.0.0-p648"
87
101
  rubygems: "2.7.8"
88
102
  bundler: "1.17.3"
@@ -148,6 +162,7 @@ matrix:
148
162
  - "2.2.10"
149
163
  - "2.3.8"
150
164
  - "2.4.9"
165
+ - "jruby-9.1.17.0"
151
166
  - gem: "resque"
152
167
  bundler: "1.17.3"
153
168
  - gem: "sequel"
@@ -1,70 +1,70 @@
1
1
  ---
2
- version: c348132
2
+ version: 96b684b
3
3
  mirrors:
4
4
  - https://appsignal-agent-releases.global.ssl.fastly.net
5
5
  - https://d135dj0rjqvssy.cloudfront.net
6
6
  triples:
7
7
  x86_64-darwin:
8
8
  static:
9
- checksum: cb287c8e2072fe5b8cf14449bd6892989c392d0c651ce339895ae0302cb69785
9
+ checksum: 6278d03abdcacde207e210374601b0a98eabace8cbc9fb74dffea3c18fc8a252
10
10
  filename: appsignal-x86_64-darwin-all-static.tar.gz
11
11
  dynamic:
12
- checksum: af1ed2e9d29859ffbfc8e6903e4c51764dee94d7b4877ca8d30270b6f133a10f
12
+ checksum: b0ad069bbff68acde7ef19de47938fa786771bae4821c757718f1894b9654a93
13
13
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
14
14
  universal-darwin:
15
15
  static:
16
- checksum: cb287c8e2072fe5b8cf14449bd6892989c392d0c651ce339895ae0302cb69785
16
+ checksum: 6278d03abdcacde207e210374601b0a98eabace8cbc9fb74dffea3c18fc8a252
17
17
  filename: appsignal-x86_64-darwin-all-static.tar.gz
18
18
  dynamic:
19
- checksum: af1ed2e9d29859ffbfc8e6903e4c51764dee94d7b4877ca8d30270b6f133a10f
19
+ checksum: b0ad069bbff68acde7ef19de47938fa786771bae4821c757718f1894b9654a93
20
20
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
21
21
  i686-linux:
22
22
  static:
23
- checksum: 2c3bcd102592bf38fbdb27e7c70502dccbe54a0dc2739a9d54aaa694fcfb41fb
23
+ checksum: f3e79a575241a50d7968fe4743c4f4e5aebb840e0b8664d055383caf696d5d38
24
24
  filename: appsignal-i686-linux-all-static.tar.gz
25
25
  dynamic:
26
- checksum: 1c037b8370b755d706340e25d3e4b2f4acb279dd03873cc53bcf0a6ec0832653
26
+ checksum: 0df11c9fe85c9c94336dfb4df788032c78eda1ea648f98e8c1e4e213258816e1
27
27
  filename: appsignal-i686-linux-all-dynamic.tar.gz
28
28
  x86-linux:
29
29
  static:
30
- checksum: 2c3bcd102592bf38fbdb27e7c70502dccbe54a0dc2739a9d54aaa694fcfb41fb
30
+ checksum: f3e79a575241a50d7968fe4743c4f4e5aebb840e0b8664d055383caf696d5d38
31
31
  filename: appsignal-i686-linux-all-static.tar.gz
32
32
  dynamic:
33
- checksum: 1c037b8370b755d706340e25d3e4b2f4acb279dd03873cc53bcf0a6ec0832653
33
+ checksum: 0df11c9fe85c9c94336dfb4df788032c78eda1ea648f98e8c1e4e213258816e1
34
34
  filename: appsignal-i686-linux-all-dynamic.tar.gz
35
35
  i686-linux-musl:
36
36
  static:
37
- checksum: 0add9eed4452feda7fc5e1bbd0acdff32c353e4ea0b5d527959df57deb1bdcb2
37
+ checksum: 07ab5749b532f1cc6cb45a3334fd950f6d15edacbe6d1bfe25af75b24df73cd1
38
38
  filename: appsignal-i686-linux-musl-all-static.tar.gz
39
39
  x86-linux-musl:
40
40
  static:
41
- checksum: 0add9eed4452feda7fc5e1bbd0acdff32c353e4ea0b5d527959df57deb1bdcb2
41
+ checksum: 07ab5749b532f1cc6cb45a3334fd950f6d15edacbe6d1bfe25af75b24df73cd1
42
42
  filename: appsignal-i686-linux-musl-all-static.tar.gz
43
43
  x86_64-linux:
44
44
  static:
45
- checksum: d11221c127c00128da16b419c503281407e429c0ea6f5bfe1691640b8e995e4e
45
+ checksum: d0e8f48973bca7d783d654404617bb5ab4f47756deb6805c4876bfcda83981cd
46
46
  filename: appsignal-x86_64-linux-all-static.tar.gz
47
47
  dynamic:
48
- checksum: 6869ab461fde55487d55805c396d55f36cb881998556f44236035b949939b0af
48
+ checksum: aff7569b04416cd40440d228c5b9881b860e1ecf597bc996ac02c2735f49d993
49
49
  filename: appsignal-x86_64-linux-all-dynamic.tar.gz
50
50
  x86_64-linux-musl:
51
51
  static:
52
- checksum: 7ce44dc23c578933ca37a79d244bc367fdc2438408c2a61558adb92bcfebb1fa
52
+ checksum: 2e3db648d0883f2a7e72f1207ec0976b97d144cafe0a3e755df2d91ca93d113f
53
53
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
54
54
  dynamic:
55
- checksum: 78d98f468e3a12cc09baff9e68bc4d9cd3b79f4a3bbe744036bff685415546a4
55
+ checksum: 5da62f954d761af47da16f34ab675b46fedd7b91b485574bf895b43896f61ce0
56
56
  filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
57
57
  x86_64-freebsd:
58
58
  static:
59
- checksum: df5f8b61e6ecca40f349cf5c83d5f37f031850d367793dee90dc56f13974431d
59
+ checksum: 8dc226834ef39bac43dbc4a5c6a812c50c34669b0607036dd9494ac587e72d6a
60
60
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
61
61
  dynamic:
62
- checksum: 30d0303e97386014640c5b8194b777a5741e08ab5497ba58a7d8229bd4890fc5
62
+ checksum: 0edfbaa450c89dba5750b306043efc00b82851dce2b75fa6ee62de07d30b4a3b
63
63
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
64
64
  amd64-freebsd:
65
65
  static:
66
- checksum: df5f8b61e6ecca40f349cf5c83d5f37f031850d367793dee90dc56f13974431d
66
+ checksum: 8dc226834ef39bac43dbc4a5c6a812c50c34669b0607036dd9494ac587e72d6a
67
67
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
68
68
  dynamic:
69
- checksum: 30d0303e97386014640c5b8194b777a5741e08ab5497ba58a7d8229bd4890fc5
69
+ checksum: 0edfbaa450c89dba5750b306043efc00b82851dce2b75fa6ee62de07d30b4a3b
70
70
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -142,14 +142,16 @@ def download_archive(type)
142
142
  end
143
143
 
144
144
  def verify_archive(archive, type)
145
- if Digest::SHA256.hexdigest(archive.read) == ARCH_CONFIG[type]["checksum"]
145
+ expected_checksum = ARCH_CONFIG[type]["checksum"]
146
+ actual_checksum = Digest::SHA256.hexdigest(archive.read)
147
+ if actual_checksum == expected_checksum
146
148
  report["download"]["checksum"] = "verified"
147
149
  true
148
150
  else
149
151
  report["download"]["checksum"] = "invalid"
150
152
  abort_installation(
151
153
  "Checksum of downloaded archive could not be verified: " \
152
- "Expected '#{ARCH_CONFIG[type]["checksum"]}', got '#{checksum}'."
154
+ "Expected '#{expected_checksum}', got '#{actual_checksum}'."
153
155
  )
154
156
  end
155
157
  end
@@ -6,6 +6,7 @@ require "securerandom"
6
6
  require "appsignal/logger"
7
7
  require "appsignal/helpers/instrumentation"
8
8
  require "appsignal/helpers/metrics"
9
+ require "appsignal/utils/deprecation_message"
9
10
 
10
11
  # AppSignal for Ruby gem's main module.
11
12
  #
@@ -15,9 +16,9 @@ require "appsignal/helpers/metrics"
15
16
  # {Appsignal::Helpers::Metrics}) for ease of use.
16
17
  module Appsignal
17
18
  class << self
18
- extend Gem::Deprecate
19
19
  include Helpers::Instrumentation
20
20
  include Helpers::Metrics
21
+ include Utils::DeprecationMessage
21
22
 
22
23
  # Accessor for the AppSignal configuration.
23
24
  # Return the current AppSignal configuration.
@@ -280,16 +281,18 @@ module Appsignal
280
281
 
281
282
  # @deprecated No replacement
282
283
  def is_ignored_error?(error) # rubocop:disable Naming/PredicateName
284
+ deprecation_message "Appsignal.is_ignored_error? is deprecated " \
285
+ "with no replacement and will be removed in version 3.0."
283
286
  Appsignal.config[:ignore_errors].include?(error.class.name)
284
287
  end
285
288
  alias :is_ignored_exception? :is_ignored_error?
286
- deprecate :is_ignored_error?, :none, 2017, 3
287
289
 
288
290
  # @deprecated No replacement
289
291
  def is_ignored_action?(action) # rubocop:disable Naming/PredicateName
292
+ deprecation_message "Appsignal.is_ignored_action? is deprecated " \
293
+ "with no replacement and will be removed in version 3.0."
290
294
  Appsignal.config[:ignore_actions].include?(action)
291
295
  end
292
- deprecate :is_ignored_action?, :none, 2017, 3
293
296
 
294
297
  private
295
298
 
@@ -337,7 +337,7 @@ module Appsignal
337
337
  path = File.expand_path("../../../../ext/install.report", __FILE__)
338
338
  raw_report = File.read(path)
339
339
  Utils.parse_yaml(raw_report)
340
- rescue => e
340
+ rescue StandardError, Psych::SyntaxError => e # rubocop:disable Lint/ShadowedException
341
341
  {
342
342
  "parsing_error" => {
343
343
  "error" => "#{e.class}: #{e}",
@@ -94,7 +94,7 @@ module Appsignal
94
94
  "see our documentation for more information on the recommended " \
95
95
  "method: " \
96
96
  "https://docs.appsignal.com/application/markers/deploy-markers.html"
97
- deprecation_message message, Appsignal.logger
97
+ deprecation_message message
98
98
  end
99
99
 
100
100
  private
@@ -91,8 +91,7 @@ module Appsignal
91
91
  "Formatter for '#{name}' is using a deprecated registration " \
92
92
  "method. This event formatter will not be loaded. " \
93
93
  "Please update the formatter according to the documentation at: " \
94
- "https://docs.appsignal.com/ruby/instrumentation/event-formatters.html",
95
- logger
94
+ "https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
96
95
 
97
96
  EventFormatter.deprecated_formatter_classes[name] = self
98
97
  end
@@ -27,9 +27,8 @@ module Appsignal
27
27
  method_name = "perform"
28
28
  else
29
29
  # Delayed Job
30
- args = extract_value(job.payload_object, :args, {})
31
- class_and_method_name = extract_value(job.payload_object, :appsignal_name, job.name)
32
- class_name, method_name = class_and_method_name.split("#")
30
+ args = extract_value(payload, :args, {})
31
+ class_name, method_name = class_and_method_name_from_object_or_hash(payload, job.name)
33
32
  end
34
33
 
35
34
  params = Appsignal::Utils::HashSanitizer.sanitize(
@@ -54,6 +53,20 @@ module Appsignal
54
53
  end
55
54
  end
56
55
 
56
+ def self.class_and_method_name_from_object_or_hash(payload, default_name)
57
+ # Attempt to find appsignal_name override
58
+ class_and_method_name = extract_value(payload, :appsignal_name, nil)
59
+ return class_and_method_name.split("#") if class_and_method_name.is_a?(String)
60
+
61
+ pound_split = default_name.split("#")
62
+ return pound_split if pound_split.length == 2
63
+
64
+ dot_split = default_name.split(".")
65
+ return default_name if dot_split.length == 2
66
+
67
+ ["unknown"]
68
+ end
69
+
57
70
  def self.extract_value(object_or_hash, field, default_value = nil, convert_to_s = false)
58
71
  value = nil
59
72
 
@@ -23,7 +23,8 @@ module Appsignal
23
23
  begin
24
24
  app.call(env)
25
25
  rescue Exception => error # rubocop:disable Lint/RescueException
26
- transaction.set_error(error)
26
+ # Do not set error if "grape.skip_appsignal_error" is set to `true`.
27
+ transaction.set_error(error) unless env["grape.skip_appsignal_error"]
27
28
  raise error
28
29
  ensure
29
30
  request_method = request.request_method.to_s.upcase
@@ -33,8 +33,7 @@ module Appsignal
33
33
  # @return [void]
34
34
  def <<(probe)
35
35
  deprecation_message "Deprecated `Appsignal::Minute.probes <<` " \
36
- "call. Please use `Appsignal::Minutely.probes.register` instead.",
37
- logger
36
+ "call. Please use `Appsignal::Minutely.probes.register` instead."
38
37
  register probe.object_id, probe
39
38
  end
40
39
 
@@ -28,10 +28,9 @@ module Appsignal
28
28
  def initialize(app, _options = nil)
29
29
  Appsignal.logger.debug \
30
30
  "Initializing Appsignal::Rack::JSExceptionCatcher"
31
- message = "The Appsignal::Rack::JSExceptionCatcher is deprecated. " \
32
- "Please use the official AppSignal JavaScript integration instead. " \
33
- "https://docs.appsignal.com/front-end/"
34
- deprecation_message message, Appsignal.logger
31
+ deprecation_message "The Appsignal::Rack::JSExceptionCatcher is " \
32
+ "deprecated. Please use the official AppSignal JavaScript " \
33
+ "integration instead. https://docs.appsignal.com/front-end/"
35
34
  @app = app
36
35
  end
37
36
 
@@ -248,7 +248,12 @@ module Appsignal
248
248
  Appsignal::Utils::Data.generate(data)
249
249
  )
250
250
  rescue RuntimeError => e
251
- Appsignal.logger.error("Error generating data (#{e.class}: #{e.message}) for '#{data.inspect}'")
251
+ begin
252
+ inspected_data = data.inspect
253
+ Appsignal.logger.error("Error generating data (#{e.class}: #{e.message}) for '#{inspected_data}'")
254
+ rescue => e
255
+ Appsignal.logger.error("Error generating data (#{e.class}: #{e.message}). Can't inspect data.")
256
+ end
252
257
  end
253
258
 
254
259
  def sample_data
@@ -1,8 +1,8 @@
1
1
  module Appsignal
2
2
  module Utils
3
3
  module DeprecationMessage
4
- def deprecation_message(message, logger)
5
- $stdout.puts "appsignal WARNING: #{message}"
4
+ def deprecation_message(message, logger = Appsignal.logger)
5
+ $stderr.puts "appsignal WARNING: #{message}"
6
6
  logger.warn message
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.10.4".freeze
4
+ VERSION = "2.10.8".freeze
5
5
  end
@@ -39,7 +39,7 @@ describe Appsignal::AuthCheck do
39
39
  end
40
40
  end
41
41
 
42
- context "when encountering an exception" do
42
+ context "when encountering an exception", :not_ruby19 do
43
43
  before { stubbed_request.to_timeout }
44
44
 
45
45
  it "raises an error" do
@@ -38,7 +38,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
38
38
  # Because this is saved on the class rather than an instance of the
39
39
  # class we need to clear it like this in case a certain test doesn't
40
40
  # generate a report.
41
- cli_class.remove_instance_variable :@data
41
+ cli_class.send :remove_instance_variable, :@data
42
42
  end
43
43
 
44
44
  if DependencyHelper.rails_present?
@@ -5,6 +5,8 @@ describe Appsignal::CLI::NotifyOfDeploy do
5
5
 
6
6
  let(:out_stream) { std_stream }
7
7
  let(:output) { out_stream.read }
8
+ let(:err_stream) { std_stream }
9
+ let(:stderr) { err_stream.read }
8
10
 
9
11
  define :include_deploy_notification do
10
12
  match do |log|
@@ -32,7 +34,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
32
34
  end
33
35
 
34
36
  def run
35
- capture_stdout(out_stream) do
37
+ capture_std_streams(out_stream, err_stream) do
36
38
  run_cli("notify_of_deploy", options)
37
39
  end
38
40
  end
@@ -130,7 +132,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
130
132
  it "prints a deprecation message" do
131
133
  run
132
134
  deprecation_message = "This command (appsignal notify_of_deploy) has been deprecated"
133
- expect(output).to include("appsignal WARNING: #{deprecation_message}")
135
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
134
136
  expect(log).to contains_log :warn, deprecation_message
135
137
  end
136
138