Class: Mongo::Monitoring::Event::ServerHeartbeatSucceeded

Inherits:
Event::Base
  • Object
show all
Defined in:
lib/mongo/monitoring/event/server_heartbeat_succeeded.rb

Overview

Event fired when a server heartbeat is dispatched.

Since:

  • 2.7.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, round_trip_time, awaited: false) ⇒ ServerHeartbeatSucceeded

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create the event.

Examples:

Create the event.

ServerHeartbeatSucceeded.new(address, duration)

Since:

  • 2.7.0



49
50
51
52
53
# File 'lib/mongo/monitoring/event/server_heartbeat_succeeded.rb', line 49

def initialize(address, round_trip_time, awaited: false)
  @address = address
  @round_trip_time = round_trip_time
  @awaited = !!awaited
end

Instance Attribute Details

#addressAddress (readonly)

Returns address The server address.

Since:

  • 2.7.0



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

def address
  @address
end

#round_trip_timeFloat (readonly) Also known as: duration

Returns round_trip_time Duration of ismaster call in seconds.

Since:

  • 2.7.0



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

def round_trip_time
  @round_trip_time
end

Instance Method Details

#awaited?true | false

Returns Whether the heartbeat was awaited.

Since:

  • 2.7.0



34
35
36
# File 'lib/mongo/monitoring/event/server_heartbeat_succeeded.rb', line 34

def awaited?
  @awaited
end

#summaryString

Note:

This method is experimental and subject to change.

Returns a concise yet useful summary of the event.

Since:

  • 2.7.0



63
64
65
66
# File 'lib/mongo/monitoring/event/server_heartbeat_succeeded.rb', line 63

def summary
  "#<#{short_class_name}" +
  " address=#{address}>"
end