Sha256: f4bada1b2ab5ef76d08c5f47e1bca048535320e5277827f2c23df603bc0c7914

Contents?: true

Size: 972 Bytes

Versions: 10

Compression:

Stored size: 972 Bytes

Contents

# Copyright (c) 2012 by Tracelytics, Inc.
# All rights reserved.
#

if defined?(Memcached)
  class Memcached
    include Oboe::API::Memcache

    MEMCACHE_OPS.reject { |m| not method_defined?(m) }.each do |m|
      define_method("#{m}_with_oboe") do |*args|
        opts = { :KVOp => m }
        if args.length and args[0].class != Array
            opts[:KVKey] = args[0].to_s
            rhost = remote_host(args[0].to_s)
            opts[:RemoteHost] = rhost if rhost
        end

        Oboe::API.trace('memcache', opts) do
          result = send("#{m}_without_oboe", *args)
          if m == :get and args.length and args[0].class == String
              Oboe::API.log('memcache', 'info', { :KVHit => memcache_hit?(result) })
          end
          result
        end
      end

      class_eval "alias #{m}_without_oboe #{m}"
      class_eval "alias #{m} #{m}_with_oboe"
    end
  end
  puts "[oboe/loading] Instrumenting memcached" if Oboe::Config[:verbose]
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
oboe-1.3.9.1 lib/oboe/inst/memcached.rb
oboe-1.3.8 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.0 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.1 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.2 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.3 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.4 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.5 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.6 lib/oboe/frameworks/rails/inst/memcached.rb
oboe-1.3.7 lib/oboe/frameworks/rails/inst/memcached.rb