Module: Datadog::Tracing::Contrib::Redis::Patcher::DatadogPinPatch::InstanceMethods

Defined in:
lib/datadog/tracing/contrib/redis/patcher.rb

Overview

Instance method patch for redis instance

Instance Method Summary collapse

Instance Method Details

#datadog_pin=(pin) ⇒ Object



23
24
25
# File 'lib/datadog/tracing/contrib/redis/patcher.rb', line 23

def datadog_pin=(pin)
  pin.onto(datadog_target)
end

#datadog_targetObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/datadog/tracing/contrib/redis/patcher.rb', line 27

def datadog_target
  # For `redis-rb` 4.x
  return _client if respond_to?(:_client)
  # For `redis-rb` 3.x
  return client if respond_to?(:client)

  Datadog.logger.warn 'Fail to apply configuration on redis client instance with '  \
                                          '`Datadog.configure_onto(redis)`.'

  # Null object instead of raising error
  self
end