Skip to content

Commit

Permalink
Worked on the jj22ee's comment and added logic that convert in second…
Browse files Browse the repository at this point in the history
…s only for rails 7.1 versions.
  • Loading branch information
ibnjunaid committed Aug 21, 2024
1 parent c5e7f56 commit 373b1ac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/aws-xray-sdk/facets/rails/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ def record(transaction)
subsegment = XRay.recorder.begin_subsegment name, namespace: 'remote'
# subsegment is nil in case of context missing
return if subsegment.nil?

subsegment.start_time = convert_time_in_seconds(transaction.time.to_f)
subsegment.start_time = (::Rails::VERSION::MAJOR == 7 and ::Rails::VERSION::MINOR == 1) ? convert_time_in_seconds(transaction.time.to_f) : transaction.time.to_f
subsegment.sql = sql
XRay.recorder.end_subsegment end_time: convert_time_in_seconds(transaction.end.to_f)
XRay.recorder.end_subsegment end_time: (::Rails::VERSION::MAJOR == 7 and ::Rails::VERSION::MINOR == 1) ? convert_time_in_seconds(transaction.end.to_f) : transaction.end.to_f
end

private
Expand Down

0 comments on commit 373b1ac

Please sign in to comment.