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)


28
29
30
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 28

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)


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

def self.compatible_with_server_internal_tracing?
  version >= MINIMUM_SERVER_INTERNAL_TRACING_VERSION
end

.loaded?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 24

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)


44
45
46
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 44

def self.supports_capsules?
  version >= MINIMUM_CAPSULE_VERSION
end

.versionObject



20
21
22
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 20

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

Instance Method Details

#new_configurationObject



48
49
50
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 48

def new_configuration
  Configuration::Settings.new
end

#patcherObject



52
53
54
# File 'lib/datadog/tracing/contrib/sidekiq/integration.rb', line 52

def patcher
  Patcher
end