appsignal 4.2.1-java → 4.2.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fb5ab86d82068a901fa22589f63979ab4a23582ef8b37f081f7f91a9d9e0b8c
4
- data.tar.gz: 72bfe73112c365ec22375fed9a3e3c0283295d18442f346ffcee6461578aa487
3
+ metadata.gz: 784861d0e654bc150f7aa6a6b7770d157ae56cb539102c3be3d43a74f23cb6d2
4
+ data.tar.gz: 41664ff55a4afcf2b0d2bf8f0c5869e72490998305450169095020b48b33d7b9
5
5
  SHA512:
6
- metadata.gz: b831de347ad8979e1fae172f8d6656b42706acf6f262d773b5d16bef26847e001e4aa98957eee8b8a90cd36c8ad5ec202621fad34b6dc50c858e367eb4d8bd0f
7
- data.tar.gz: 536707fdd072fba73fd710ac2cd503c4f3bc79cf09b0d0afb1b2cc7aa7441d2fd07ff5a24586f390195f92aeeda356b2829f433863e10c18551b3151a5aa9f15
6
+ metadata.gz: f818ffac31f93c26fb2f47731868c3c705687fef154bb8814e768abc2f02c42d2873e84c280f4661de5aa5ff2f2b49aa1af7c9967ca868d9e075d4873a9fbda8
7
+ data.tar.gz: 37fc851eda0c8e730ba962239d6962cc1939bfb0109f7fd0c372a8635381fd986aeb4ec12711b5f82c7ca861b53c23ca73893b566449442bd3da1e6e5a93fe0d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 4.2.3
4
+
5
+ _Published on 2024-12-17._
6
+
7
+ ### Fixed
8
+
9
+ - Fix tagged logging ArgumentError error for Rails 8. (patch [8f373074](https://github.com/appsignal/appsignal-ruby/commit/8f373074531d8285b4718c16e125a62f42774d90))
10
+
11
+ ## 4.2.2
12
+
13
+ _Published on 2024-12-16._
14
+
15
+ ### Added
16
+
17
+ - Support Rails/ActiveSupport tagged logging. When tags are set in apps using `Rails.logger.tagged { ... }` or with the `Rails.application.config.log_tags = [...]` config option, these tags are now included in the collected log messages.
18
+
19
+ ```ruby
20
+ Rails.logger.tagged(["Tag 1", "Tag 2"]) { Rails.logger.info("My message") }
21
+ ```
22
+
23
+ Reports this log message:
24
+
25
+ > [Tag 1] [Tag 2] My message
26
+
27
+ (patch [41e1e8f0](https://github.com/appsignal/appsignal-ruby/commit/41e1e8f076025da2420cb43c53b5f7211ae45de8))
28
+
29
+ ### Fixed
30
+
31
+ - Fix a thread safety issue where sending check-in events simultaneously from different threads would cause several check-in schedulers to be initialised internally. This could cause some of the scheduled check-in events to never be sent to AppSignal when `Appsignal.stop` is called. (patch [c372a3f9](https://github.com/appsignal/appsignal-ruby/commit/c372a3f998b78ef5ef259be39fe198433d6ca95e))
32
+
3
33
  ## 4.2.1
4
34
 
5
35
  _Published on 2024-12-04._
data/build_matrix.yml CHANGED
@@ -88,6 +88,7 @@ matrix:
88
88
  - "rails-8.0"
89
89
 
90
90
  ruby:
91
+ - ruby: "3.4.0-rc1"
91
92
  - ruby: "3.3.4"
92
93
  - ruby: "3.2.5"
93
94
  - ruby: "3.1.6"
@@ -102,6 +103,7 @@ matrix:
102
103
  - gem: "dry-monitor"
103
104
  only:
104
105
  ruby:
106
+ - "3.4.0-rc1"
105
107
  - "3.3.4"
106
108
  - "3.2.5"
107
109
  - "3.1.6"
@@ -110,6 +112,7 @@ matrix:
110
112
  - gem: "hanami-2.0"
111
113
  only:
112
114
  ruby:
115
+ - "3.4.0-rc1"
113
116
  - "3.3.4"
114
117
  - "3.2.5"
115
118
  - "3.1.6"
@@ -117,6 +120,7 @@ matrix:
117
120
  - gem: "hanami-2.1"
118
121
  only:
119
122
  ruby:
123
+ - "3.4.0-rc1"
120
124
  - "3.3.4"
121
125
  - "3.2.5"
122
126
  - "3.1.6"
@@ -124,6 +128,7 @@ matrix:
124
128
  - gem: "hanami-2.2"
125
129
  only:
126
130
  ruby:
131
+ - "3.4.0-rc1"
127
132
  - "3.3.4"
128
133
  - "3.2.5"
129
134
  - "3.1.6"
@@ -132,6 +137,7 @@ matrix:
132
137
  - gem: "psych-3"
133
138
  only:
134
139
  ruby:
140
+ - "3.4.0-rc1"
135
141
  - "3.3.4"
136
142
  - "3.2.5"
137
143
  - "3.1.6"
@@ -140,6 +146,7 @@ matrix:
140
146
  - gem: "psych-4"
141
147
  only:
142
148
  ruby:
149
+ - "3.4.0-rc1"
143
150
  - "3.3.4"
144
151
  - "3.2.5"
145
152
  - "3.1.6"
@@ -165,6 +172,7 @@ matrix:
165
172
  - gem: "rails-7.0"
166
173
  only:
167
174
  ruby:
175
+ - "3.4.0-rc1"
168
176
  - "3.3.4"
169
177
  - "3.2.5"
170
178
  - "3.1.6"
@@ -174,6 +182,7 @@ matrix:
174
182
  - gem: "rails-7.1"
175
183
  only:
176
184
  ruby:
185
+ - "3.4.0-rc1"
177
186
  - "3.3.4"
178
187
  - "3.2.5"
179
188
  - "3.1.6"
@@ -182,6 +191,7 @@ matrix:
182
191
  - gem: "rails-7.2"
183
192
  only:
184
193
  ruby:
194
+ - "3.4.0-rc1"
185
195
  - "3.3.4"
186
196
  - "3.2.5"
187
197
  - "3.1.6"
@@ -189,6 +199,7 @@ matrix:
189
199
  - gem: "rails-8.0"
190
200
  only:
191
201
  ruby:
202
+ - "3.4.0-rc1"
192
203
  - "3.3.4"
193
204
  - "3.2.5"
194
205
  - gem: "sequel"
@@ -95,7 +95,11 @@ module Appsignal
95
95
  description = Event.describe(events)
96
96
 
97
97
  begin
98
- response = CheckIn.transmitter.transmit(events, :format => :ndjson)
98
+ @transmitter ||= Transmitter.new(
99
+ "#{Appsignal.config[:logging_endpoint]}/check_ins/json"
100
+ )
101
+
102
+ response = @transmitter.transmit(events, :format => :ndjson)
99
103
 
100
104
  if (200...300).include?(response.code.to_i)
101
105
  Appsignal.internal_logger.debug("Transmitted #{description}")
@@ -3,6 +3,8 @@
3
3
  module Appsignal
4
4
  module CheckIn
5
5
  HEARTBEAT_CONTINUOUS_INTERVAL_SECONDS = 30
6
+ NEW_SCHEDULER_MUTEX = Mutex.new
7
+
6
8
  class << self
7
9
  # @api private
8
10
  def continuous_heartbeats
@@ -82,16 +84,15 @@ module Appsignal
82
84
  scheduler.schedule(event)
83
85
  end
84
86
 
85
- # @api private
86
- def transmitter
87
- @transmitter ||= Transmitter.new(
88
- "#{Appsignal.config[:logging_endpoint]}/check_ins/json"
89
- )
90
- end
91
-
92
87
  # @api private
93
88
  def scheduler
94
- @scheduler ||= Scheduler.new
89
+ return @scheduler if @scheduler
90
+
91
+ NEW_SCHEDULER_MUTEX.synchronize do
92
+ @scheduler ||= Scheduler.new
93
+ end
94
+
95
+ @scheduler
95
96
  end
96
97
 
97
98
  # @api private
@@ -37,6 +37,8 @@ module Appsignal
37
37
  @format = format
38
38
  @mutex = Mutex.new
39
39
  @default_attributes = attributes
40
+ @appsignal_attributes = {}
41
+ @tags = []
40
42
  end
41
43
 
42
44
  # We support the various methods in the Ruby
@@ -57,6 +59,11 @@ module Appsignal
57
59
  end
58
60
  return if message.nil?
59
61
 
62
+ if @tags.any?
63
+ formatted_tags = @tags.map { |tag| "[#{tag}]" }
64
+ message = "#{formatted_tags.join(" ")} #{message}"
65
+ end
66
+
60
67
  message = formatter.call(severity, Time.now, group, message) if formatter
61
68
 
62
69
  unless message.is_a?(String)
@@ -143,6 +150,29 @@ module Appsignal
143
150
  add_with_attributes(FATAL, message, @group, attributes)
144
151
  end
145
152
 
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
+
146
176
  # When using ActiveSupport::TaggedLogging without the broadcast feature,
147
177
  # the passed logger is required to respond to the `silence` method.
148
178
  # In our case it behaves as the broadcast feature of the Rails logger, but
@@ -159,17 +189,13 @@ module Appsignal
159
189
 
160
190
  private
161
191
 
162
- attr_reader :default_attributes
192
+ attr_reader :default_attributes, :appsignal_attributes
163
193
 
164
194
  def add_with_attributes(severity, message, group, attributes)
165
- Thread.current[:appsignal_logger_attributes] = default_attributes.merge(attributes)
195
+ @appsignal_attributes = default_attributes.merge(attributes)
166
196
  add(severity, message, group)
167
197
  ensure
168
- Thread.current[:appsignal_logger_attributes] = nil
169
- end
170
-
171
- def appsignal_attributes
172
- Thread.current.fetch(:appsignal_logger_attributes, {})
198
+ @appsignal_attributes = {}
173
199
  end
174
200
  end
175
201
  end
@@ -59,7 +59,11 @@ module Appsignal
59
59
  is_sidekiq7 = self.class.sidekiq7_and_greater?
60
60
  @adapter = is_sidekiq7 ? Sidekiq7Adapter : Sidekiq6Adapter
61
61
 
62
- config_string = " with config: #{config}" unless config.empty?
62
+ unless config.empty?
63
+ formatted_config =
64
+ config.map { |key, value| "#{key}: #{value.inspect}" }.join(", ")
65
+ config_string = " with config: #{formatted_config}"
66
+ end
63
67
  Appsignal.internal_logger.debug("Initializing Sidekiq probe#{config_string}")
64
68
  require "sidekiq/api"
65
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "4.2.1"
4
+ VERSION = "4.2.3"
5
5
  end
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.2.1
4
+ version: 4.2.3
5
5
  platform: java
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-04 00:00:00.000000000 Z
13
+ date: 2024-12-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger
@@ -327,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
327
  - !ruby/object:Gem::Version
328
328
  version: '0'
329
329
  requirements: []
330
- rubygems_version: 3.5.22
330
+ rubygems_version: 3.3.7
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Logs performance and exception data from your app to appsignal.com