Sha256: c99c185784fe2f10c7af202be51a4df099cbb40c686974c385e7fb1c4bd77a2b

Contents?: true

Size: 1012 Bytes

Versions: 17

Compression:

Stored size: 1012 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Activators
    class Dalli < Activator
      def can_instrument?
        defined?(::Dalli::Protocol::Base || defined?(::Dalli::Server)) &&
          defined?(::Dalli::Client) &&
          Instana.config[:dalli][:enabled]
      end

      def instrument
        require 'instana/instrumentation/dalli'
        dalli_version = Gem::Specification.find_by_name('dalli').version
        ::Dalli::Client.prepend ::Instana::Instrumentation::Dalli
        if dalli_version < Gem::Version.new('3.0')
          ::Dalli::Server.prepend ::Instana::Instrumentation::DalliRequestHandler
        elsif dalli_version >= Gem::Version.new('3.0') && dalli_version < Gem::Version.new('3.1.3')
          ::Dalli::Protocol::Binary.prepend ::Instana::Instrumentation::DalliRequestHandler
        else
          ::Dalli::Protocol::Base.prepend ::Instana::Instrumentation::DalliRequestHandler
        end

        true
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/activators/dalli.rb
instana-1.217.0 lib/instana/activators/dalli.rb
instana-1.216.0 lib/instana/activators/dalli.rb
instana-1.215.1 lib/instana/activators/dalli.rb
instana-1.215.0 lib/instana/activators/dalli.rb
instana-1.214.4 lib/instana/activators/dalli.rb
instana-1.214.3 lib/instana/activators/dalli.rb
instana-1.214.2 lib/instana/activators/dalli.rb
instana-1.214.1 lib/instana/activators/dalli.rb
instana-1.214.0 lib/instana/activators/dalli.rb
instana-1.213.3 lib/instana/activators/dalli.rb
instana-1.213.2 lib/instana/activators/dalli.rb
instana-1.213.1 lib/instana/activators/dalli.rb
instana-1.213.0 lib/instana/activators/dalli.rb
instana-1.212.0 lib/instana/activators/dalli.rb
instana-1.211.0 lib/instana/activators/dalli.rb
instana-1.210.1 lib/instana/activators/dalli.rb