Sha256: e5911fed59122c2d602b62c483b8beb839e719d8a89d3377e960590902cba4b4

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

# encoding: utf-8

require 'ting_yun/agent'
require 'ting_yun/instrumentation/support/method_instrumentation'

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
    !::TingYun::Agent.config[:disable_mongo]
  end

  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

7 entries across 7 versions & 1 rubygems

Version Path
tingyun_rpm-3.2.0 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.6.1 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.5.0 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.4.2 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.4.1 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.3.1 lib/ting_yun/instrumentation/mongo2.rb
tingyun_rpm-1.3.0 lib/ting_yun/instrumentation/mongo2.rb