Module: Mongo::Monitoring::Publishable

Includes:
Loggable
Included in:
Cluster, Cluster::Topology::Base, Server, Server::Connection, Server::ConnectionBase, Server::ConnectionPool
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



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

def monitoring
  @monitoring
end

Instance Method Details

#publish_cmap_event(event) ⇒ Object

Since:

  • 2.1.0



41
42
43
44
45
# File 'lib/mongo/monitoring/publishable.rb', line 41

def publish_cmap_event(event)
  return unless monitoring?

  monitoring.published(Monitoring::CONNECTION_POOL, event)
end

#publish_event(topic, event) ⇒ Object

Deprecated.

Since:

  • 2.1.0



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

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

#publish_sdam_event(topic, event) ⇒ Object

Since:

  • 2.1.0



35
36
37
38
39
# File 'lib/mongo/monitoring/publishable.rb', line 35

def publish_sdam_event(topic, event)
  return unless monitoring?

  monitoring.succeeded(topic, event)
end