appsignal 2.11.5-java → 2.11.10-java

Sign up to get free protection for your applications and to get access to all the features.
data/appsignal.gemspec CHANGED
@@ -42,9 +42,31 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
42
42
  gem.add_development_dependency "timecop"
43
43
  gem.add_development_dependency "webmock"
44
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
45
+
46
+ ruby_version = Gem::Version.new(RUBY_VERSION)
47
+ if ruby_version >= Gem::Version.new("2.0.0")
47
48
  gem.add_development_dependency "pry"
48
49
  gem.add_development_dependency "rubocop", "0.50.0"
49
50
  end
51
+
52
+ # Dependencies that need to be locked to a specific version in developement
53
+ if ruby_version < Gem::Version.new("2.0.0")
54
+ # The rexml gem use keyword arguments with optional arguments which
55
+ # work in Ruby 2.1 and newer. Lock crack to a version without rexml.
56
+ gem.add_development_dependency "crack", "0.4.4"
57
+ elsif ruby_version < Gem::Version.new("2.1.0")
58
+ # The rexml gem use keyword arguments with optional arguments which
59
+ # work in Ruby 2.1 and newer.
60
+ gem.add_development_dependency "rexml", "3.2.4"
61
+ end
62
+ if ruby_version < Gem::Version.new("2.0.0")
63
+ # public_suffix 2.0 and newer don't support Ruby < 2.0
64
+ gem.add_development_dependency "public_suffix", "~> 1.4.6"
65
+ elsif ruby_version < Gem::Version.new("2.1.0")
66
+ # public_suffix 3.0 and newer don't support Ruby < 2.1
67
+ gem.add_development_dependency "public_suffix", "~> 2.0.5"
68
+ elsif ruby_version < Gem::Version.new("2.3.0")
69
+ # public_suffix 4.0 and newer don't support Ruby < 2.3
70
+ gem.add_development_dependency "public_suffix", "~> 3.1.1"
71
+ end
50
72
  end
data/build_matrix.yml CHANGED
@@ -33,6 +33,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
33
33
  commands:
34
34
  - checkout
35
35
  - rm -f $HOME/.rbenv/plugins/rbenv-gem-rehash/etc/rbenv.d/exec/~gem-rehash.bash
36
+ - "if [ -n \"$_C_VERSION\" ]; then sem-version c $_C_VERSION; fi"
36
37
  - sem-version ruby $RUBY_VERSION
37
38
  - ./support/check_versions
38
39
  - cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
@@ -88,6 +89,10 @@ matrix:
88
89
  gemsets: # By default all gems are tested
89
90
  none:
90
91
  - "no_dependencies"
92
+ old_rails:
93
+ - "no_dependencies"
94
+ - "rails-3.2"
95
+ - "rails-4.2"
91
96
  minimal:
92
97
  - "no_dependencies"
93
98
  - "rails-5.2"
@@ -101,6 +106,7 @@ matrix:
101
106
  - ruby: "2.0.0-p648"
102
107
  rubygems: "2.7.8"
103
108
  bundler: "1.17.3"
109
+ gems: "old_rails"
104
110
  - ruby: "2.1.10"
105
111
  rubygems: "2.7.8"
106
112
  bundler: "1.17.3"
@@ -117,74 +123,66 @@ matrix:
117
123
  gems: "minimal"
118
124
  - ruby: "2.6.5"
119
125
  - ruby: "2.7.1"
120
- - ruby: "3.0.0"
121
- - ruby: "jruby-9.1.17.0"
126
+ - ruby: "3.0.1"
127
+ - ruby: "jruby-9.2.19.0"
122
128
  gems: "minimal"
129
+ env_vars:
130
+ - name: "_C_VERSION"
131
+ value: "8"
123
132
  gems:
124
133
  - gem: "no_dependencies"
125
134
  - gem: "capistrano2"
126
135
  - gem: "capistrano3"
127
136
  - gem: "grape"
128
137
  - gem: "padrino"
129
- exclude:
130
- ruby:
131
- - "2.0.0-p648"
132
138
  - gem: "que"
133
139
  - gem: "que_beta"
134
- exclude:
135
- ruby:
136
- - "2.0.0-p648"
137
140
  - gem: "rails-3.2"
138
141
  bundler: "1.17.3"
139
142
  exclude:
140
143
  ruby:
141
144
  - "2.6.5"
142
145
  - "2.7.1"
143
- - "3.0.0"
146
+ - "3.0.1"
144
147
  - gem: "rails-4.2"
145
148
  bundler: "1.17.3"
146
149
  exclude:
147
150
  ruby:
148
151
  - "2.6.5"
149
152
  - "2.7.1"
150
- - "3.0.0"
153
+ - "3.0.1"
151
154
  - gem: "rails-5.0"
152
155
  exclude:
153
156
  ruby:
154
157
  - "2.0.0-p648"
155
- - "3.0.0"
158
+ - "3.0.1"
156
159
  - gem: "rails-5.1"
157
160
  exclude:
158
161
  ruby:
159
162
  - "2.0.0-p648"
160
- - "3.0.0"
163
+ - "3.0.1"
161
164
  - gem: "rails-5.2"
162
165
  exclude:
163
166
  ruby:
164
167
  - "2.0.0-p648"
165
- - "3.0.0"
168
+ - "3.0.1"
166
169
  - gem: "rails-6.0"
167
170
  exclude:
168
171
  ruby:
169
- - "2.0.0-p648"
170
172
  - "2.1.10"
171
173
  - "2.2.10"
172
174
  - "2.3.8"
173
175
  - "2.4.9"
174
- - "jruby-9.1.17.0"
175
176
  - gem: "resque-1"
176
177
  bundler: "1.17.3"
177
178
  exclude:
178
179
  ruby:
179
- - "3.0.0"
180
+ - "3.0.1"
180
181
  - gem: "resque-2"
181
- exclude:
182
- ruby:
183
- - "2.0.0-p648"
184
182
  - gem: "sequel"
185
183
  - gem: "sequel-435"
186
184
  exclude:
187
185
  ruby:
188
- - "3.0.0"
186
+ - "3.0.1"
189
187
  - gem: "sinatra"
190
188
  - gem: "webmachine"
@@ -2,6 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'capistrano', '< 3.0'
4
4
  gem 'net-ssh', '2.9.2'
5
- gem 'rack', '~> 1.6'
6
5
 
7
6
  gemspec :path => '../'
@@ -3,6 +3,5 @@ source 'https://rubygems.org'
3
3
  gem 'capistrano', '~> 3.0'
4
4
  gem 'i18n', '~> 1.2.0'
5
5
  gem 'net-ssh', '2.9.2'
6
- gem 'rack', '~> 1.6'
7
6
 
8
7
  gemspec :path => '../'
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'grape', '0.14.0'
4
- gem 'rack', '~> 1.6'
5
4
  gem 'activesupport', '~> 4.2'
6
5
 
7
6
  gemspec :path => '../'
@@ -1,6 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rack', '~> 1.6'
3
+ ruby_version = Gem::Version.new(RUBY_VERSION)
4
+ if ruby_version < Gem::Version.new("2.3.0")
5
+ gem 'rack', '~> 1.6'
6
+ end
4
7
 
5
8
  ruby_version = Gem::Version.new(RUBY_VERSION)
6
9
  if ruby_version < Gem::Version.new("2.0.0")
@@ -3,4 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 3.2.14'
4
4
  gem 'test-unit'
5
5
 
6
+ gem "rack-cache", "~> 1.9.0"
7
+
6
8
  gemspec :path => '../'
@@ -13,5 +13,11 @@ end
13
13
  if ruby_version < Gem::Version.new("2.1.0")
14
14
  gem 'nokogiri', '~> 1.6.0'
15
15
  end
16
+ if ruby_version < Gem::Version.new("2.5.0")
17
+ gem 'sprockets', '~> 3.7.2'
18
+ end
19
+
20
+ gem "minitest", "5.12.0"
21
+ gem "connection_pool", "2.2.3"
16
22
 
17
23
  gemspec :path => '../'
@@ -4,7 +4,3 @@ gem 'resque', "~> 2.0"
4
4
  gem 'sinatra'
5
5
 
6
6
  gemspec :path => '../'
7
-
8
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
9
- gem 'nokogiri', '~> 1.6.0'
10
- end
@@ -6,6 +6,5 @@ if RUBY_PLATFORM == "java"
6
6
  else
7
7
  gem 'sqlite3'
8
8
  end
9
- gem 'rack', '~> 1.6'
10
9
 
11
10
  gemspec :path => '../'
@@ -6,6 +6,5 @@ if RUBY_PLATFORM == "java"
6
6
  else
7
7
  gem 'sqlite3'
8
8
  end
9
- gem 'rack', '~> 1.6'
10
9
 
11
10
  gemspec :path => '../'
@@ -1,6 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'sinatra'
4
- gem 'rack', '~> 1.6'
5
4
 
6
5
  gemspec :path => '../'
@@ -40,6 +40,16 @@ module Appsignal
40
40
  def method_missing(m, *args, &block)
41
41
  super if Appsignal.testing?
42
42
  end
43
+
44
+ unless Appsignal.extension_loaded?
45
+ def data_map_new
46
+ Appsignal::Extension::MockData.new
47
+ end
48
+
49
+ def data_array_new
50
+ Appsignal::Extension::MockData.new
51
+ end
52
+ end
43
53
  end
44
54
 
45
55
  if Appsignal::System.jruby?
@@ -62,5 +72,45 @@ module Appsignal
62
72
  "#<#{self.class.name}:#{object_id} #{self}>"
63
73
  end
64
74
  end
75
+
76
+ # Mock of the {Data} class. This mock is used when the extension cannot be
77
+ # loaded. This mock listens to all method calls and does nothing, and
78
+ # prevents NoMethodErrors from being raised.
79
+ #
80
+ # Disabled in testing so we can make sure that we don't miss an extension
81
+ # function implementation.
82
+ #
83
+ # This class inherits from the {Data} class so that it passes type checks.
84
+ class MockData < Data
85
+ def initialize(*_args)
86
+ # JRuby extension requirement, as it sends a pointer to the Data object
87
+ # when creating it
88
+ end
89
+
90
+ def method_missing(_method, *_args, &_block)
91
+ super if Appsignal.testing?
92
+ end
93
+
94
+ def to_s
95
+ "{}"
96
+ end
97
+ end
98
+
99
+ # Mock of the {Transaction} class. This mock is used when the extension
100
+ # cannot be loaded. This mock listens to all method calls and does nothing,
101
+ # and prevents NoMethodErrors from being raised.
102
+ #
103
+ # Disabled in testing so we can make sure that we don't miss an extension
104
+ # function implementation.
105
+ class MockTransaction
106
+ def initialize(*_args)
107
+ # JRuby extension requirement, as it sends a pointer to the Transaction
108
+ # object when creating it
109
+ end
110
+
111
+ def method_missing(_method, *_args, &_block)
112
+ super if Appsignal.testing?
113
+ end
114
+ end
65
115
  end
66
116
  end
@@ -56,7 +56,11 @@ module Appsignal
56
56
  def install_callbacks
57
57
  ActionCable::Channel::Base.set_callback :subscribe, :around, :prepend => true do |channel, inner|
58
58
  # The request is only the original websocket request
59
- env = channel.connection.env
59
+ connection = channel.connection
60
+ # #env is not available on the Rails ConnectionStub class used in the
61
+ # Rails app test suite. If we call `#env` it causes an error to occur
62
+ # in apps' test suites.
63
+ env = connection.respond_to?(:env) ? connection.env : {}
60
64
  request = ActionDispatch::Request.new(env)
61
65
  env[Appsignal::Hooks::ActionCableHook::REQUEST_ID] ||=
62
66
  request.request_id || SecureRandom.uuid
@@ -84,7 +88,11 @@ module Appsignal
84
88
 
85
89
  ActionCable::Channel::Base.set_callback :unsubscribe, :around, :prepend => true do |channel, inner|
86
90
  # The request is only the original websocket request
87
- env = channel.connection.env
91
+ connection = channel.connection
92
+ # #env is not available on the Rails ConnectionStub class used in the
93
+ # Rails app test suite. If we call `#env` it causes an error to occur
94
+ # in apps' test suites.
95
+ env = connection.respond_to?(:env) ? connection.env : {}
88
96
  request = ActionDispatch::Request.new(env)
89
97
  env[Appsignal::Hooks::ActionCableHook::REQUEST_ID] ||=
90
98
  request.request_id || SecureRandom.uuid
@@ -16,7 +16,11 @@ module Appsignal
16
16
 
17
17
  ::Sidekiq.configure_server do |config|
18
18
  config.server_middleware do |chain|
19
- chain.add Appsignal::Hooks::SidekiqPlugin
19
+ if chain.respond_to? :prepend
20
+ chain.prepend Appsignal::Hooks::SidekiqPlugin
21
+ else
22
+ chain.add Appsignal::Hooks::SidekiqPlugin
23
+ end
20
24
  end
21
25
  end
22
26
  end
@@ -1,56 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Object
4
- if Appsignal::System.ruby_2_7_or_newer?
5
- def self.appsignal_instrument_class_method(method_name, options = {})
6
- singleton_class.send \
7
- :alias_method, "appsignal_uninstrumented_#{method_name}", method_name
8
- singleton_class.send(:define_method, method_name) do |*args, **kwargs, &block|
9
- name = options.fetch(:name) do
10
- "#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
11
- end
12
- Appsignal.instrument name do
13
- send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
14
- end
4
+ def self.appsignal_instrument_class_method(method_name, options = {})
5
+ singleton_class.send \
6
+ :alias_method, "appsignal_uninstrumented_#{method_name}", method_name
7
+ singleton_class.send(:define_method, method_name) do |*args, &block|
8
+ name = options.fetch(:name) do
9
+ "#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
15
10
  end
16
- end
17
-
18
- def self.appsignal_instrument_method(method_name, options = {})
19
- alias_method "appsignal_uninstrumented_#{method_name}", method_name
20
- define_method method_name do |*args, **kwargs, &block|
21
- name = options.fetch(:name) do
22
- "#{method_name}.#{appsignal_reverse_class_name}.other"
23
- end
24
- Appsignal.instrument name do
25
- send "appsignal_uninstrumented_#{method_name}", *args, **kwargs, &block
26
- end
11
+ Appsignal.instrument name do
12
+ send "appsignal_uninstrumented_#{method_name}", *args, &block
27
13
  end
28
14
  end
29
- else
30
- def self.appsignal_instrument_class_method(method_name, options = {})
31
- singleton_class.send \
32
- :alias_method, "appsignal_uninstrumented_#{method_name}", method_name
33
- singleton_class.send(:define_method, method_name) do |*args, &block|
34
- name = options.fetch(:name) do
35
- "#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
36
- end
37
- Appsignal.instrument name do
38
- send "appsignal_uninstrumented_#{method_name}", *args, &block
39
- end
40
- end
15
+ if singleton_class.respond_to?(:ruby2_keywords, true)
16
+ singleton_class.send(:ruby2_keywords, method_name)
41
17
  end
18
+ end
42
19
 
43
- def self.appsignal_instrument_method(method_name, options = {})
44
- alias_method "appsignal_uninstrumented_#{method_name}", method_name
45
- define_method method_name do |*args, &block|
46
- name = options.fetch(:name) do
47
- "#{method_name}.#{appsignal_reverse_class_name}.other"
48
- end
49
- Appsignal.instrument name do
50
- send "appsignal_uninstrumented_#{method_name}", *args, &block
51
- end
20
+ def self.appsignal_instrument_method(method_name, options = {})
21
+ alias_method "appsignal_uninstrumented_#{method_name}", method_name
22
+ define_method method_name do |*args, &block|
23
+ name = options.fetch(:name) do
24
+ "#{method_name}.#{appsignal_reverse_class_name}.other"
25
+ end
26
+ Appsignal.instrument name do
27
+ send "appsignal_uninstrumented_#{method_name}", *args, &block
52
28
  end
53
29
  end
30
+ ruby2_keywords method_name if respond_to?(:ruby2_keywords, true)
54
31
  end
55
32
 
56
33
  def self.appsignal_reverse_class_name
@@ -135,6 +135,12 @@ module Appsignal
135
135
  def start
136
136
  stop
137
137
  @thread = Thread.new do
138
+ # Advise multi-threaded app servers to ignore this thread
139
+ # for the purposes of fork safety warnings
140
+ if Thread.current.respond_to?(:thread_variable_set)
141
+ Thread.current.thread_variable_set(:fork_safe, true)
142
+ end
143
+
138
144
  sleep initial_wait_time
139
145
  initialize_probes
140
146
  loop do
@@ -90,7 +90,7 @@ module Appsignal
90
90
  @transaction_id,
91
91
  @namespace,
92
92
  self.class.garbage_collection_profiler.total_time
93
- )
93
+ ) || Appsignal::Extension::MockTransaction.new
94
94
  end
95
95
 
96
96
  def nil_transaction?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.11.5".freeze
4
+ VERSION = "2.11.10".freeze
5
5
  end