Method: Mongo::Monitoring::Event::CommandFailed#initialize

Defined in:
lib/mongo/monitoring/event/command_failed.rb

#initialize(command_name, database_name, address, request_id, operation_id, message, failure, duration, started_event:, service_id: nil) ⇒ CommandFailed

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 new event.

Examples:

Create the event.


Parameters:

  • command_name (String)

    The name of the command.

  • database_name (String)

    The database_name name.

  • address (Server::Address)

    The server address.

  • request_id (Integer)

    The request id.

  • operation_id (Integer)

    The operation id.

  • message (String)

    The error message.

  • failure (BSON::Document)

    The error document, if any.

  • duration (Float)

    The duration the command took in seconds.

  • started_event (Monitoring::Event::CommandStarted)

    The corresponding started event.

  • service_id (Object) (defaults to: nil)

    The service id, if any.

Since:

  • 2.1.0



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mongo/monitoring/event/command_failed.rb', line 82

def initialize(command_name, database_name, address,
  request_id, operation_id, message, failure, duration,
  started_event:, service_id: nil
)
  @command_name = command_name.to_s
  @database_name = database_name
  @address = address
  @request_id = request_id
  @operation_id = operation_id
  @service_id = service_id
  @message = message
  @started_event = started_event
  @failure = redacted(command_name, failure)
  @duration = duration
end