Sha256: 7cb00e87f243dc87affc019a8e925098e9287bfb437f20635b3c94a6c780d8ea

Contents?: true

Size: 826 Bytes

Versions: 6

Compression:

Stored size: 826 Bytes

Contents

# encoding: utf-8

require 'ting_yun/agent/datastore/metric_helper'
require 'ting_yun/agent/method_tracer_helpers'


module TingYun
  module Agent
    module Datastore
      def self.wrap(product, operation, collection = nil, ip_address = nil, port = nil, dbname=nil,  callback = nil )
        return yield unless operation

        klass_name, *metrics = TingYun::Agent::Datastore::MetricHelper.metrics_for(product, operation, ip_address , port, dbname,collection )
        TingYun::Agent::MethodTracerHelpers.trace_execution_scoped(metrics, {}, nil, klass_name) do
          t0 = Time.now
          begin
            yield
          ensure
            elapsed_time = (Time.now - t0).to_f
            if callback
              callback.call(elapsed_time)
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tingyun_rpm-1.6.1 lib/ting_yun/agent/datastore.rb
tingyun_rpm-1.5.0 lib/ting_yun/agent/datastore.rb
tingyun_rpm-1.4.2 lib/ting_yun/agent/datastore.rb
tingyun_rpm-1.4.1 lib/ting_yun/agent/datastore.rb
tingyun_rpm-1.3.1 lib/ting_yun/agent/datastore.rb
tingyun_rpm-1.3.0 lib/ting_yun/agent/datastore.rb