class Mongo::Monitoring::Event::ServerHeartbeatFailed

Event fired when a server heartbeat is dispatched.

@since 2.7.0

Attributes

address[R]

@return [ Address ] address The server address.

duration[R]

@return [ Float ] round_trip_time Duration of hello call in seconds.

error[R]

@return [ Exception ] error The exception that occurred in hello call.

failure[R]

@return [ Exception ] error The exception that occurred in hello call.

round_trip_time[R]

@return [ Float ] round_trip_time Duration of hello call in seconds.

started_event[R]

@return [ Monitoring::Event::ServerHeartbeatStarted ]

The corresponding started event.

@api experimental

Public Class Methods

new(address, round_trip_time, error, awaited: false, started_event: ) click to toggle source

Create the event.

@example Create the event.

ServerHeartbeatSucceeded.new(address, duration)

@param [ Address ] address The server address. @param [ Float ] round_trip_time Duration of hello call in seconds. @param [ true | false ] awaited Whether the heartbeat was awaited. @param [ Monitoring::Event::ServerHeartbeatStarted ] started_event

The corresponding started event.

@since 2.7.0 @api private

# File lib/mongo/monitoring/event/server_heartbeat_failed.rb, line 40
def initialize(address, round_trip_time, error, awaited: false,
  started_event:
)
  @address = address
  @round_trip_time = round_trip_time
  @error = error
  @awaited = !!awaited
  @started_event = started_event
end

Public Instance Methods

awaited?() click to toggle source

@return [ true | false ] Whether the heartbeat was awaited.

# File lib/mongo/monitoring/event/server_heartbeat_failed.rb, line 66
def awaited?
  @awaited
end
summary() click to toggle source

Returns a concise yet useful summary of the event.

@return [ String ] String summary of the event.

@note This method is experimental and subject to change.

@since 2.7.0 @api experimental

# File lib/mongo/monitoring/event/server_heartbeat_failed.rb, line 84
def summary
  "#<#{short_class_name}" +
  " address=#{address}" +
  " error=#{error.inspect}>"
end