Class: Datadog::Tracing::Contrib::Redis::Integration

Inherits:
Object
  • Object
show all
Includes:
Integration
Defined in:
lib/datadog/tracing/contrib/redis/integration.rb

Overview

Description of Redis integration

Constant Summary collapse

MINIMUM_VERSION =
Gem::Version.new('3.2')
REDISCLIENT_MINIMUM_VERSION =
Gem::Version.new('0.11.0')

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Integration

included

Class Method Details

.compatible?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 51

def self.compatible?
  super && (redis_compatible? || redis_client_compatible?)
end

.loaded?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 39

def self.loaded?
  redis_loaded? || redis_client_loaded?
end

.redis_client_compatible?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 59

def self.redis_client_compatible?
  !!(redis_client_version && redis_client_version >= REDISCLIENT_MINIMUM_VERSION)
end

.redis_client_loaded?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 47

def self.redis_client_loaded?
  !defined?(::RedisClient).nil?
end

.redis_client_versionObject



35
36
37
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 35

def self.redis_client_version
  Gem.loaded_specs['redis-client'] && Gem.loaded_specs['redis-client'].version
end

.redis_compatible?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 55

def self.redis_compatible?
  !!(redis_version && redis_version >= MINIMUM_VERSION)
end

.redis_loaded?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 43

def self.redis_loaded?
  !defined?(::Redis).nil?
end

.redis_versionObject



31
32
33
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 31

def self.redis_version
  Gem.loaded_specs['redis'] && Gem.loaded_specs['redis'].version
end

.versionObject

Until Redis 4, all instrumentation happened in one gem: redis. Since Redis 5, instrumentation happens in a separate gem: redis-client. Because Redis 4 does not depend on redis-client, it’s possible for both gems to be installed at the same time. For example, if Sidekiq 7 and Redis 4 are installed: both redis and redis-client will be installed. If redis-client and redis > 5 are installed, than they will be in sync, and only redis-client will be installed.



27
28
29
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 27

def self.version
  redis_version || redis_client_version
end

Instance Method Details

#new_configurationObject



63
64
65
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 63

def new_configuration
  Configuration::Settings.new
end

#patcherObject



67
68
69
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 67

def patcher
  Patcher
end

#resolverObject



71
72
73
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 71

def resolver
  @resolver ||= Configuration::Resolver.new
end