Class: Datadog::Tracing::Contrib::Sidekiq::Integration

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

Overview

Description of Sidekiq integration

Constant Summary collapse

MINIMUM_VERSION =
Gem::Version.new('3.5.4')
MINIMUM_SERVER_INTERNAL_TRACING_VERSION =
Gem::Version.new('5.2.4')
MINIMUM_CAPSULE_VERSION =
Gem::Version.new('7.0.0')

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Integration

included

Class Method Details

.compatible?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 30

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

.compatible_with_server_internal_tracing?Boolean

Only patch server internals on v5.2.4+ because that’s when loading of ‘Sidekiq::Launcher` stabilized. Sidekiq 4+ technically can support our patches (with minor adjustments), but in order to avoid explicitly requiring `sidekiq/launcher` ourselves (which could affect gem initialization order), we are limiting this tracing to v5.2.4+.

Returns:

  • (Boolean)


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

def self.compatible_with_server_internal_tracing?
  version >= MINIMUM_SERVER_INTERNAL_TRACING_VERSION
end

.loaded?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 26

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

.supports_capsules?Boolean

Capsules are a new way of configuring Sidekiq that was introduced in version 7 that change the way some of the configuration data is exposed. Certain patches are applied differently for versions of Sidekiq that support capsules.

Returns:

  • (Boolean)


46
47
48
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 46

def self.supports_capsules?
  version >= MINIMUM_CAPSULE_VERSION
end

.versionObject



22
23
24
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 22

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

Instance Method Details

#new_configurationObject



50
51
52
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 50

def new_configuration
  Configuration::Settings.new
end

#patcherObject



54
55
56
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 54

def patcher
  Patcher
end