Open
Description
ActiveRecord
7.1 introduced async query methods1, which leverages concurrency primitives via Promise
API to defer executing queries.
We would like to enrich ActiveRecord
related spans to know whether or not they were executed from the async context.
Additional Notes
The sql.active_record
notification payload includes a async
attribute:
https://github.com/rails/rails/blob/616d3a7675c18ae2d38d3116de47e2e7308cfbd8/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1135
We may be able to enrich the ActiveRecord
span and amend it as a Shared DB attribute for the driver itself however we do not currently use notifications in this instrumentation.
Worst case scenario, we monkey patch existing async
methods, concurrency primitives.