appsignal 5.0.3-java → 5.0.4-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 +8 -0
- data/lib/appsignal/rack/event_handler.rb +36 -27
- data/lib/appsignal/transaction/opentelemetry_backend.rb +1 -0
- data/lib/appsignal/transaction.rb +21 -17
- data/lib/appsignal/version.rb +1 -1
- data/sig/appsignal.rbi +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8cbb7e4a2eea9564a48fa144018d1d6b2a3a0071145dbb83667e1f35dd79ced2
|
|
4
|
+
data.tar.gz: 94ca97dc758b43867456f9ca351085ba0f43945d55c94ef777d83af89a77c2d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a78c3d8478e1be4f5ba71a555042be872889ceec267b7fa623068059cdf928434141f19ae4635ffd7b0fe8d14ffc075266d1b95db36655dbaebde41bd381c8cb
|
|
7
|
+
data.tar.gz: c848362c51a845da9b0f5be46180d857b14a58152765664d24abdf89244fb4c7efe9569a18dda2a3549e04cbb21465468eef5d6fd12164c8c5e73954f777921f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.4
|
|
4
|
+
|
|
5
|
+
_Published on 2026-10-09._
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fix an issue where transactions would be reused across requests when an error happened before the transaction could be closed, which would lead to errors being returned by the app itself. (patch [65ff0be0](https://github.com/appsignal/appsignal-ruby/commit/65ff0be0c3d4dea2eb9ed5bdb81004e899e6edf4))
|
|
10
|
+
|
|
3
11
|
## 5.0.3
|
|
4
12
|
|
|
5
13
|
_Published on 2026-10-08._
|
|
@@ -37,6 +37,15 @@ module Appsignal
|
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# @api private
|
|
41
|
+
def self.complete_transaction(transaction)
|
|
42
|
+
safe_execution("Appsignal::Rack::EventHandler#complete_transaction") do
|
|
43
|
+
transaction.complete
|
|
44
|
+
end
|
|
45
|
+
ensure
|
|
46
|
+
Appsignal::Transaction.clear_current_transaction!
|
|
47
|
+
end
|
|
48
|
+
|
|
40
49
|
# @api private
|
|
41
50
|
attr_reader :id
|
|
42
51
|
attr_writer :using_appsignal_event_middleware
|
|
@@ -68,29 +77,7 @@ module Appsignal
|
|
|
68
77
|
:opentelemetry_context => Appsignal::OpenTelemetry.extract_rack_context(request.env),
|
|
69
78
|
:opentelemetry_scope => ["appsignal-ruby/rack", Appsignal::VERSION]
|
|
70
79
|
)
|
|
71
|
-
#
|
|
72
|
-
# Together with the SERVER span kind the transaction already carries,
|
|
73
|
-
# this is what the trace timeline reads to recognize a web request.
|
|
74
|
-
#
|
|
75
|
-
# Set before the event below starts, because attributes go on
|
|
76
|
-
# whichever span is open and these belong on the transaction's own
|
|
77
|
-
# span. That event stays open until the response finishes, so there is
|
|
78
|
-
# no later point in the request at which these could be set.
|
|
79
|
-
transaction.add_opentelemetry_attributes(
|
|
80
|
-
Appsignal::OpenTelemetry::HttpServerRequest.attributes_for(
|
|
81
|
-
:method => Appsignal::Rack::Utils.request_method_from(request),
|
|
82
|
-
:path => Appsignal::Rack::Utils.request_value_from(request, :path),
|
|
83
|
-
:scheme => Appsignal::Rack::Utils.request_value_from(request, :scheme),
|
|
84
|
-
:query => Appsignal::Rack::Utils.request_value_from(request, :query_string),
|
|
85
|
-
:host => Appsignal::Rack::Utils.request_value_from(request, :hostname),
|
|
86
|
-
:port => Appsignal::Rack::Utils.request_value_from(request, :port),
|
|
87
|
-
:protocol =>
|
|
88
|
-
Appsignal::Rack::Utils.request_env_value_from(request, "SERVER_PROTOCOL")
|
|
89
|
-
)
|
|
90
|
-
)
|
|
91
|
-
transaction.start_event(
|
|
92
|
-
:opentelemetry_scope => ["appsignal-ruby/rack", Appsignal::VERSION]
|
|
93
|
-
)
|
|
80
|
+
# Register cleanup before request instrumentation can raise.
|
|
94
81
|
request.env[APPSIGNAL_TRANSACTION] = transaction
|
|
95
82
|
|
|
96
83
|
request.env[RACK_AFTER_REPLY] ||= []
|
|
@@ -113,9 +100,32 @@ module Appsignal
|
|
|
113
100
|
# just a fallback if that doesn't get called.
|
|
114
101
|
#
|
|
115
102
|
# One such scenario is when a Puma "lowlevel_error" occurs.
|
|
116
|
-
transaction
|
|
117
|
-
Appsignal::Transaction.clear_current_transaction!
|
|
103
|
+
Appsignal::Rack::EventHandler.complete_transaction(transaction)
|
|
118
104
|
end
|
|
105
|
+
|
|
106
|
+
# Describes the transaction's span as an incoming HTTP request.
|
|
107
|
+
# Together with the SERVER span kind the transaction already carries,
|
|
108
|
+
# this is what the trace timeline reads to recognize a web request.
|
|
109
|
+
#
|
|
110
|
+
# Set before the event below starts, because attributes go on
|
|
111
|
+
# whichever span is open and these belong on the transaction's own
|
|
112
|
+
# span. That event stays open until the response finishes, so there is
|
|
113
|
+
# no later point in the request at which these could be set.
|
|
114
|
+
transaction.add_opentelemetry_attributes(
|
|
115
|
+
Appsignal::OpenTelemetry::HttpServerRequest.attributes_for(
|
|
116
|
+
:method => Appsignal::Rack::Utils.request_method_from(request),
|
|
117
|
+
:path => Appsignal::Rack::Utils.request_value_from(request, :path),
|
|
118
|
+
:scheme => Appsignal::Rack::Utils.request_value_from(request, :scheme),
|
|
119
|
+
:query => Appsignal::Rack::Utils.request_value_from(request, :query_string),
|
|
120
|
+
:host => Appsignal::Rack::Utils.request_value_from(request, :hostname),
|
|
121
|
+
:port => Appsignal::Rack::Utils.request_value_from(request, :port),
|
|
122
|
+
:protocol =>
|
|
123
|
+
Appsignal::Rack::Utils.request_env_value_from(request, "SERVER_PROTOCOL")
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
transaction.start_event(
|
|
127
|
+
:opentelemetry_scope => ["appsignal-ruby/rack", Appsignal::VERSION]
|
|
128
|
+
)
|
|
119
129
|
end
|
|
120
130
|
end
|
|
121
131
|
|
|
@@ -188,8 +198,7 @@ module Appsignal
|
|
|
188
198
|
|
|
189
199
|
# Make sure the current transaction is always closed when the request
|
|
190
200
|
# is finished
|
|
191
|
-
transaction
|
|
192
|
-
Appsignal::Transaction.clear_current_transaction!
|
|
201
|
+
self.class.complete_transaction(transaction)
|
|
193
202
|
end
|
|
194
203
|
|
|
195
204
|
private
|
|
@@ -316,26 +316,30 @@ module Appsignal
|
|
|
316
316
|
return
|
|
317
317
|
end
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
report_errors
|
|
319
|
+
begin
|
|
320
|
+
# If the transaction is a duplicate, we don't want to finish it,
|
|
321
|
+
# because we want its finish time to be the finish time of the
|
|
322
|
+
# original transaction.
|
|
323
|
+
# Duplicate transactions should always be sampled, as we only
|
|
324
|
+
# create duplicates for errors, which are always sampled.
|
|
325
|
+
should_sample = true
|
|
326
|
+
|
|
327
|
+
unless duplicate?
|
|
328
|
+
self.class.last_errors = @errors.to_a
|
|
329
|
+
should_sample = @backend.finish
|
|
330
|
+
end
|
|
332
331
|
|
|
333
|
-
|
|
332
|
+
report_errors
|
|
334
333
|
|
|
335
|
-
|
|
334
|
+
run_before_complete_hooks
|
|
336
335
|
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
sample_data if should_sample
|
|
337
|
+
ensure
|
|
338
|
+
# Release backend resources even when sample data cannot be collected
|
|
339
|
+
# or serialized. In collector mode this also detaches the span context.
|
|
340
|
+
@completed = true
|
|
341
|
+
@backend.complete
|
|
342
|
+
end
|
|
339
343
|
end
|
|
340
344
|
|
|
341
345
|
# @!visibility private
|
data/lib/appsignal/version.rb
CHANGED
data/sig/appsignal.rbi
CHANGED