Sha256: 275076cd1d1934f86653f587d2c63362d2d5a607240bafeb8471868a9584d87e

Contents?: true

Size: 894 Bytes

Versions: 10

Compression:

Stored size: 894 Bytes

Contents

# encoding: utf-8

require 'ting_yun/agent'
require 'ting_yun/agent/method_tracer'

module TingYun
  module Instrumentation
    module Mongo2
      def self.install_mongo_command_log_subscriber
        require 'ting_yun/instrumentation/mongo_command_log_subscriber'
        ::Mongo::Monitoring::Global.subscribe(
            ::Mongo::Monitoring::COMMAND,
            TingYun::Instrumentation::MongoCommandLogSubscriber.new
        )
      end
    end
  end
end



TingYun::Support::LibraryDetection.defer do
  named :mongo2

  depends_on do
    require 'ting_yun/agent/datastore/mongo'
    defined?(::Mongo) && TingYun::Agent::Datastore::Mongo.unsupported_2x? && defined?(::Mongo::Monitoring::Global)
  end

  executes do
    TingYun::Agent.logger.info 'Installing Mongo2 instrumentation'
  end

  executes do
    TingYun::Instrumentation::Mongo2.install_mongo_command_log_subscriber
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tingyun_rpm-1.2.0 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.4.2 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.4.1 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.4 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.3 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.2 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.1 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.1.0 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.0.7 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.0.6 lib/ting_yun/instrumentation/mongo2.rb