Sha256: 47ee5a3091c682b2cea11174e00761170ca6dca178efe2300b28eb750362f237

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# typed: false
require 'ddtrace/contrib/integration'
require 'ddtrace/contrib/configuration/resolvers/pattern_resolver'
require 'ddtrace/contrib/mongodb/configuration/settings'
require 'ddtrace/contrib/mongodb/patcher'

module Datadog
  module Contrib
    module MongoDB
      # Description of MongoDB integration
      class Integration
        include Contrib::Integration

        MINIMUM_VERSION = Gem::Version.new('2.1.0')

        register_as :mongo, auto_patch: true

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

        def self.loaded?
          !defined?(::Mongo::Monitoring::Global).nil?
        end

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

        def default_configuration
          Configuration::Settings.new
        end

        def patcher
          Patcher
        end

        def resolver
          @resolver ||= Contrib::Configuration::Resolvers::PatternResolver.new
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-0.54.2 lib/ddtrace/contrib/mongodb/integration.rb
ddtrace-0.54.1 lib/ddtrace/contrib/mongodb/integration.rb
ddtrace-0.54.0 lib/ddtrace/contrib/mongodb/integration.rb