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

Use ActiveSupport events to instrument ActiveSupport::Cache #3772

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Jul 9, 2024

Fixes #3607, fixes #3549, fixes #858

For tracing ActiveSupport::Cache, this PR moves away from monkey-patching to subscribing to ActiveSupport::Notifications events emitted by ActiveSupport Caching.

We are still required to keep some monkey-patching to ensure backwards compatibility, and to support a few specific methods in old versions of Rails.

Motivation:

This improves the maintainability of the instrumentation, given the events we subscribe to are Rails' public APIs.
It is also more consistent across different caching backends (e.g. Redis, Memcached), allowing us to simplify our implementation.

How to test the change?
All changes are covered in the test suite.

Signed-off-by: Marco Costa <marco.costa@datadoghq.com>
@marcotc marcotc self-assigned this Jul 9, 2024
@marcotc marcotc requested a review from a team as a code owner July 9, 2024 21:03
@github-actions github-actions bot added integrations Involves tracing integrations tracing labels Jul 9, 2024
@marcotc marcotc merged commit b428d21 into master Jul 10, 2024
168 checks passed
@marcotc marcotc deleted the read_multi branch July 10, 2024 17:42
@github-actions github-actions bot added this to the 2.2.0 milestone Jul 10, 2024
@TonyCTHsu TonyCTHsu mentioned this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment