appsignal 4.2.3 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +75 -0
- data/ext/agent.rb +27 -27
- data/lib/appsignal/logger.rb +19 -36
- data/lib/appsignal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72117542e46b8613fd06be0f6073cb824e131ade995b2d22fca7d9f12564face
|
4
|
+
data.tar.gz: 326804ebc3cd24787261ae0a7f3f8a5f84dd2dad77631dc8f3b5a0465b2e3e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14df3b30df963b9e5ff2944737fc1b965b3258274b916ee84ccdf56710211baccbb26708ea014db5cb4d41138a05b994266883b6d57879eeec4d3adfadc6506a
|
7
|
+
data.tar.gz: f7454f83955ecf86ccfaf9ec17562a994f26e32bb38a9c168603f21bc41b7e19d0fff45ef13d1092943244f28710bafefb7f2c64a6efcc73017b5b9f8410ea0c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,80 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 4.3.1
|
4
|
+
|
5
|
+
_Published on 2024-12-20._
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Fix a performance issue when sanitising `INSERT INTO ... VALUES` queries. (patch [9791d9a1](https://github.com/appsignal/appsignal-ruby/commit/9791d9a1ef18bd18b96ad449cae90425a621bfb3))
|
10
|
+
|
11
|
+
## 4.3.0
|
12
|
+
|
13
|
+
_Published on 2024-12-20._
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Add logger broadcasting. This change implements an alternative within `Appsignal::Logger` to `ActiveSupport::BroadcastLogger`, following the same interface. This enables a proper workaround to the issues with `ActiveSupport::BroadcastLogger` (([#49745](https://github.com/rails/rails/issues/49745), [#51883](https://github.com/rails/rails/issues/51883))) when used alongside tagged logging.
|
18
|
+
|
19
|
+
For example, to use tagged logging both in logs emitted by the default `Rails.logger` and in logs sent to AppSignal, replace the `Rails.logger` with an AppSignal logger that broadcasts to the default `Rails.logger`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
appsignal_logger = Appsignal::Logger.new("app")
|
23
|
+
appsignal_logger.broadcast_to(Rails.logger)
|
24
|
+
Rails.logger = ActiveSupport::TaggedLogging.new(appsignal_logger)
|
25
|
+
```
|
26
|
+
|
27
|
+
(minor [5cb1464b](https://github.com/appsignal/appsignal-ruby/commit/5cb1464bcf12f043774fb55850e6b82aeba9c1ca))
|
28
|
+
|
29
|
+
### Removed
|
30
|
+
|
31
|
+
- Remove tagged logging support from `Appsignal::Logger`.
|
32
|
+
|
33
|
+
Tagged logging is still supported by wrapping an instance of `Appsignal::Logger` with `ActiveSupport::TaggedLogging`:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
appsignal_logger = Appsignal::Logger.new("rails")
|
37
|
+
tagged_logger = ActiveSupport::TaggedLogging.new(appsignal_logger)
|
38
|
+
Rails.logger = tagged_logger
|
39
|
+
```
|
40
|
+
|
41
|
+
Removing this functionality allows for a workaround to issues within Rails ([#49745](https://github.com/rails/rails/issues/49745), [#51883](https://github.com/rails/rails/issues/51883)), where using the broadcast logger to log to more than one tagged logger results in incorrect behaviour of the tagged logging methods, resulting in breakage throughout Rails' internals:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# We use the built-in request ID middleware as an example that triggers
|
45
|
+
# the issue:
|
46
|
+
Rails.config.log_tags = [:request_id]
|
47
|
+
|
48
|
+
appsignal_logger = Appsignal::Logger.new("rails")
|
49
|
+
tagged_logger = ActiveSupport::TaggedLogging.new(appsignal_logger)
|
50
|
+
|
51
|
+
# This does not work correctly, because the default `Rails.logger` is a
|
52
|
+
# broadcast logger that is already broadcasting to a tagged logger.
|
53
|
+
# When asked to broadcast to a second tagged logger, the return value of
|
54
|
+
# `Rails.logger.tagged { ... }` will be incorrect, in turn causing the
|
55
|
+
# `RequestID` middleware, which uses it internally, to return broken
|
56
|
+
# Rack responses.
|
57
|
+
Rails.logger.broadcast_to(tagged_logger)
|
58
|
+
```
|
59
|
+
|
60
|
+
By reverting the changes to our logger so that it is no longer a tagged logger, we enable a workaround to this issue:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
Rails.config.log_tags = [:request_id]
|
64
|
+
|
65
|
+
appsignal_logger = Appsignal::Logger.new("rails")
|
66
|
+
|
67
|
+
# This works correctly, because `appsignal_logger` is not a tagged logger.
|
68
|
+
# Note that `appsignal_logger` will not have the `request_id` tags.
|
69
|
+
Rails.logger.broadcast_to(appsignal_logger)
|
70
|
+
```
|
71
|
+
|
72
|
+
(patch [c061aa4e](https://github.com/appsignal/appsignal-ruby/commit/c061aa4e3f9485a1549ea90316534cddd36e238e))
|
73
|
+
|
74
|
+
### Fixed
|
75
|
+
|
76
|
+
- Fix `#silence` implementation for `Appsignal::Logger`. (patch [d08a1cec](https://github.com/appsignal/appsignal-ruby/commit/d08a1cec705db71999afa9c4af36e244a7b6483a))
|
77
|
+
|
3
78
|
## 4.2.3
|
4
79
|
|
5
80
|
_Published on 2024-12-17._
|
data/ext/agent.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Modifications to this file will be overwritten with the next agent release.
|
7
7
|
|
8
8
|
APPSIGNAL_AGENT_CONFIG = {
|
9
|
-
"version" => "0.35.
|
9
|
+
"version" => "0.35.29",
|
10
10
|
"mirrors" => [
|
11
11
|
"https://d135dj0rjqvssy.cloudfront.net",
|
12
12
|
"https://appsignal-agent-releases.global.ssl.fastly.net"
|
@@ -14,131 +14,131 @@ APPSIGNAL_AGENT_CONFIG = {
|
|
14
14
|
"triples" => {
|
15
15
|
"x86_64-darwin" => {
|
16
16
|
"static" => {
|
17
|
-
"checksum" => "
|
17
|
+
"checksum" => "880b317fc23d3cfa11ba88c80d11129bd02742b8b9c100bb038b66e73f85b723",
|
18
18
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
19
19
|
},
|
20
20
|
"dynamic" => {
|
21
|
-
"checksum" => "
|
21
|
+
"checksum" => "0b9503e12862fb4824d78b1388bc4f51a9821f5c45ff78ae0782c2200632eac9",
|
22
22
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
23
23
|
}
|
24
24
|
},
|
25
25
|
"universal-darwin" => {
|
26
26
|
"static" => {
|
27
|
-
"checksum" => "
|
27
|
+
"checksum" => "880b317fc23d3cfa11ba88c80d11129bd02742b8b9c100bb038b66e73f85b723",
|
28
28
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
29
29
|
},
|
30
30
|
"dynamic" => {
|
31
|
-
"checksum" => "
|
31
|
+
"checksum" => "0b9503e12862fb4824d78b1388bc4f51a9821f5c45ff78ae0782c2200632eac9",
|
32
32
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
33
33
|
}
|
34
34
|
},
|
35
35
|
"aarch64-darwin" => {
|
36
36
|
"static" => {
|
37
|
-
"checksum" => "
|
37
|
+
"checksum" => "64b0107722401f5ee39eebec03b9c5a68a14967e8aa8806848df930f85a8afaf",
|
38
38
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
39
39
|
},
|
40
40
|
"dynamic" => {
|
41
|
-
"checksum" => "
|
41
|
+
"checksum" => "3c1e8da7ce62cfd72b3f83c212baf8ddcf3998b8c37fdcb990d1fc9397488428",
|
42
42
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
43
43
|
}
|
44
44
|
},
|
45
45
|
"arm64-darwin" => {
|
46
46
|
"static" => {
|
47
|
-
"checksum" => "
|
47
|
+
"checksum" => "64b0107722401f5ee39eebec03b9c5a68a14967e8aa8806848df930f85a8afaf",
|
48
48
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
49
49
|
},
|
50
50
|
"dynamic" => {
|
51
|
-
"checksum" => "
|
51
|
+
"checksum" => "3c1e8da7ce62cfd72b3f83c212baf8ddcf3998b8c37fdcb990d1fc9397488428",
|
52
52
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
53
53
|
}
|
54
54
|
},
|
55
55
|
"arm-darwin" => {
|
56
56
|
"static" => {
|
57
|
-
"checksum" => "
|
57
|
+
"checksum" => "64b0107722401f5ee39eebec03b9c5a68a14967e8aa8806848df930f85a8afaf",
|
58
58
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
59
59
|
},
|
60
60
|
"dynamic" => {
|
61
|
-
"checksum" => "
|
61
|
+
"checksum" => "3c1e8da7ce62cfd72b3f83c212baf8ddcf3998b8c37fdcb990d1fc9397488428",
|
62
62
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
63
63
|
}
|
64
64
|
},
|
65
65
|
"aarch64-linux" => {
|
66
66
|
"static" => {
|
67
|
-
"checksum" => "
|
67
|
+
"checksum" => "02dd40769daa5cde64dfee9e0931d0432c4ccffeb6c08197cccc454234fdae2c",
|
68
68
|
"filename" => "appsignal-aarch64-linux-all-static.tar.gz"
|
69
69
|
},
|
70
70
|
"dynamic" => {
|
71
|
-
"checksum" => "
|
71
|
+
"checksum" => "1eaeed41ec98cb930454944cf27d45e5bb35805d303503ea00f59dbaccce7c37",
|
72
72
|
"filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
|
73
73
|
}
|
74
74
|
},
|
75
75
|
"i686-linux" => {
|
76
76
|
"static" => {
|
77
|
-
"checksum" => "
|
77
|
+
"checksum" => "4e19e1db93add17a71aaf2fd14ddf4cbd6913338f8ebeb0569baa59e154e8999",
|
78
78
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
79
79
|
},
|
80
80
|
"dynamic" => {
|
81
|
-
"checksum" => "
|
81
|
+
"checksum" => "df508739e7f67824566e6388966c1f88df1b835abc519cb1f3c8297dd6ff1fe2",
|
82
82
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"x86-linux" => {
|
86
86
|
"static" => {
|
87
|
-
"checksum" => "
|
87
|
+
"checksum" => "4e19e1db93add17a71aaf2fd14ddf4cbd6913338f8ebeb0569baa59e154e8999",
|
88
88
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
89
89
|
},
|
90
90
|
"dynamic" => {
|
91
|
-
"checksum" => "
|
91
|
+
"checksum" => "df508739e7f67824566e6388966c1f88df1b835abc519cb1f3c8297dd6ff1fe2",
|
92
92
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
93
93
|
}
|
94
94
|
},
|
95
95
|
"x86_64-linux" => {
|
96
96
|
"static" => {
|
97
|
-
"checksum" => "
|
97
|
+
"checksum" => "1150865e4a9b6d773a10702414b9b0b7cc69a72c0cbb17f5a01cebf40cabbcc4",
|
98
98
|
"filename" => "appsignal-x86_64-linux-all-static.tar.gz"
|
99
99
|
},
|
100
100
|
"dynamic" => {
|
101
|
-
"checksum" => "
|
101
|
+
"checksum" => "b17ed8c85171638f14d0ff3bca9d83894a9d2966da0a4554ba9b6cd1197a0a54",
|
102
102
|
"filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
|
103
103
|
}
|
104
104
|
},
|
105
105
|
"x86_64-linux-musl" => {
|
106
106
|
"static" => {
|
107
|
-
"checksum" => "
|
107
|
+
"checksum" => "86fe06ca6dcc93e68a9c603c9087f15b0cef213f4df0eab6c0b495034045cde0",
|
108
108
|
"filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
|
109
109
|
},
|
110
110
|
"dynamic" => {
|
111
|
-
"checksum" => "
|
111
|
+
"checksum" => "6b68164b768fda589390d34f3c20ac7fe19c7a64a864af723fad52abf981492b",
|
112
112
|
"filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
|
113
113
|
}
|
114
114
|
},
|
115
115
|
"aarch64-linux-musl" => {
|
116
116
|
"static" => {
|
117
|
-
"checksum" => "
|
117
|
+
"checksum" => "a3b2e4eb3a32408cbbc5b0a12b1d61322378ce0dc30edfb1c541a43d0c5306ff",
|
118
118
|
"filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
|
119
119
|
},
|
120
120
|
"dynamic" => {
|
121
|
-
"checksum" => "
|
121
|
+
"checksum" => "72163a268416a7171e69bd68f3cf4b732989107eb25b9a910618cc66079a1c87",
|
122
122
|
"filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
|
123
123
|
}
|
124
124
|
},
|
125
125
|
"x86_64-freebsd" => {
|
126
126
|
"static" => {
|
127
|
-
"checksum" => "
|
127
|
+
"checksum" => "a4982fab5a7b4a4292bd0002e3bc571cbeced167c6a3e36f6c26e7898b3d38a7",
|
128
128
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
129
129
|
},
|
130
130
|
"dynamic" => {
|
131
|
-
"checksum" => "
|
131
|
+
"checksum" => "0dd1afc8e0896b87ce76b65358806e0b89213ffb8727a50d926c987978c5e1ee",
|
132
132
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
133
133
|
}
|
134
134
|
},
|
135
135
|
"amd64-freebsd" => {
|
136
136
|
"static" => {
|
137
|
-
"checksum" => "
|
137
|
+
"checksum" => "a4982fab5a7b4a4292bd0002e3bc571cbeced167c6a3e36f6c26e7898b3d38a7",
|
138
138
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
139
139
|
},
|
140
140
|
"dynamic" => {
|
141
|
-
"checksum" => "
|
141
|
+
"checksum" => "0dd1afc8e0896b87ce76b65358806e0b89213ffb8727a50d926c987978c5e1ee",
|
142
142
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
143
143
|
}
|
144
144
|
}
|
data/lib/appsignal/logger.rb
CHANGED
@@ -38,7 +38,7 @@ module Appsignal
|
|
38
38
|
@mutex = Mutex.new
|
39
39
|
@default_attributes = attributes
|
40
40
|
@appsignal_attributes = {}
|
41
|
-
@
|
41
|
+
@loggers = []
|
42
42
|
end
|
43
43
|
|
44
44
|
# We support the various methods in the Ruby
|
@@ -59,13 +59,14 @@ module Appsignal
|
|
59
59
|
end
|
60
60
|
return if message.nil?
|
61
61
|
|
62
|
-
if @tags.any?
|
63
|
-
formatted_tags = @tags.map { |tag| "[#{tag}]" }
|
64
|
-
message = "#{formatted_tags.join(" ")} #{message}"
|
65
|
-
end
|
66
|
-
|
67
62
|
message = formatter.call(severity, Time.now, group, message) if formatter
|
68
63
|
|
64
|
+
@loggers.each do |logger|
|
65
|
+
logger.add(severity, message, group)
|
66
|
+
rescue
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
|
69
70
|
unless message.is_a?(String)
|
70
71
|
Appsignal.internal_logger.warn(
|
71
72
|
"Logger message was ignored, because it was not a String: #{message.inspect}"
|
@@ -150,41 +151,23 @@ module Appsignal
|
|
150
151
|
add_with_attributes(FATAL, message, @group, attributes)
|
151
152
|
end
|
152
153
|
|
153
|
-
# Listen to ActiveSupport tagged logging tags set with `Rails.logger.tagged`.
|
154
|
-
def tagged(tags)
|
155
|
-
@tags.append(*tags)
|
156
|
-
yield self
|
157
|
-
ensure
|
158
|
-
@tags.pop(tags.length)
|
159
|
-
end
|
160
|
-
|
161
|
-
# Listen to ActiveSupport tagged logging tags set with `Rails.config.log_tags`.
|
162
|
-
def push_tags(*tags)
|
163
|
-
@tags.append(*tags)
|
164
|
-
end
|
165
|
-
|
166
|
-
# Remove a set of ActiveSupport tagged logging tags set with `Rails.config.log_tags`.
|
167
|
-
def pop_tags(count = 1)
|
168
|
-
@tags.pop(count)
|
169
|
-
end
|
170
|
-
|
171
|
-
# Remove all ActiveSupport tagged logging tags set with `Rails.config.log_tags`.
|
172
|
-
def clear_tags!
|
173
|
-
@tags.clear
|
174
|
-
end
|
175
|
-
|
176
154
|
# When using ActiveSupport::TaggedLogging without the broadcast feature,
|
177
155
|
# the passed logger is required to respond to the `silence` method.
|
178
|
-
# In our case it behaves as the broadcast feature of the Rails logger, but
|
179
|
-
# we don't have to check if the parent logger has the `silence` method defined
|
180
|
-
# as our logger directly inherits from Ruby base logger.
|
181
156
|
#
|
182
|
-
#
|
157
|
+
# Reference links:
|
183
158
|
#
|
184
159
|
# - https://github.com/rails/rails/blob/e11ebc04cfbe41c06cdfb70ee5a9fdbbd98bb263/activesupport/lib/active_support/logger.rb#L60-L76
|
185
|
-
# - https://github.com/rails/rails/blob/
|
186
|
-
def silence(
|
187
|
-
|
160
|
+
# - https://github.com/rails/rails/blob/e11ebc04cfbe41c06cdfb70ee5a9fdbbd98bb263/activesupport/lib/active_support/logger_silence.rb
|
161
|
+
def silence(severity = ERROR, &block)
|
162
|
+
previous_level = @level
|
163
|
+
@level = severity
|
164
|
+
block.call(self)
|
165
|
+
ensure
|
166
|
+
@level = previous_level
|
167
|
+
end
|
168
|
+
|
169
|
+
def broadcast_to(logger)
|
170
|
+
@loggers << logger
|
188
171
|
end
|
189
172
|
|
190
173
|
private
|
data/lib/appsignal/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-12-
|
13
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: logger
|