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

Fix Redis configuration pin #2363

Merged
merged 6 commits into from
Nov 14, 2022
Merged

Fix Redis configuration pin #2363

merged 6 commits into from
Nov 14, 2022

Conversation

TonyCTHsu
Copy link
Contributor

What does this PR do?

Current redis instrumentation is looking for pin on client object instead of the redis instance object. Hence it is different from the behavior the document claimed.

require 'redis'
require 'ddtrace'

Datadog.configure do |c|
  c.tracing.instrument :redis # Enabling integration instrumentation is still required
end

customer_cache = Redis.new
invoice_cache = Redis.new

Datadog.configure_onto(customer_cache, service_name: 'customer-cache')
Datadog.configure_onto(invoice_cache, service_name: 'invoice-cache')

# Traced call will belong to `customer-cache` service
customer_cache.get(...)
# Traced call will belong to `invoice-cache` service
invoice_cache.get(...)

The PR implements patches provide mean to delegate the pin the be accessible to the client object.

@TonyCTHsu TonyCTHsu requested a review from a team November 10, 2022 11:07
@TonyCTHsu TonyCTHsu self-assigned this Nov 10, 2022
@github-actions github-actions bot added integrations Involves tracing integrations tracing labels Nov 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2022

Codecov Report

Merging #2363 (b298998) into master (af16512) will decrease coverage by 0.00%.
The diff coverage is 83.51%.

@@            Coverage Diff             @@
##           master    #2363      +/-   ##
==========================================
- Coverage   98.34%   98.33%   -0.01%     
==========================================
  Files        1102     1101       -1     
  Lines       58929    58938       +9     
==========================================
+ Hits        57954    57959       +5     
- Misses        975      979       +4     
Impacted Files Coverage Δ
lib/datadog/core/configuration/settings.rb 97.51% <ø> (ø)
...filing/collectors/cpu_and_wall_time_worker_spec.rb 91.19% <71.42%> (-8.81%) ⬇️
spec/datadog/profiling/native_extension_spec.rb 96.80% <92.85%> (-0.70%) ⬇️
...g/profiling/collectors/cpu_and_wall_time_worker.rb 97.14% <100.00%> (ø)
...b/datadog/tracing/contrib/redis/instrumentation.rb 100.00% <100.00%> (ø)
lib/datadog/tracing/contrib/redis/patcher.rb 100.00% <100.00%> (ø)
spec/datadog/tracing/contrib/qless/support/job.rb 94.28% <100.00%> (ø)
spec/datadog/tracing/contrib/redis/miniapp_spec.rb 100.00% <100.00%> (+1.53%) ⬆️
spec/datadog/tracing/contrib/redis/redis_spec.rb 99.50% <100.00%> (ø)
lib/datadog/core/workers/polling.rb 96.55% <0.00%> (-3.45%) ⬇️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@TonyCTHsu TonyCTHsu merged commit 48de53c into master Nov 14, 2022
@TonyCTHsu TonyCTHsu deleted the tonycthsu/fix-redis-pin branch November 14, 2022 16:31
@github-actions github-actions bot added this to the 1.6.0 milestone Nov 14, 2022
@TonyCTHsu TonyCTHsu mentioned this pull request Nov 15, 2022
KJTsanaktsidis added a commit to zendesk/dd-trace-rb that referenced this pull request Nov 16, 2022
Comment on lines +24 to +26
options[:redis_instance] = self

super(options)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should prolly be

super(options.merge(redis_instance: self))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants