appsignal 4.2.0-java → 4.2.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6bfdc67475b0305ea6351a4d7ef572bbbd10a6e99db4eb7693bd371fb886b68
4
- data.tar.gz: a2f57f3c3604fb05953949114cf2e3a315c0ab61af40c0d50ee59a2a0c23a87a
3
+ metadata.gz: 593b01e03ea19eab757769a49b167a62ffba836cb76cbd042905a8612801cd26
4
+ data.tar.gz: 40a601b88ad6f2922ed089aee5c2775a9f232a446cf45a2e749b710763672f50
5
5
  SHA512:
6
- metadata.gz: 313fd85eabe8246bd2a9c6c98865cf67ae7674d42ef0f6ef0787429ae14b054c51050a40184c157f0cbb8586613937aedd1447cf672c6d911feaed6faaba408c
7
- data.tar.gz: 1243f5f9894c7c7750bbd991a4e9dc7b6b8c5d80f4fd68e77798cccb97b41dc7efd7039e4e3176178f9fda0804c67643f2770098d34ff8c4105f8005320a6799
6
+ metadata.gz: 42dbba0d05e86174731ba923bb17f166b1aa20e022ac0e4132facb3dc6e4b7559b116042648956dc913491e80befec5e84d154a0446cda9d8fb390c1f14d8568
7
+ data.tar.gz: efa4ee5f181c43a483845ab92dc641aa11e23a19e375931f44a7e0d33811caf5a1f0f41fcb71010f0ae67efb35cb87577004f01563ce1557dafa6a3dd8423b7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 4.2.2
4
+
5
+ _Published on 2024-12-16._
6
+
7
+ ### Added
8
+
9
+ - 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.
10
+
11
+ ```ruby
12
+ Rails.logger.tagged(["Tag 1", "Tag 2"]) { Rails.logger.info("My message") }
13
+ ```
14
+
15
+ Reports this log message:
16
+
17
+ > [Tag 1] [Tag 2] My message
18
+
19
+ (patch [41e1e8f0](https://github.com/appsignal/appsignal-ruby/commit/41e1e8f076025da2420cb43c53b5f7211ae45de8))
20
+
21
+ ### Fixed
22
+
23
+ - 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))
24
+
25
+ ## 4.2.1
26
+
27
+ _Published on 2024-12-04._
28
+
29
+ ### Changed
30
+
31
+ - Minimize difference between Rack transaction duration and total child event durations. (patch [95c37802](https://github.com/appsignal/appsignal-ruby/commit/95c3780291241fa6de8d2c0ae9bb09d3ce42d18d))
32
+
3
33
  ## 4.2.0
4
34
 
5
35
  _Published on 2024-11-13._
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
@@ -59,6 +59,7 @@ module Appsignal
59
59
  return unless request_handler?(request.env[APPSIGNAL_EVENT_HANDLER_ID])
60
60
 
61
61
  transaction = Appsignal::Transaction.create(Appsignal::Transaction::HTTP_REQUEST)
62
+ transaction.start_event
62
63
  request.env[APPSIGNAL_TRANSACTION] = transaction
63
64
 
64
65
  request.env[RACK_AFTER_REPLY] ||= []
@@ -83,7 +84,6 @@ module Appsignal
83
84
  # One such scenario is when a Puma "lowlevel_error" occurs.
84
85
  Appsignal::Transaction.complete_current!
85
86
  end
86
- transaction.start_event
87
87
  end
88
88
  end
89
89
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "4.2.0"
4
+ VERSION = "4.2.2"
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.0
4
+ version: 4.2.2
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-11-13 00:00:00.000000000 Z
13
+ date: 2024-12-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger