`ActiveSupport::Cache#read_multi` is not instrumented when using `ActiveSupport::Cache::RedisCacheStore`
Hello 👋
Current behaviour
When using Rails.cache.read_multi, using ActiveSupport::Cache::RedisCacheStore, the action is not instrumented. While read, write, fetch, write_multi and fetch_multi are.
This is because ActiveSupport::Cache::RedisCacheStore defines its own read_multi method, and we never go down into ddtrace wrapper method: https://github.com/rails/rails/blob/edbe4672e6b070ebaa5cd60810859e76c283a35a/activesupport/lib/active_support/cache/redis_cache_store.rb#L172
=> [#<Class:#<ActiveSupport::Cache::RedisCacheStore:0x000000013eb1ac30>>,
ActiveSupport::Cache::Strategy::LocalCache,
ActiveSupport::Cache::RedisCacheStore,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::Delete,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::WriteMulti,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::Write,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::FetchMulti,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::Fetch,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::ReadMulti,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::Read,
Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::InstanceMethods,
ActiveSupport::Cache::Store,
...
]
Expected behaviour
ActiveSupport::Cache::RedisCacheStore#read_multi is instrumented.
Environment
- datadog version: 1.21.1
- Relevant library versions:
- Rails 7.1.3.2
duplicate of #3549, I believe
Clearly linked. But in our case that's the other way around, as we have rails > 5.2 and don't use activesupport-redis, that's what I wanted to put in light. In our case, only ActiveSupport::Cache::Store is patched, and not ActiveSupport::Cache::RedisCacheStore
ah, yes - you are correct
We just released v2.2.0. Give it a try!