appsignal 4.7.0 → 4.7.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 882fa8b34594a9f3bf529528056c1578707ec0cd45f5ef1563933863e6690bc4
4
- data.tar.gz: a0e19b771ec45cd1b6e734e7e04b6f26ca2bb9abc6b713fca7b752ec93f2f427
3
+ metadata.gz: e4c55770d818ef7e9133cfef98452cab49a36af81a5102b8c45ad291232c4ff3
4
+ data.tar.gz: b54eb07277e5bf0127b483f5d8415d9bb348a025e41ceea71875506af0c49d44
5
5
  SHA512:
6
- metadata.gz: 0aaa738024f11463a5731dc423891ce7bcc34b124ed5db021b6456ddbf4cd42b735e024c5cfba390aea82f6578d6070f17e7cd03cb70f51f1aa78172c34735aa
7
- data.tar.gz: 20c7183bd8fbb5848c469fdd5b2103041fdd09f4e8e45caa81df31e539e4fc76eaf728b0c6de169043c9ede80c91694606fcaa0dd5fad77660a7b47b38a839a1
6
+ metadata.gz: 331d5cf75a725cfb7d38471bf40ddac613047cf422e9054ce370073606ac1867d0791d3bd1b51d8599aa849e4528fee1dacfa607a5617001f6d23a843564c4b4
7
+ data.tar.gz: '0138506f1c46bc2275f5713a2d43db2fffc6d7c8faf082c06b2bcb0ff5f65abb75d6cce8a478ebc593fa5237eddd4f523995400909755237c2027eb8975d02af'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 4.7.2
4
+
5
+ _Published on 2025-09-24._
6
+
7
+ ### Fixed
8
+
9
+ - Fix sample data not being reported for JRuby applications. Data like tags, parameters, session data, etc. would not be set if a transaction was sampled. (patch [1cd9ea24](https://github.com/appsignal/appsignal-ruby/commit/1cd9ea248943496780a3ca0fdb2fb4482282f9ba))
10
+
11
+ ## 4.7.1
12
+
13
+ _Published on 2025-09-19._
14
+
15
+ ### Added
16
+
17
+ - Add support for the [CodeOwnership](https://github.com/rubyatscale/code_ownership) gem, which allows engineering teams to declare ownership of specific parts of a codebase.
18
+
19
+ When an error is reported, the AppSignal gem will tag the transaction with the owner of the file that caused the error.
20
+
21
+ This feature is enabled by default. To disable it, set the [`instrument_code_ownership` configuration option](https://docs.appsignal.com/ruby/configuration/options.html#option-instrument_code_ownership) to `false`.
22
+
23
+ (patch [40860cb2](https://github.com/appsignal/appsignal-ruby/commit/40860cb2c64f9f0ff93dbba253514ddb06020a5f))
24
+
25
+ ### Changed
26
+
27
+ - Do not patch `Rack::Events` when using recent Rack versions. When using versions 3.2.1 and above,
28
+ which contain a fix for the bug where using `Rack::Events` breaks requests with streaming bodies,
29
+ use `Rack::Events` directly, instead of our patched subclass.
30
+
31
+ (patch [64f5b0ee](https://github.com/appsignal/appsignal-ruby/commit/64f5b0eebe07e6937a6397ab089d2b6bf1bd234d))
32
+
33
+ ### Fixed
34
+
35
+ - Fix Rails version detection when only one of Rails's gems is present.
36
+
37
+ This prevents loading errors when non-Rails code defines a Rails constant without the full Rails framework.
38
+
39
+ (patch [f06952d9](https://github.com/appsignal/appsignal-ruby/commit/f06952d9ac095bb9c7455acd8ab563beb84d8433))
40
+
3
41
  ## 4.7.0
4
42
 
5
43
  _Published on 2025-08-29._
data/build_matrix.yml CHANGED
@@ -115,6 +115,7 @@ matrix:
115
115
  - "rails-7.1"
116
116
  - "rails-7.2"
117
117
  - "rails-8.0"
118
+ - "rails-8.1"
118
119
 
119
120
  ruby:
120
121
  - ruby: "3.5.0-preview1"
@@ -130,6 +131,7 @@ matrix:
130
131
  - gem: "no_dependencies"
131
132
  - gem: "capistrano2"
132
133
  - gem: "capistrano3"
134
+ - gem: "code_ownership"
133
135
  - gem: "dry-monitor"
134
136
  only:
135
137
  ruby:
@@ -243,6 +245,13 @@ matrix:
243
245
  - "3.4.1"
244
246
  - "3.3.4"
245
247
  - "3.2.5"
248
+ - gem: "rails-8.1"
249
+ only:
250
+ ruby:
251
+ - "3.5.0-preview1"
252
+ - "3.4.1"
253
+ - "3.3.4"
254
+ - "3.2.5"
246
255
  - gem: "sequel"
247
256
  - gem: "sinatra"
248
257
  - gem: "webmachine2"
@@ -112,6 +112,7 @@ module Appsignal
112
112
  :ignore_errors => [],
113
113
  :ignore_logs => [],
114
114
  :ignore_namespaces => [],
115
+ :instrument_code_ownership => true,
115
116
  :instrument_http_rb => true,
116
117
  :instrument_net_http => true,
117
118
  :instrument_ownership => true,
@@ -186,6 +187,7 @@ module Appsignal
186
187
  :enable_rake_performance_instrumentation =>
187
188
  "APPSIGNAL_ENABLE_RAKE_PERFORMANCE_INSTRUMENTATION",
188
189
  :files_world_accessible => "APPSIGNAL_FILES_WORLD_ACCESSIBLE",
190
+ :instrument_code_ownership => "APPSIGNAL_INSTRUMENT_CODE_OWNERSHIP",
189
191
  :instrument_http_rb => "APPSIGNAL_INSTRUMENT_HTTP_RB",
190
192
  :instrument_net_http => "APPSIGNAL_INSTRUMENT_NET_HTTP",
191
193
  :instrument_ownership => "APPSIGNAL_INSTRUMENT_OWNERSHIP",
@@ -80,6 +80,7 @@ module Appsignal
80
80
  activerecord
81
81
  capistrano
82
82
  celluloid
83
+ code_ownership
83
84
  data_mapper
84
85
  delayed_job
85
86
  dry-monitor
@@ -128,7 +128,7 @@ module Appsignal
128
128
  :void
129
129
  attach_function :appsignal_finish_transaction,
130
130
  [:pointer, :long],
131
- :void
131
+ :bool
132
132
  attach_function :appsignal_complete_transaction,
133
133
  [:pointer],
134
134
  :void
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appsignal
4
+ class Hooks
5
+ # @!visibility private
6
+ class CodeOwnershipHook < Appsignal::Hooks::Hook
7
+ register :code_ownership
8
+
9
+ def dependencies_present?
10
+ defined?(::CodeOwnership) &&
11
+ Gem::Specification.find_by_name("code_ownership").version < Gem::Version.new("2.0") &&
12
+ Appsignal.config && Appsignal.config[:instrument_code_ownership]
13
+ end
14
+
15
+ def install
16
+ require "appsignal/integrations/code_ownership"
17
+
18
+ Appsignal::Transaction.before_complete <<
19
+ Appsignal::Integrations::CodeOwnershipIntegration.method(:before_complete)
20
+
21
+ Appsignal::Environment.report_enabled("code_ownership")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -80,6 +80,7 @@ require "appsignal/hooks/action_mailer"
80
80
  require "appsignal/hooks/active_job"
81
81
  require "appsignal/hooks/active_support_notifications"
82
82
  require "appsignal/hooks/celluloid"
83
+ require "appsignal/hooks/code_ownership"
83
84
  require "appsignal/hooks/delayed_job"
84
85
  require "appsignal/hooks/gvl"
85
86
  require "appsignal/hooks/dry_monitor"
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appsignal
4
+ module Integrations
5
+ # @!visibility private
6
+ module CodeOwnershipIntegration
7
+ class << self
8
+ def before_complete(transaction, error)
9
+ team = ::CodeOwnership.for_backtrace(error.backtrace)
10
+ transaction.add_tags(:owner => team.name)
11
+ rescue => ex
12
+ logger = Appsignal.internal_logger
13
+ logger.error(
14
+ "Error while looking up CodeOwnership team: #{ex.class}: #{ex.message}\n" \
15
+ "#{ex.backtrace.join("\n")}"
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Appsignal.internal_logger.debug("Loading Rails (#{Rails.version}) integration")
3
+ rails_version = Rails.respond_to?(:version) ? Rails.version : "unknown"
4
+ Appsignal.internal_logger.debug("Loading Rails (#{rails_version}) integration")
4
5
 
5
6
  require "appsignal/utils/rails_helper"
6
7
  require "appsignal/rack/rails_instrumentation"
@@ -39,12 +39,12 @@ module Appsignal
39
39
 
40
40
  # @api private
41
41
  attr_reader :id
42
- attr_writer :using_appsignal_rack_events_middleware
42
+ attr_writer :using_appsignal_event_middleware
43
43
 
44
44
  # @api private
45
45
  def initialize
46
46
  @id = SecureRandom.uuid
47
- @using_appsignal_rack_events_middleware = false
47
+ @using_appsignal_event_middleware = false
48
48
  end
49
49
 
50
50
  # @api private
@@ -159,7 +159,7 @@ module Appsignal
159
159
  end
160
160
 
161
161
  def emit_warning_once
162
- return if @using_appsignal_rack_events_middleware
162
+ return if @using_appsignal_event_middleware
163
163
 
164
164
  Appsignal.internal_logger.warn <<~MSG
165
165
  Rack::Events is not compatible with streaming bodies. Using `Appsignal::Rack::EventHandler`#{" "}
@@ -168,7 +168,7 @@ module Appsignal
168
168
  with streaming bodies.#{" "}
169
169
  See https://docs.appsignal.com/ruby/integrations/rack.html for more information.
170
170
  MSG
171
- @using_appsignal_rack_events_middleware = true
171
+ @using_appsignal_event_middleware = true
172
172
  end
173
173
  end
174
174
  end
@@ -2,11 +2,19 @@
2
2
 
3
3
  module Appsignal
4
4
  module Rack
5
+ # @api private
6
+ def self.rack_3_2_1_or_newer?
7
+ return false unless ::Rack.respond_to?(:release)
8
+
9
+ Gem::Version.new(::Rack.release) >= Gem::Version.new("3.2.1")
10
+ end
11
+
5
12
  # Modified version of the {::Rack::Events} instrumentation
6
13
  # middleware.
7
14
  #
8
15
  # We recommend using this instead of {::Rack::Events}, as it
9
- # is compatible with streaming bodies.
16
+ # is compatible with streaming bodies when using Rack versions
17
+ # before 3.2.0.
10
18
  #
11
19
  # We do not recommend using this middleware directly, instead
12
20
  # recommending the use of {EventMiddleware}, which is a
@@ -15,64 +23,57 @@ module Appsignal
15
23
  #
16
24
  # See the original implementation at:
17
25
  # https://github.com/rack/rack/blob/8d3d7857fcd9e5df057a6c22458bab35b3a19c12/lib/rack/events.rb
18
- class Events < ::Rack::Events
19
- # A stub for {::Rack::Events::EventedBodyProxy}. It
20
- # allows the same initialization arguments, but
21
- # otherwise behaves identically to {::Rack::BodyProxy}.
22
- #
23
- # It does not implement `#each`, fixing an issue
24
- # where the evented body proxy would break
25
- # streaming responses by always responding to `#each`
26
- # even if the proxied body did not implement it.
27
- #
28
- # Because it ignores the handlers passed to it and
29
- # behaves like a normal body proxy, the `on_send`
30
- # event on the handlers is never called.
31
- class EventedBodyProxy < ::Rack::BodyProxy
32
- def initialize(body, _request, _response, _handlers, &block)
33
- super(body, &block)
34
- end
35
- end
36
26
 
37
- # Notifies the AppSignal event handler that it's being
38
- # used with the modified middleware, suppressing a
39
- # deprecation warning.
40
- def initialize(app, handlers = [])
41
- super
42
- handlers.each do |handler|
43
- if handler.respond_to?(:using_appsignal_rack_events_middleware=)
44
- handler.using_appsignal_rack_events_middleware = true
27
+ if rack_3_2_1_or_newer?
28
+ Events = ::Rack::Events
29
+ else
30
+ class Events < ::Rack::Events
31
+ # A stub for {::Rack::Events::EventedBodyProxy}. It
32
+ # allows the same initialization arguments, but
33
+ # otherwise behaves identically to {::Rack::BodyProxy}.
34
+ #
35
+ # It does not implement `#each`, fixing an issue
36
+ # where the evented body proxy would break
37
+ # streaming responses by always responding to `#each`
38
+ # even if the proxied body did not implement it.
39
+ #
40
+ # Because it ignores the handlers passed to it and
41
+ # behaves like a normal body proxy, the `on_send`
42
+ # event on the handlers is never called.
43
+ class EventedBodyProxy < ::Rack::BodyProxy
44
+ def initialize(body, _request, _response, _handlers, &block)
45
+ super(body, &block)
45
46
  end
46
47
  end
47
- end
48
48
 
49
- # The `call` method, exactly as implemented by {::Rack::Events},
50
- # but redefined here so that it uses our {EventedBodyProxy}
51
- # instead of the original {::Rack::Events::EventedBodyProxy}.
52
- #
53
- # This fixes streaming bodies, but it also means that the
54
- # `on_send` event on the handlers is never called.
55
- #
56
- # See the original implementation at:
57
- # https://github.com/rack/rack/blob/8d3d7857fcd9e5df057a6c22458bab35b3a19c12/lib/rack/events.rb#L111-L129
58
- def call(env)
59
- request = make_request env
60
- on_start request, nil
49
+ # The `call` method, exactly as implemented by {::Rack::Events},
50
+ # but redefined here so that it uses our {EventedBodyProxy}
51
+ # instead of the original {::Rack::Events::EventedBodyProxy}.
52
+ #
53
+ # This fixes streaming bodies, but it also means that the
54
+ # `on_send` event on the handlers is never called.
55
+ #
56
+ # See the original implementation at:
57
+ # https://github.com/rack/rack/blob/8d3d7857fcd9e5df057a6c22458bab35b3a19c12/lib/rack/events.rb#L111-L129
58
+ def call(env)
59
+ request = make_request env
60
+ on_start request, nil
61
61
 
62
- begin
63
- status, headers, body = @app.call request.env
64
- response = make_response status, headers, body
65
- on_commit request, response
66
- rescue StandardError => e
67
- on_error request, response, e
68
- on_finish request, response
69
- raise
70
- end
62
+ begin
63
+ status, headers, body = @app.call request.env
64
+ response = make_response status, headers, body
65
+ on_commit request, response
66
+ rescue StandardError => e
67
+ on_error request, response, e
68
+ on_finish request, response
69
+ raise
70
+ end
71
71
 
72
- body = EventedBodyProxy.new(body, request, response, @handlers) do
73
- on_finish request, response
72
+ body = EventedBodyProxy.new(body, request, response, @handlers) do
73
+ on_finish request, response
74
+ end
75
+ [response.status, response.headers, body]
74
76
  end
75
- [response.status, response.headers, body]
76
77
  end
77
78
  end
78
79
 
@@ -104,7 +105,9 @@ module Appsignal
104
105
  # @api public
105
106
  class EventMiddleware < Events
106
107
  def initialize(app)
107
- super(app, [Appsignal::Rack::EventHandler.new])
108
+ super(app, [Appsignal::Rack::EventHandler.new.tap do |handler|
109
+ handler.using_appsignal_event_middleware = true
110
+ end])
108
111
  end
109
112
  end
110
113
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Appsignal
4
4
  # @return [String]
5
- VERSION = "4.7.0"
5
+ VERSION = "4.7.2"
6
6
  end
data/lib/appsignal.rb CHANGED
@@ -644,7 +644,7 @@ require "appsignal/rack/abstract_middleware"
644
644
  require "appsignal/rack/instrumentation_middleware"
645
645
  require "appsignal/rack/event_handler"
646
646
  require "appsignal/rack/event_middleware"
647
- require "appsignal/integrations/railtie" if defined?(::Rails)
647
+ require "appsignal/integrations/railtie" if defined?(::Rails::Railtie)
648
648
  require "appsignal/transaction"
649
649
  require "appsignal/version"
650
650
  require "appsignal/transmitter"
data/sig/appsignal.rbi CHANGED
@@ -8,7 +8,7 @@
8
8
  module Appsignal
9
9
  extend Appsignal::Helpers::Metrics
10
10
  extend Appsignal::Helpers::Instrumentation
11
- VERSION = T.let("4.7.0", T.untyped)
11
+ VERSION = T.let("4.7.2", T.untyped)
12
12
 
13
13
  class << self
14
14
  # The loaded AppSignal configuration.
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
8
8
  - Thijs Cadier
9
9
  - Tom de Bruijn
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2025-08-29 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: logger
@@ -217,6 +216,7 @@ files:
217
216
  - lib/appsignal/hooks/active_support_notifications.rb
218
217
  - lib/appsignal/hooks/at_exit.rb
219
218
  - lib/appsignal/hooks/celluloid.rb
219
+ - lib/appsignal/hooks/code_ownership.rb
220
220
  - lib/appsignal/hooks/data_mapper.rb
221
221
  - lib/appsignal/hooks/delayed_job.rb
222
222
  - lib/appsignal/hooks/dry_monitor.rb
@@ -243,6 +243,7 @@ files:
243
243
  - lib/appsignal/integrations/active_support_notifications.rb
244
244
  - lib/appsignal/integrations/capistrano/appsignal.cap
245
245
  - lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
246
+ - lib/appsignal/integrations/code_ownership.rb
246
247
  - lib/appsignal/integrations/data_mapper.rb
247
248
  - lib/appsignal/integrations/delayed_job_plugin.rb
248
249
  - lib/appsignal/integrations/dry_monitor.rb
@@ -319,7 +320,6 @@ metadata:
319
320
  documentation_uri: https://docs.appsignal.com/ruby/
320
321
  homepage_uri: https://docs.appsignal.com/ruby/
321
322
  source_code_uri: https://github.com/appsignal/appsignal-ruby
322
- post_install_message:
323
323
  rdoc_options: []
324
324
  require_paths:
325
325
  - lib
@@ -335,8 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  - !ruby/object:Gem::Version
336
336
  version: '0'
337
337
  requirements: []
338
- rubygems_version: 3.3.7
339
- signing_key:
338
+ rubygems_version: 3.6.9
340
339
  specification_version: 4
341
340
  summary: Logs performance and exception data from your app to appsignal.com
342
341
  test_files: []