dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

Add Rails cache store instrumentation filter

Open marcotc opened this issue 6 months ago • 3 comments

What does this PR do?

This PR introduces a new :cache_store configuration option to the ActiveSupport integration. This option allows users to specify which cache stores should be instrumented by Datadog tracing.

Motivation:

This is important for very fast backends, like MemoryStore, which might not provide useful spans.

Change log entry Yes. Add :cache_store option to ActiveSupport integration to allow tracing only specified cache backends.

Additional Notes:

  • The option accepts both strings and symbols (e.g., ['file_store', :memory_store]).
  • The default remains unchanged: all cache stores are traced unless this option is set.

How to test the change?

  • Run the test suite, especially the integration tests for ActiveSupport cache instrumentation.
  • Tests cover scenarios where :cache_store includes, excludes, or is unset for various backends.
  • Manual validation: configure Datadog.configure { |c| c.tracing.instrument :active_support, cache_store: [:file_store] } and verify that only the specified store is traced.

marcotc avatar May 28 '25 19:05 marcotc

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.53%. Comparing base (de32d48) to head (2516895). Report is 125 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4693      +/-   ##
==========================================
- Coverage   97.53%   97.53%   -0.01%     
==========================================
  Files        1484     1484              
  Lines       88624    88660      +36     
  Branches     4598     4602       +4     
==========================================
+ Hits        86443    86475      +32     
- Misses       2181     2185       +4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar May 28 '25 19:05 codecov-commenter

Datadog Report

Branch report: mem-store Commit report: c1ef3f8 Test service: dd-trace-rb

:white_check_mark: 0 Failed, 21505 Passed, 1298 Skipped, 4m 7.22s Total Time

Benchmarks

Benchmark execution time: 2025-07-08 16:23:05

Comparing candidate commit 251689586060e82898aae509d40bc144be9ef3c5 in PR branch mem-store with baseline commit de32d48c8fa1a91ffc4ae8f75426774628c3205a in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 42 metrics, 6 unstable metrics.

scenario:tracing - Propagation - Trace Context

  • 🟥 throughput [-4073.598op/s; -3966.631op/s] or [-10.971%; -10.683%]

pr-commenter[bot] avatar May 28 '25 19:05 pr-commenter[bot]