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)


53
54
55
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 53

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

.loaded?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 41

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

.redis_client_compatible?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 61

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

.redis_client_loaded?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 49

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

.redis_client_versionObject



37
38
39
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 37

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

.redis_compatible?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 57

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

.redis_loaded?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 45

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

.redis_versionObject



33
34
35
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 33

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.



29
30
31
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 29

def self.version
  redis_version || redis_client_version
end

Instance Method Details

#new_configurationObject



65
66
67
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 65

def new_configuration
  Configuration::Settings.new
end

#patcherObject



69
70
71
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 69

def patcher
  Patcher
end

#resolverObject



73
74
75
# File 'lib/datadog/tracing/contrib/redis/integration.rb', line 73

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