appsignal 4.7.4-java → 4.8.0-java
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 +21 -0
- data/build_matrix.yml +22 -0
- 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 +55 -1
- data/lib/appsignal/utils/integration_logger.rb +25 -0
- data/lib/appsignal/version.rb +1 -1
- data/sig/appsignal.rbi +56 -1
- 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: c1c95dafab66af972baf49ceedc4e904a484dd9dc29a5640aeba1af5a537358b
|
|
4
|
+
data.tar.gz: 8b8c0e6483788d34adcbd3d0d824bd0622f422500e45b2731ff513ab2f0b0909
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05fac090059bda52397188158c09d2ee060e2c25ac5371667005f5bdadf15d12f5e46bd48e84942e472fa10a43da43b14afb5f8f76c18496d56c6f111de4580b
|
|
7
|
+
data.tar.gz: 89dc007d4151e75900412840cf606e73ca2633c17b53221364c65ac903014a122fdf18498a84b63c2f525bafbc172bcbd47b7235884254d45bc56c389e424e50
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
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
|
+
|
|
15
|
+
## 4.7.5
|
|
16
|
+
|
|
17
|
+
_Published on 2025-10-17._
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fix an issue with loggers not supporting a formatter on Rails boot. This will prevent the AppSignal logger config from running into an error if the logger configuration is added to `config/application.rb` or one of the environments in `config/environments/`. (patch [45f0ae0e](https://github.com/appsignal/appsignal-ruby/commit/45f0ae0ebee92ea033b32cf0239de18893933362))
|
|
22
|
+
- Do not log long (error) messages to the internal AppSignal log. If an error like `ActionController::BadRequest` occurred and the error message contained the entire file upload, this would grow the `appsignal.log` file quickly if the error happens often. Internal log messages are now truncated by default. (patch [58401e31](https://github.com/appsignal/appsignal-ruby/commit/58401e31fd81dc1fc24c5bafe104a936cf646667))
|
|
23
|
+
|
|
3
24
|
## 4.7.4
|
|
4
25
|
|
|
5
26
|
_Published on 2025-10-02._
|
data/build_matrix.yml
CHANGED
|
@@ -118,6 +118,7 @@ matrix:
|
|
|
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"
|
|
@@ -241,6 +260,7 @@ matrix:
|
|
|
241
260
|
- gem: "rails-8.0"
|
|
242
261
|
only:
|
|
243
262
|
ruby:
|
|
263
|
+
- "4.0.0-preview2"
|
|
244
264
|
- "3.5.0-preview1"
|
|
245
265
|
- "3.4.1"
|
|
246
266
|
- "3.3.4"
|
|
@@ -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
|
@@ -93,7 +93,9 @@ module Appsignal
|
|
|
93
93
|
# @return [Proc]
|
|
94
94
|
def formatter=(formatter)
|
|
95
95
|
super
|
|
96
|
-
@loggers.each
|
|
96
|
+
@loggers.each do |logger|
|
|
97
|
+
logger.formatter = formatter if logger.respond_to?(:formatter=)
|
|
98
|
+
end
|
|
97
99
|
end
|
|
98
100
|
|
|
99
101
|
# We support the various methods in the Ruby
|
|
@@ -226,6 +228,58 @@ module Appsignal
|
|
|
226
228
|
end
|
|
227
229
|
|
|
228
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
|
+
#
|
|
229
283
|
# @param logger [Logger] The logger to add to the broadcast list.
|
|
230
284
|
# @return [Array<Logger>]
|
|
231
285
|
def broadcast_to(logger)
|
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
module Appsignal
|
|
4
4
|
module Utils
|
|
5
5
|
class IntegrationLogger < ::Logger
|
|
6
|
+
MAX_MESSAGE_LENGTH = 2_000
|
|
7
|
+
|
|
8
|
+
def add(severity, message = nil, progname = nil)
|
|
9
|
+
if message.nil? && !block_given?
|
|
10
|
+
# When called as logger.error("msg"), the message is in progname
|
|
11
|
+
progname = truncate_message(progname)
|
|
12
|
+
elsif message
|
|
13
|
+
message = truncate_message(message)
|
|
14
|
+
elsif block_given?
|
|
15
|
+
message = truncate_message(yield)
|
|
16
|
+
end
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def truncate_message(message)
|
|
23
|
+
return message unless message.is_a?(String)
|
|
24
|
+
|
|
25
|
+
if message.length > MAX_MESSAGE_LENGTH
|
|
26
|
+
"#{message[0, MAX_MESSAGE_LENGTH]}..."
|
|
27
|
+
else
|
|
28
|
+
message
|
|
29
|
+
end
|
|
30
|
+
end
|
|
6
31
|
end
|
|
7
32
|
end
|
|
8
33
|
end
|
data/lib/appsignal/version.rb
CHANGED
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.
|
|
11
|
+
VERSION = T.let("4.7.5", T.untyped)
|
|
12
12
|
|
|
13
13
|
class << self
|
|
14
14
|
# The loaded AppSignal configuration.
|
|
@@ -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: java
|
|
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
|
|
@@ -227,6 +228,7 @@ files:
|
|
|
227
228
|
- lib/appsignal/hooks/action_cable.rb
|
|
228
229
|
- lib/appsignal/hooks/action_mailer.rb
|
|
229
230
|
- lib/appsignal/hooks/active_job.rb
|
|
231
|
+
- lib/appsignal/hooks/active_support_event_reporter.rb
|
|
230
232
|
- lib/appsignal/hooks/active_support_notifications.rb
|
|
231
233
|
- lib/appsignal/hooks/at_exit.rb
|
|
232
234
|
- lib/appsignal/hooks/celluloid.rb
|
|
@@ -254,6 +256,7 @@ files:
|
|
|
254
256
|
- lib/appsignal/hooks/unicorn.rb
|
|
255
257
|
- lib/appsignal/hooks/webmachine.rb
|
|
256
258
|
- lib/appsignal/integrations/action_cable.rb
|
|
259
|
+
- lib/appsignal/integrations/active_support_event_reporter.rb
|
|
257
260
|
- lib/appsignal/integrations/active_support_notifications.rb
|
|
258
261
|
- lib/appsignal/integrations/capistrano/appsignal.cap
|
|
259
262
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
|
@@ -334,6 +337,7 @@ metadata:
|
|
|
334
337
|
documentation_uri: https://docs.appsignal.com/ruby/
|
|
335
338
|
homepage_uri: https://docs.appsignal.com/ruby/
|
|
336
339
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
|
340
|
+
post_install_message:
|
|
337
341
|
rdoc_options: []
|
|
338
342
|
require_paths:
|
|
339
343
|
- lib
|
|
@@ -349,7 +353,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
349
353
|
- !ruby/object:Gem::Version
|
|
350
354
|
version: '0'
|
|
351
355
|
requirements: []
|
|
352
|
-
rubygems_version: 3.
|
|
356
|
+
rubygems_version: 3.5.9
|
|
357
|
+
signing_key:
|
|
353
358
|
specification_version: 4
|
|
354
359
|
summary: Logs performance and exception data from your app to appsignal.com
|
|
355
360
|
test_files: []
|