appsignal 4.7.5 → 4.8.0
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/build_matrix.yml +30 -8
- data/lib/appsignal/config.rb +5 -0
- data/lib/appsignal/hooks/active_support_event_reporter.rb +22 -0
- data/lib/appsignal/hooks/active_support_notifications.rb +7 -0
- data/lib/appsignal/hooks/code_ownership.rb +0 -1
- data/lib/appsignal/hooks.rb +1 -0
- data/lib/appsignal/integrations/active_support_event_reporter.rb +18 -0
- data/lib/appsignal/integrations/active_support_notifications.rb +60 -61
- data/lib/appsignal/logger.rb +52 -0
- data/lib/appsignal/version.rb +1 -1
- data/sig/appsignal.rbi +55 -0
- data/sig/appsignal.rbs +54 -0
- metadata +8 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 374973a9b6a7ecaaec8b95c1aabcf738d2426364f6102e3e625d03c649524f4d
|
|
4
|
+
data.tar.gz: 8b8c0e6483788d34adcbd3d0d824bd0622f422500e45b2731ff513ab2f0b0909
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd4637984afd4ec3fce96f18b9418f07c5dc79eea2f416f90ec6b9b59d5b36612e4e308c8bc25f9451e154c30c49e55c28651758d1023bc2ed9bdda266e00f8e
|
|
7
|
+
data.tar.gz: 89dc007d4151e75900412840cf606e73ca2633c17b53221364c65ac903014a122fdf18498a84b63c2f525bafbc172bcbd47b7235884254d45bc56c389e424e50
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
|
2
2
|
|
|
3
|
+
## 4.8.0
|
|
4
|
+
|
|
5
|
+
_Published on 2025-12-04._
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Report events from Rails 8.1's Structured Event Reporting (`ActiveSupport::EventReporter`) as logs. (minor [8c55fee2](https://github.com/appsignal/appsignal-ruby/commit/8c55fee2364b19515f66084a3553b978ef756d63))
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fix ActiveSupport::Notifications event instrumentation on Rails 8.1 when no listeners are registered. (patch [71a9caae](https://github.com/appsignal/appsignal-ruby/commit/71a9caaecaee3043b33d49d4a295a1b28d4962e0))
|
|
14
|
+
|
|
3
15
|
## 4.7.5
|
|
4
16
|
|
|
5
17
|
_Published on 2025-10-17._
|
data/build_matrix.yml
CHANGED
|
@@ -115,9 +115,10 @@ matrix:
|
|
|
115
115
|
- "rails-7.1"
|
|
116
116
|
- "rails-7.2"
|
|
117
117
|
- "rails-8.0"
|
|
118
|
-
|
|
118
|
+
- "rails-8.1"
|
|
119
119
|
|
|
120
120
|
ruby:
|
|
121
|
+
- ruby: "4.0.0-preview2"
|
|
121
122
|
- ruby: "3.5.0-preview1"
|
|
122
123
|
- ruby: "3.4.1"
|
|
123
124
|
- ruby: "3.3.4"
|
|
@@ -132,9 +133,19 @@ matrix:
|
|
|
132
133
|
- gem: "capistrano2"
|
|
133
134
|
- gem: "capistrano3"
|
|
134
135
|
- gem: "code_ownership"
|
|
136
|
+
only:
|
|
137
|
+
ruby:
|
|
138
|
+
- "3.4.1"
|
|
139
|
+
# - "3.3.4"
|
|
140
|
+
- "3.2.5"
|
|
141
|
+
- "3.1.6"
|
|
142
|
+
- "3.0.7"
|
|
143
|
+
- "2.7.8"
|
|
144
|
+
- "jruby-9.4.7.0"
|
|
135
145
|
- gem: "dry-monitor"
|
|
136
146
|
only:
|
|
137
147
|
ruby:
|
|
148
|
+
- "4.0.0-preview2"
|
|
138
149
|
- "3.5.0-preview1"
|
|
139
150
|
- "3.4.1"
|
|
140
151
|
- "3.3.4"
|
|
@@ -171,9 +182,13 @@ matrix:
|
|
|
171
182
|
- gem: "http5"
|
|
172
183
|
- gem: "ownership"
|
|
173
184
|
- gem: "padrino"
|
|
185
|
+
exclude:
|
|
186
|
+
ruby:
|
|
187
|
+
- "4.0.0-preview2"
|
|
174
188
|
- gem: "psych-3"
|
|
175
189
|
only:
|
|
176
190
|
ruby:
|
|
191
|
+
- "4.0.0-preview2"
|
|
177
192
|
- "3.5.0-preview1"
|
|
178
193
|
- "3.4.1"
|
|
179
194
|
- "3.3.4"
|
|
@@ -184,6 +199,7 @@ matrix:
|
|
|
184
199
|
- gem: "psych-4"
|
|
185
200
|
only:
|
|
186
201
|
ruby:
|
|
202
|
+
- "4.0.0-preview2"
|
|
187
203
|
- "3.5.0-preview1"
|
|
188
204
|
- "3.4.1"
|
|
189
205
|
- "3.3.4"
|
|
@@ -211,6 +227,7 @@ matrix:
|
|
|
211
227
|
- gem: "rails-7.0"
|
|
212
228
|
only:
|
|
213
229
|
ruby:
|
|
230
|
+
- "4.0.0-preview2"
|
|
214
231
|
- "3.5.0-preview1"
|
|
215
232
|
- "3.4.1"
|
|
216
233
|
- "3.3.4"
|
|
@@ -222,6 +239,7 @@ matrix:
|
|
|
222
239
|
- gem: "rails-7.1"
|
|
223
240
|
only:
|
|
224
241
|
ruby:
|
|
242
|
+
- "4.0.0-preview2"
|
|
225
243
|
- "3.5.0-preview1"
|
|
226
244
|
- "3.4.1"
|
|
227
245
|
- "3.3.4"
|
|
@@ -232,6 +250,7 @@ matrix:
|
|
|
232
250
|
- gem: "rails-7.2"
|
|
233
251
|
only:
|
|
234
252
|
ruby:
|
|
253
|
+
- "4.0.0-preview2"
|
|
235
254
|
- "3.5.0-preview1"
|
|
236
255
|
- "3.4.1"
|
|
237
256
|
- "3.3.4"
|
|
@@ -239,19 +258,20 @@ matrix:
|
|
|
239
258
|
- "3.1.6"
|
|
240
259
|
- "jruby-9.4.7.0"
|
|
241
260
|
- gem: "rails-8.0"
|
|
261
|
+
only:
|
|
262
|
+
ruby:
|
|
263
|
+
- "4.0.0-preview2"
|
|
264
|
+
- "3.5.0-preview1"
|
|
265
|
+
- "3.4.1"
|
|
266
|
+
- "3.3.4"
|
|
267
|
+
- "3.2.5"
|
|
268
|
+
- gem: "rails-8.1"
|
|
242
269
|
only:
|
|
243
270
|
ruby:
|
|
244
271
|
- "3.5.0-preview1"
|
|
245
272
|
- "3.4.1"
|
|
246
273
|
- "3.3.4"
|
|
247
274
|
- "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"
|
|
255
275
|
- gem: "sequel"
|
|
256
276
|
- gem: "sinatra"
|
|
257
277
|
- gem: "webmachine2"
|
|
@@ -260,10 +280,12 @@ matrix:
|
|
|
260
280
|
- gem: "sidekiq-7"
|
|
261
281
|
only:
|
|
262
282
|
ruby:
|
|
283
|
+
- "4.0.0-preview2"
|
|
263
284
|
- "3.5.0-preview1"
|
|
264
285
|
- "3.4.1"
|
|
265
286
|
- gem: "sidekiq-8"
|
|
266
287
|
only:
|
|
267
288
|
ruby:
|
|
289
|
+
- "4.0.0-preview2"
|
|
268
290
|
- "3.5.0-preview1"
|
|
269
291
|
- "3.4.1"
|
data/lib/appsignal/config.rb
CHANGED
|
@@ -102,6 +102,7 @@ module Appsignal
|
|
|
102
102
|
:enable_gvl_global_timer => true,
|
|
103
103
|
:enable_gvl_waiting_threads => true,
|
|
104
104
|
:enable_rails_error_reporter => true,
|
|
105
|
+
:enable_active_support_event_log_reporter => true,
|
|
105
106
|
:enable_rake_performance_instrumentation => false,
|
|
106
107
|
:endpoint => "https://push.appsignal.com",
|
|
107
108
|
:files_world_accessible => true,
|
|
@@ -184,6 +185,8 @@ module Appsignal
|
|
|
184
185
|
:enable_gvl_global_timer => "APPSIGNAL_ENABLE_GVL_GLOBAL_TIMER",
|
|
185
186
|
:enable_gvl_waiting_threads => "APPSIGNAL_ENABLE_GVL_WAITING_THREADS",
|
|
186
187
|
:enable_rails_error_reporter => "APPSIGNAL_ENABLE_RAILS_ERROR_REPORTER",
|
|
188
|
+
:enable_active_support_event_log_reporter =>
|
|
189
|
+
"APPSIGNAL_ENABLE_ACTIVE_SUPPORT_EVENT_LOG_REPORTER",
|
|
187
190
|
:enable_rake_performance_instrumentation =>
|
|
188
191
|
"APPSIGNAL_ENABLE_RAKE_PERFORMANCE_INSTRUMENTATION",
|
|
189
192
|
:files_world_accessible => "APPSIGNAL_FILES_WORLD_ACCESSIBLE",
|
|
@@ -802,6 +805,8 @@ module Appsignal
|
|
|
802
805
|
# @return [Boolean] Configure whether GVL waiting threads instrumentation is enabled
|
|
803
806
|
# @!attribute [rw] enable_rails_error_reporter
|
|
804
807
|
# @return [Boolean] Configure whether Rails error reporter integration is enabled
|
|
808
|
+
# @!attribute [rw] enable_active_support_event_log_reporter
|
|
809
|
+
# @return [Boolean] Configure whether ActiveSupport::EventReporter integration is enabled
|
|
805
810
|
# @!attribute [rw] enable_rake_performance_instrumentation
|
|
806
811
|
# @return [Boolean] Configure whether Rake performance instrumentation is enabled
|
|
807
812
|
# @!attribute [rw] files_world_accessible
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appsignal
|
|
4
|
+
class Hooks
|
|
5
|
+
# @!visibility private
|
|
6
|
+
class ActiveSupportEventReporterHook < Appsignal::Hooks::Hook
|
|
7
|
+
register :active_support_event_reporter
|
|
8
|
+
|
|
9
|
+
def dependencies_present?
|
|
10
|
+
defined?(::Rails) &&
|
|
11
|
+
defined?(::ActiveSupport::EventReporter) &&
|
|
12
|
+
Appsignal.config &&
|
|
13
|
+
Appsignal.config[:enable_active_support_event_log_reporter]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def install
|
|
17
|
+
require "appsignal/integrations/active_support_event_reporter"
|
|
18
|
+
Rails.event.subscribe(Appsignal::Integrations::ActiveSupportEventReporter::Subscriber.new)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -29,6 +29,13 @@ module Appsignal
|
|
|
29
29
|
parent_integration_module::StartFinishHandlerIntegration,
|
|
30
30
|
::ActiveSupport::Notifications::Fanout::Handle
|
|
31
31
|
)
|
|
32
|
+
|
|
33
|
+
if defined?(::ActiveSupport::Notifications::Fanout::NullHandle)
|
|
34
|
+
install_module(
|
|
35
|
+
parent_integration_module::BuildHandleFanoutIntegration,
|
|
36
|
+
::ActiveSupport::Notifications::Fanout
|
|
37
|
+
)
|
|
38
|
+
end
|
|
32
39
|
else
|
|
33
40
|
instrumenter = ::ActiveSupport::Notifications::Instrumenter
|
|
34
41
|
|
data/lib/appsignal/hooks.rb
CHANGED
|
@@ -79,6 +79,7 @@ require "appsignal/hooks/action_cable"
|
|
|
79
79
|
require "appsignal/hooks/action_mailer"
|
|
80
80
|
require "appsignal/hooks/active_job"
|
|
81
81
|
require "appsignal/hooks/active_support_notifications"
|
|
82
|
+
require "appsignal/hooks/active_support_event_reporter"
|
|
82
83
|
require "appsignal/hooks/celluloid"
|
|
83
84
|
require "appsignal/hooks/code_ownership"
|
|
84
85
|
require "appsignal/hooks/delayed_job"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appsignal
|
|
4
|
+
module Integrations
|
|
5
|
+
# @!visibility private
|
|
6
|
+
module ActiveSupportEventReporter
|
|
7
|
+
class Subscriber
|
|
8
|
+
def initialize
|
|
9
|
+
@logger = Appsignal::Logger.new("rails_events")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def emit(event)
|
|
13
|
+
@logger.info(event[:name], event[:payload])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -4,98 +4,97 @@ module Appsignal
|
|
|
4
4
|
module Integrations
|
|
5
5
|
# @!visibility private
|
|
6
6
|
module ActiveSupportNotificationsIntegration
|
|
7
|
-
|
|
7
|
+
class << self
|
|
8
|
+
BANG = "!"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
def instrument(name, payload = {}, &block)
|
|
10
|
+
def start_event(name)
|
|
11
11
|
# Events that start with a bang are internal to Rails
|
|
12
|
-
instrument_this = name[0] !=
|
|
13
|
-
|
|
12
|
+
instrument_this = name[0] != BANG
|
|
14
13
|
Appsignal::Transaction.current.start_event if instrument_this
|
|
14
|
+
end
|
|
15
15
|
|
|
16
|
+
def finish_event(name, payload = {})
|
|
17
|
+
# Events that start with a bang are internal to Rails
|
|
18
|
+
instrument_this = name[0] != BANG
|
|
19
|
+
return unless instrument_this
|
|
20
|
+
|
|
21
|
+
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
|
22
|
+
Appsignal::Transaction.current.finish_event(
|
|
23
|
+
name.to_s,
|
|
24
|
+
title,
|
|
25
|
+
body,
|
|
26
|
+
body_format
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module InstrumentIntegration
|
|
32
|
+
def instrument(name, payload = {}, &block)
|
|
33
|
+
ActiveSupportNotificationsIntegration.start_event(name)
|
|
16
34
|
super
|
|
17
35
|
ensure
|
|
18
|
-
|
|
19
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
|
20
|
-
Appsignal::Transaction.current.finish_event(
|
|
21
|
-
name.to_s,
|
|
22
|
-
title,
|
|
23
|
-
body,
|
|
24
|
-
body_format
|
|
25
|
-
)
|
|
26
|
-
end
|
|
36
|
+
ActiveSupportNotificationsIntegration.finish_event(name, payload)
|
|
27
37
|
end
|
|
28
38
|
end
|
|
29
39
|
|
|
30
40
|
module StartFinishIntegration
|
|
31
41
|
def start(name, payload = {})
|
|
32
|
-
|
|
33
|
-
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
|
34
|
-
|
|
35
|
-
Appsignal::Transaction.current.start_event if instrument_this
|
|
36
|
-
|
|
42
|
+
ActiveSupportNotificationsIntegration.start_event(name)
|
|
37
43
|
super
|
|
38
44
|
end
|
|
39
45
|
|
|
40
46
|
def finish(name, payload = {})
|
|
41
|
-
|
|
42
|
-
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
|
43
|
-
|
|
44
|
-
if instrument_this
|
|
45
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
|
46
|
-
Appsignal::Transaction.current.finish_event(
|
|
47
|
-
name.to_s,
|
|
48
|
-
title,
|
|
49
|
-
body,
|
|
50
|
-
body_format
|
|
51
|
-
)
|
|
52
|
-
end
|
|
53
|
-
|
|
47
|
+
ActiveSupportNotificationsIntegration.finish_event(name, payload)
|
|
54
48
|
super
|
|
55
49
|
end
|
|
56
50
|
end
|
|
57
51
|
|
|
58
52
|
module StartFinishHandlerIntegration
|
|
59
53
|
def start
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Appsignal::Transaction.current.start_event if instrument_this
|
|
54
|
+
ActiveSupportNotificationsIntegration.start_event(@name)
|
|
63
55
|
super
|
|
64
56
|
end
|
|
65
57
|
|
|
66
58
|
def finish_with_values(name, id, payload = {})
|
|
67
|
-
|
|
68
|
-
instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG
|
|
69
|
-
|
|
70
|
-
if instrument_this
|
|
71
|
-
title, body, body_format = Appsignal::EventFormatter.format(name, payload)
|
|
72
|
-
Appsignal::Transaction.current.finish_event(
|
|
73
|
-
name.to_s,
|
|
74
|
-
title,
|
|
75
|
-
body,
|
|
76
|
-
body_format
|
|
77
|
-
)
|
|
78
|
-
end
|
|
79
|
-
|
|
59
|
+
ActiveSupportNotificationsIntegration.finish_event(name, payload)
|
|
80
60
|
super
|
|
81
61
|
end
|
|
82
62
|
end
|
|
83
63
|
|
|
84
|
-
|
|
85
|
-
def
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
64
|
+
class NullHandleIntegration
|
|
65
|
+
def initialize(name, _id, payload)
|
|
66
|
+
@name = name
|
|
67
|
+
@payload = payload
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def start
|
|
71
|
+
ActiveSupportNotificationsIntegration.start_event(@name)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def finish
|
|
75
|
+
finish_with_values(@name, nil, @payload)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def finish_with_values(name, _id, payload)
|
|
79
|
+
ActiveSupportNotificationsIntegration.finish_event(name, payload)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
module BuildHandleFanoutIntegration
|
|
84
|
+
def build_handle(name, id, payload)
|
|
85
|
+
handle = super
|
|
86
|
+
|
|
87
|
+
if handle == ::ActiveSupport::Notifications::Fanout::NullHandle
|
|
88
|
+
NullHandleIntegration.new(name, id, payload)
|
|
89
|
+
else
|
|
90
|
+
handle
|
|
97
91
|
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
98
94
|
|
|
95
|
+
module FinishStateIntegration
|
|
96
|
+
def finish_with_state(listeners_state, name, payload = {})
|
|
97
|
+
ActiveSupportNotificationsIntegration.finish_event(name, payload)
|
|
99
98
|
super
|
|
100
99
|
end
|
|
101
100
|
end
|
data/lib/appsignal/logger.rb
CHANGED
|
@@ -228,6 +228,58 @@ module Appsignal
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
# Adds a logger to broadcast log messages to.
|
|
231
|
+
#
|
|
232
|
+
# This implementation of the broadcasting logic exists here in the
|
|
233
|
+
# AppSignal Ruby gem, because it doesn't work in Rails using tagged logging.
|
|
234
|
+
# It would log a log line as many times as there are `Rails.logger.tagged`
|
|
235
|
+
# calls wrapping it.
|
|
236
|
+
#
|
|
237
|
+
# For example, this setup with one log line:
|
|
238
|
+
#
|
|
239
|
+
# ```ruby
|
|
240
|
+
# appsignal_logger = Appsignal::Logger.new("rails")
|
|
241
|
+
# Rails.logger.broadcast_to(appsignal_logger)
|
|
242
|
+
#
|
|
243
|
+
# Rails.logger.tagged("my tag") do
|
|
244
|
+
# Rails.logger.tagged("my nested tag") do
|
|
245
|
+
# Rails.logger.info("Nested log")
|
|
246
|
+
# end
|
|
247
|
+
# end
|
|
248
|
+
# ```
|
|
249
|
+
#
|
|
250
|
+
# Is logged as the following to the AppSignal logger.
|
|
251
|
+
# Each combination of tags is sent separately.
|
|
252
|
+
#
|
|
253
|
+
# ```
|
|
254
|
+
# Nested log
|
|
255
|
+
# [my nested tag] Nested log
|
|
256
|
+
# [my tag] Nested log
|
|
257
|
+
# [my tag] [my nested tag] Nested log
|
|
258
|
+
# ```
|
|
259
|
+
#
|
|
260
|
+
# Once it's fixed in Rails, it can be removed here.
|
|
261
|
+
#
|
|
262
|
+
# Related issues and PRs:
|
|
263
|
+
#
|
|
264
|
+
# - https://github.com/rails/rails/issues/46084
|
|
265
|
+
# - https://github.com/rails/rails/issues/44668
|
|
266
|
+
# - https://github.com/rails/rails/pull/53105
|
|
267
|
+
# - https://github.com/rails/rails/pull/49771
|
|
268
|
+
#
|
|
269
|
+
# Another issue was that the Rails `.broadcast_to` implementation in
|
|
270
|
+
# `ActiveSupport::BroadcastLogger` will run the block passed to `.tagged`
|
|
271
|
+
# as many times as there are loggers.
|
|
272
|
+
# Very early in the Rails execution stack, a middleware runs
|
|
273
|
+
# `logger.tagged(...) { @app.call(env) }`.
|
|
274
|
+
# This would cause the request handler to run twice, and it also causes
|
|
275
|
+
# the Rack response to be an array of Rack responses instead,
|
|
276
|
+
# which breaks the app entirely.
|
|
277
|
+
#
|
|
278
|
+
# Related issues:
|
|
279
|
+
#
|
|
280
|
+
# - https://github.com/rails/rails/issues/49745
|
|
281
|
+
# - https://github.com/rails/rails/issues/49745#issuecomment-1775100622
|
|
282
|
+
#
|
|
231
283
|
# @param logger [Logger] The logger to add to the broadcast list.
|
|
232
284
|
# @return [Array<Logger>]
|
|
233
285
|
def broadcast_to(logger)
|
data/lib/appsignal/version.rb
CHANGED
data/sig/appsignal.rbi
CHANGED
|
@@ -1206,6 +1206,10 @@ module Appsignal
|
|
|
1206
1206
|
sig { returns(T::Boolean) }
|
|
1207
1207
|
attr_accessor :enable_rails_error_reporter
|
|
1208
1208
|
|
|
1209
|
+
# _@return_ — Configure whether ActiveSupport::EventReporter integration is enabled
|
|
1210
|
+
sig { returns(T::Boolean) }
|
|
1211
|
+
attr_accessor :enable_active_support_event_log_reporter
|
|
1212
|
+
|
|
1209
1213
|
# _@return_ — Configure whether Rake performance instrumentation is enabled
|
|
1210
1214
|
sig { returns(T::Boolean) }
|
|
1211
1215
|
attr_accessor :enable_rake_performance_instrumentation
|
|
@@ -1392,6 +1396,57 @@ module Appsignal
|
|
|
1392
1396
|
|
|
1393
1397
|
# Adds a logger to broadcast log messages to.
|
|
1394
1398
|
#
|
|
1399
|
+
# This implementation of the broadcasting logic exists here in the
|
|
1400
|
+
# AppSignal Ruby gem, because it doesn't work in Rails using tagged logging.
|
|
1401
|
+
# It would log a log line as many times as there are `Rails.logger.tagged`
|
|
1402
|
+
# calls wrapping it.
|
|
1403
|
+
#
|
|
1404
|
+
# For example, this setup with one log line:
|
|
1405
|
+
#
|
|
1406
|
+
# ```ruby
|
|
1407
|
+
# appsignal_logger = Appsignal::Logger.new("rails")
|
|
1408
|
+
# Rails.logger.broadcast_to(appsignal_logger)
|
|
1409
|
+
#
|
|
1410
|
+
# Rails.logger.tagged("my tag") do
|
|
1411
|
+
# Rails.logger.tagged("my nested tag") do
|
|
1412
|
+
# Rails.logger.info("Nested log")
|
|
1413
|
+
# end
|
|
1414
|
+
# end
|
|
1415
|
+
# ```
|
|
1416
|
+
#
|
|
1417
|
+
# Is logged as the following to the AppSignal logger.
|
|
1418
|
+
# Each combination of tags is sent separately.
|
|
1419
|
+
#
|
|
1420
|
+
# ```
|
|
1421
|
+
# Nested log
|
|
1422
|
+
# [my nested tag] Nested log
|
|
1423
|
+
# [my tag] Nested log
|
|
1424
|
+
# [my tag] [my nested tag] Nested log
|
|
1425
|
+
# ```
|
|
1426
|
+
#
|
|
1427
|
+
# Once it's fixed in Rails, it can be removed here.
|
|
1428
|
+
#
|
|
1429
|
+
# Related issues and PRs:
|
|
1430
|
+
#
|
|
1431
|
+
# - https://github.com/rails/rails/issues/46084
|
|
1432
|
+
# - https://github.com/rails/rails/issues/44668
|
|
1433
|
+
# - https://github.com/rails/rails/pull/53105
|
|
1434
|
+
# - https://github.com/rails/rails/pull/49771
|
|
1435
|
+
#
|
|
1436
|
+
# Another issue was that the Rails `.broadcast_to` implementation in
|
|
1437
|
+
# `ActiveSupport::BroadcastLogger` will run the block passed to `.tagged`
|
|
1438
|
+
# as many times as there are loggers.
|
|
1439
|
+
# Very early in the Rails execution stack, a middleware runs
|
|
1440
|
+
# `logger.tagged(...) { @app.call(env) }`.
|
|
1441
|
+
# This would cause the request handler to run twice, and it also causes
|
|
1442
|
+
# the Rack response to be an array of Rack responses instead,
|
|
1443
|
+
# which breaks the app entirely.
|
|
1444
|
+
#
|
|
1445
|
+
# Related issues:
|
|
1446
|
+
#
|
|
1447
|
+
# - https://github.com/rails/rails/issues/49745
|
|
1448
|
+
# - https://github.com/rails/rails/issues/49745#issuecomment-1775100622
|
|
1449
|
+
#
|
|
1395
1450
|
# _@param_ `logger` — The logger to add to the broadcast list.
|
|
1396
1451
|
sig { params(logger: Logger).returns(T::Array[Logger]) }
|
|
1397
1452
|
def broadcast_to(logger); end
|
data/sig/appsignal.rbs
CHANGED
|
@@ -1123,6 +1123,9 @@ module Appsignal
|
|
|
1123
1123
|
# _@return_ — Configure whether Rails error reporter integration is enabled
|
|
1124
1124
|
attr_accessor enable_rails_error_reporter: bool
|
|
1125
1125
|
|
|
1126
|
+
# _@return_ — Configure whether ActiveSupport::EventReporter integration is enabled
|
|
1127
|
+
attr_accessor enable_active_support_event_log_reporter: bool
|
|
1128
|
+
|
|
1126
1129
|
# _@return_ — Configure whether Rake performance instrumentation is enabled
|
|
1127
1130
|
attr_accessor enable_rake_performance_instrumentation: bool
|
|
1128
1131
|
|
|
@@ -1276,6 +1279,57 @@ module Appsignal
|
|
|
1276
1279
|
|
|
1277
1280
|
# Adds a logger to broadcast log messages to.
|
|
1278
1281
|
#
|
|
1282
|
+
# This implementation of the broadcasting logic exists here in the
|
|
1283
|
+
# AppSignal Ruby gem, because it doesn't work in Rails using tagged logging.
|
|
1284
|
+
# It would log a log line as many times as there are `Rails.logger.tagged`
|
|
1285
|
+
# calls wrapping it.
|
|
1286
|
+
#
|
|
1287
|
+
# For example, this setup with one log line:
|
|
1288
|
+
#
|
|
1289
|
+
# ```ruby
|
|
1290
|
+
# appsignal_logger = Appsignal::Logger.new("rails")
|
|
1291
|
+
# Rails.logger.broadcast_to(appsignal_logger)
|
|
1292
|
+
#
|
|
1293
|
+
# Rails.logger.tagged("my tag") do
|
|
1294
|
+
# Rails.logger.tagged("my nested tag") do
|
|
1295
|
+
# Rails.logger.info("Nested log")
|
|
1296
|
+
# end
|
|
1297
|
+
# end
|
|
1298
|
+
# ```
|
|
1299
|
+
#
|
|
1300
|
+
# Is logged as the following to the AppSignal logger.
|
|
1301
|
+
# Each combination of tags is sent separately.
|
|
1302
|
+
#
|
|
1303
|
+
# ```
|
|
1304
|
+
# Nested log
|
|
1305
|
+
# [my nested tag] Nested log
|
|
1306
|
+
# [my tag] Nested log
|
|
1307
|
+
# [my tag] [my nested tag] Nested log
|
|
1308
|
+
# ```
|
|
1309
|
+
#
|
|
1310
|
+
# Once it's fixed in Rails, it can be removed here.
|
|
1311
|
+
#
|
|
1312
|
+
# Related issues and PRs:
|
|
1313
|
+
#
|
|
1314
|
+
# - https://github.com/rails/rails/issues/46084
|
|
1315
|
+
# - https://github.com/rails/rails/issues/44668
|
|
1316
|
+
# - https://github.com/rails/rails/pull/53105
|
|
1317
|
+
# - https://github.com/rails/rails/pull/49771
|
|
1318
|
+
#
|
|
1319
|
+
# Another issue was that the Rails `.broadcast_to` implementation in
|
|
1320
|
+
# `ActiveSupport::BroadcastLogger` will run the block passed to `.tagged`
|
|
1321
|
+
# as many times as there are loggers.
|
|
1322
|
+
# Very early in the Rails execution stack, a middleware runs
|
|
1323
|
+
# `logger.tagged(...) { @app.call(env) }`.
|
|
1324
|
+
# This would cause the request handler to run twice, and it also causes
|
|
1325
|
+
# the Rack response to be an array of Rack responses instead,
|
|
1326
|
+
# which breaks the app entirely.
|
|
1327
|
+
#
|
|
1328
|
+
# Related issues:
|
|
1329
|
+
#
|
|
1330
|
+
# - https://github.com/rails/rails/issues/49745
|
|
1331
|
+
# - https://github.com/rails/rails/issues/49745#issuecomment-1775100622
|
|
1332
|
+
#
|
|
1279
1333
|
# _@param_ `logger` — The logger to add to the broadcast list.
|
|
1280
1334
|
def broadcast_to: (Logger logger) -> ::Array[Logger]
|
|
1281
1335
|
|
metadata
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appsignal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Beekman
|
|
8
8
|
- Thijs Cadier
|
|
9
9
|
- Tom de Bruijn
|
|
10
|
+
autorequire:
|
|
10
11
|
bindir: bin
|
|
11
12
|
cert_chain: []
|
|
12
|
-
date: 1980-01-
|
|
13
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: logger
|
|
@@ -213,6 +214,7 @@ files:
|
|
|
213
214
|
- lib/appsignal/hooks/action_cable.rb
|
|
214
215
|
- lib/appsignal/hooks/action_mailer.rb
|
|
215
216
|
- lib/appsignal/hooks/active_job.rb
|
|
217
|
+
- lib/appsignal/hooks/active_support_event_reporter.rb
|
|
216
218
|
- lib/appsignal/hooks/active_support_notifications.rb
|
|
217
219
|
- lib/appsignal/hooks/at_exit.rb
|
|
218
220
|
- lib/appsignal/hooks/celluloid.rb
|
|
@@ -240,6 +242,7 @@ files:
|
|
|
240
242
|
- lib/appsignal/hooks/unicorn.rb
|
|
241
243
|
- lib/appsignal/hooks/webmachine.rb
|
|
242
244
|
- lib/appsignal/integrations/action_cable.rb
|
|
245
|
+
- lib/appsignal/integrations/active_support_event_reporter.rb
|
|
243
246
|
- lib/appsignal/integrations/active_support_notifications.rb
|
|
244
247
|
- lib/appsignal/integrations/capistrano/appsignal.cap
|
|
245
248
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
|
@@ -320,6 +323,7 @@ metadata:
|
|
|
320
323
|
documentation_uri: https://docs.appsignal.com/ruby/
|
|
321
324
|
homepage_uri: https://docs.appsignal.com/ruby/
|
|
322
325
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
|
326
|
+
post_install_message:
|
|
323
327
|
rdoc_options: []
|
|
324
328
|
require_paths:
|
|
325
329
|
- lib
|
|
@@ -335,7 +339,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
335
339
|
- !ruby/object:Gem::Version
|
|
336
340
|
version: '0'
|
|
337
341
|
requirements: []
|
|
338
|
-
rubygems_version: 3.
|
|
342
|
+
rubygems_version: 3.5.9
|
|
343
|
+
signing_key:
|
|
339
344
|
specification_version: 4
|
|
340
345
|
summary: Logs performance and exception data from your app to appsignal.com
|
|
341
346
|
test_files: []
|