Class: Datadog::Tracing::Contrib::ActiveRecord::Integration

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

Overview

Describes the ActiveRecord integration

Constant Summary collapse

MINIMUM_VERSION =
Contrib::Rails::Ext::MINIMUM_VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Integration

included

Class Method Details

.compatible?Boolean

Returns:

  • (Boolean)


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

def self.compatible?
  super && version >= MINIMUM_VERSION
end

.loaded?Boolean

Returns:

  • (Boolean)


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

def self.loaded?
  !defined?(::ActiveRecord).nil?
end

.versionObject



25
26
27
# File 'lib/datadog/tracing/contrib/active_record/integration.rb', line 25

def self.version
  Gem.loaded_specs['activerecord'] && Gem.loaded_specs['activerecord'].version
end

Instance Method Details

#auto_instrument?Boolean

enabled by rails integration so should only auto instrument if detected that it is being used without rails

Returns:

  • (Boolean)


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

def auto_instrument?
  !Contrib::Rails::Utils.railtie_supported?
end

#new_configurationObject



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

def new_configuration
  Configuration::Settings.new
end

#patcherObject



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

def patcher
  ActiveRecord::Patcher
end

#reset_resolver_cacheObject



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

def reset_resolver_cache
  @resolver&.reset_cache
end

#resolverObject



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

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