Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveSupport::Cache#read_multi is not instrumented when using ActiveSupport::Cache::RedisCacheStore #3607

Closed
beauraF opened this issue Apr 22, 2024 · 4 comments · Fixed by #3772
Labels
bug Involves a bug community Was opened by a community member

Comments

@beauraF
Copy link

beauraF commented Apr 22, 2024

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
@beauraF beauraF added bug Involves a bug community Was opened by a community member labels Apr 22, 2024
@naveg
Copy link

naveg commented Apr 23, 2024

duplicate of #3549, I believe

@beauraF
Copy link
Author

beauraF commented Apr 25, 2024

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

@naveg
Copy link

naveg commented Apr 26, 2024

ah, yes - you are correct

@TonyCTHsu
Copy link
Contributor

We just released v2.2.0. Give it a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug community Was opened by a community member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants