123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Monitoring::Event::ServerHeartbeatFailed

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Mongo::Event::Base
Defined in: lib/mongo/monitoring/event/server_heartbeat_failed.rb

Overview

::Mongo::Monitoring::Event fired when a server heartbeat is dispatched.

Since:

  • 2.7.0

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::Mongo::Event::Base - Inherited

#summary

Returns a concise yet useful summary of the event.

#short_class_name

Constructor Details

.new(address, round_trip_time, error, started_event:, awaited: false) ⇒ ServerHeartbeatFailed

Create the event.

Examples:

Create the event.

ServerHeartbeatSucceeded.new(address, duration)

Parameters:

  • address (Address) —

    The server address.

  • round_trip_time (Float) —

    Duration of hello call in seconds.

  • awaited (true | false) —

    Whether the heartbeat was awaited.

  • started_event (Monitoring::Event::ServerHeartbeatStarted) —

    The corresponding started event.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 37

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

Instance Attribute Details

#address ⇒ Address (readonly)

Returns:

  • (Address) —

    address The server address.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 47

attr_reader :address

#awaited? ⇒ true | false (readonly)

Returns:

  • (true | false) —

    Whether the heartbeat was awaited.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 62

def awaited?
  @awaited
end

#duration (readonly)

Alias for #round_trip_time.

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 53

alias duration round_trip_time

#error ⇒ Exception (readonly) Also known as: #failure

Returns:

  • (Exception) —

    error The exception that occurred in hello call.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 56

attr_reader :error

#failure (readonly)

Alias for #error.

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 59

alias failure error

#round_trip_time ⇒ Float (readonly) Also known as: #duration

Returns:

  • (Float) —

    round_trip_time Duration of hello call in seconds.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 50

attr_reader :round_trip_time

#started_event ⇒ Monitoring::Event::ServerHeartbeatStarted (readonly)

Returns:

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 70

attr_reader :started_event

Instance Method Details

#summary ⇒ String

Note:

This method is experimental and subject to change.

Returns a concise yet useful summary of the event.

Returns:

  • (String) —

    String summary of the event.

Since:

  • 2.7.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/event/server_heartbeat_failed.rb', line 80

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