Module: Mongo::Monitoring::Publishable

Includes:
Loggable
Included in:
Cluster, Cluster::Topology::Base, Server, Server::Connection, Server::ConnectionBase
Defined in:
lib/mongo/monitoring/publishable.rb

Overview

Defines behavior for an object that can publish monitoring events.

Since:

  • 2.1.0

Constant Summary

Constants included from Loggable

Loggable::PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Instance Attribute Details

#monitoringMonitoring (readonly)

Returns monitoring The monitoring.

Returns:

Since:

  • 2.1.0



25
26
27
# File 'lib/mongo/monitoring/publishable.rb', line 25

def monitoring
  @monitoring
end

Instance Method Details

#publish_event(topic, event) ⇒ Object

Since:

  • 2.1.0



27
28
29
# File 'lib/mongo/monitoring/publishable.rb', line 27

def publish_event(topic, event)
  monitoring.succeeded(topic, event)
end

#publish_sdam_event(topic, event) ⇒ Object

Since:

  • 2.1.0



31
32
33
34
35
36
# File 'lib/mongo/monitoring/publishable.rb', line 31

def publish_sdam_event(topic, event)
  return unless monitoring?

  log_debug("EVENT: #{event.summary}")
  monitoring.succeeded(topic, event)
end