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



21
22
23
# File 'lib/datadog/tracing/contrib/redis/patcher.rb', line 21

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

#datadog_targetObject



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

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