lib/mongo/monitoring/publishable.rb in mongo-2.4.0.rc1 vs lib/mongo/monitoring/publishable.rb in mongo-2.4.0

- old
+ new

@@ -53,10 +53,18 @@ command_failed(address, operation_id, payload, e.message, total_duration) raise e end end + def publish_event(topic, event) + monitoring.succeeded(topic, event) + end + + def publish_sdam_event(topic, event) + monitoring.succeeded(topic, event) if monitoring? + end + private def command_started(address, operation_id, payload) monitoring.started( Monitoring::COMMAND, @@ -98,9 +106,13 @@ Time.now - start end def error?(document) document && (document['ok'] == 0 || document.key?('$err')) + end + + def monitoring? + options[:monitoring] != false end end end end