ActiveSupport Instrumentation is an API that allows developers to provide hooks that other developers may hook into. It can be used inside an application to measure specific actions that occur within Ruby code, such as inside a Rails application or the framework itself. With this API, developers can choose to notify when certain events occur inside their application or another piece of Ruby code.
Before
ActiveStorage provides the following instrumentation APIs,
- service_upload.active_storage
- service_streaming_download.active_storage
- service_download_chunk.active_storage
- service_download.active_storage
- service_delete.active_storage
- service_delete_prefixed.active_storage
- service_exist.active_storage
- service_url.active_storage
- service_update_metadata.active_storage
- preview.active_storage
- transform.active_storage
However, there are no APIs for ActiveStorage’s analyzer methods. After a file is attached, it’s queued for what is known as analyzing. There are many inbuilt analyzers such as ImageAnalyzer, VideoAnalyzer and more.
When using ActiveStorage instrumentation APIs, one would often see a jump between time spans when a file gets uploaded and stored. That jump is due to a missing Analyzer instrumentation API.
After
Thanks to
this PR,
the API now publishes events when running ActiveStorage analyzers.
The name of the new instrumentation event is analyze.active_storage
that returns the analyzer used to extract meta information from an ActiveStorage blog.
Key | Value |
---|---|
:analyzer |
Name of analyzer e.g., ffprobe |