File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ class ApplicationJob < ActiveJob::Base
66 # discard_on ActiveJob::DeserializationError
77
88 # Make sure to capture and record any exceptions that occur in jobs.
9- rescue_from ( Exception ) do |error |
9+ # Uses around_perform rather than rescue_from so that the OTel span is still
10+ # open when we annotate it — rescue_from runs after the instrumentation has
11+ # already ended the span.
12+ around_perform do |_job , block |
13+ block . call
14+ rescue Exception => error # standard:disable Lint/RescueException
1015 span = OpenTelemetry ::Trace . current_span
1116 span . status = OpenTelemetry ::Trace ::Status . error ( error . message )
1217 span . set_attribute ( "job.class" , self . class . name )
@@ -19,7 +24,6 @@ class ApplicationJob < ActiveJob::Base
1924 error
2025 )
2126
22- # Re-raise the exception to be handled by the job framework (SolidQueue).
23- raise error
27+ raise
2428 end
2529end
You can’t perform that action at this time.
0 commit comments