appsignal 2.10.4 → 2.10.6

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.
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.10.6
4
+ - Check if queued payloads are for correct app and not expired
5
+
6
+ ## 2.10.5
7
+ - Improve Ruby 1.9 compatibility. PR #591
8
+ - Add grape.skip_appsignal_error request env. PR #588
9
+ More information: https://docs.appsignal.com/ruby/integrations/grape.html
10
+ - Fix compatibility with the `http_logger` gem. Fix `SystemStackError`. PR #597
11
+
3
12
  ## 2.10.4
4
13
  - Fix `Appsignal::Transaction#set_http_or_background_action` helper (used by
5
14
  `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,14 +34,14 @@ 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
40
  - ./support/bundler_wrapper install --jobs=3 --retry=3
41
41
  epilogue:
42
42
  on_pass:
43
43
  commands:
44
- - cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) .bundle
44
+ - cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE) .bundle
45
45
  - cache store $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) $HOME/.gem
46
46
 
47
47
  blocks:
@@ -53,6 +53,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
53
53
  env_vars:
54
54
  - name: RUBY_VERSION
55
55
  value: 2.6.5
56
+ - name: GEMSET
57
+ value: no_dependencies
56
58
  - name: BUNDLE_GEMFILE
57
59
  value: gemfiles/no_dependencies.gemfile
58
60
  commands:
@@ -65,6 +67,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
65
67
  env_vars:
66
68
  - name: RUBY_VERSION
67
69
  value: 2.6.5
70
+ - name: GEMSET
71
+ value: no_dependencies
68
72
  - name: BUNDLE_GEMFILE
69
73
  value: gemfiles/no_dependencies.gemfile
70
74
  commands:
@@ -81,8 +85,13 @@ matrix:
81
85
  minimal:
82
86
  - "no_dependencies"
83
87
  - "rails-5.2"
88
+ - "rails-6.0"
84
89
 
85
90
  ruby:
91
+ - ruby: "1.9.3-p551"
92
+ rubygems: "2.7.8"
93
+ bundler: "1.17.3"
94
+ gems: "none"
86
95
  - ruby: "2.0.0-p648"
87
96
  rubygems: "2.7.8"
88
97
  bundler: "1.17.3"
@@ -148,6 +157,7 @@ matrix:
148
157
  - "2.2.10"
149
158
  - "2.3.8"
150
159
  - "2.4.9"
160
+ - "jruby-9.1.17.0"
151
161
  - gem: "resque"
152
162
  bundler: "1.17.3"
153
163
  - 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
@@ -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
@@ -13,15 +13,20 @@ module Appsignal
13
13
  end
14
14
 
15
15
  def install
16
- Net::HTTP.class_eval do
17
- alias request_without_appsignal request
16
+ if Appsignal::System.ruby_2_or_up?
17
+ require "appsignal/integrations/net_http"
18
+ Net::HTTP.send(:prepend, Appsignal::Integrations::NetHttpIntegration)
19
+ else
20
+ Net::HTTP.class_eval do
21
+ alias request_without_appsignal request
18
22
 
19
- def request(request, body = nil, &block)
20
- Appsignal.instrument(
21
- "request.net_http",
22
- "#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
23
- ) do
24
- request_without_appsignal(request, body, &block)
23
+ def request(request, body = nil, &block)
24
+ Appsignal.instrument(
25
+ "request.net_http",
26
+ "#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
27
+ ) do
28
+ request_without_appsignal(request, body, &block)
29
+ end
25
30
  end
26
31
  end
27
32
  end
@@ -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
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appsignal
4
+ module Integrations
5
+ module NetHttpIntegration
6
+ def request(request, body = nil, &block)
7
+ Appsignal.instrument(
8
+ "request.net_http",
9
+ "#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
10
+ ) do
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -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
 
@@ -76,8 +76,14 @@ module Appsignal
76
76
  ldd_version && ldd_version[0]
77
77
  end
78
78
 
79
+ # @api private
79
80
  def self.jruby?
80
81
  RUBY_PLATFORM == "java"
81
82
  end
83
+
84
+ # @api private
85
+ def self.ruby_2_or_up?
86
+ versionify(RUBY_VERSION) >= versionify("2.0")
87
+ end
82
88
  end
83
89
  end
@@ -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.6".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