Class: Mongo::Monitoring::Event::CommandFailed
- Inherits:
-
Event::Base
- Object
- Event::Base
- Mongo::Monitoring::Event::CommandFailed
- Defined in:
- lib/mongo/monitoring/event/command_failed.rb
Overview
Event that is fired when a command operation fails.
Instance Attribute Summary collapse
-
#address ⇒ Server::Address
readonly
Address The server address.
-
#command_name ⇒ String
readonly
Command_name The name of the command.
-
#database_name ⇒ String
readonly
Database_name The name of the database_name.
-
#duration ⇒ Float
readonly
Duration The duration of the command in seconds.
-
#failure ⇒ BSON::Document
readonly
Failure The error document, if present.
-
#message ⇒ String
readonly
Message The error message.
-
#operation_id ⇒ Integer
readonly
Operation_id The operation id.
-
#request_id ⇒ Integer
readonly
Request_id The request id.
Class Method Summary collapse
-
.generate(address, operation_id, payload, message, failure, duration) ⇒ CommandFailed
private
Create the event from a wire protocol message payload.
Instance Method Summary collapse
-
#initialize(command_name, database_name, address, request_id, operation_id, message, failure, duration) ⇒ CommandFailed
constructor
private
Create the new event.
Methods inherited from Event::Base
Constructor Details
#initialize(command_name, database_name, address, request_id, operation_id, message, failure, duration) ⇒ 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.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 67 def initialize(command_name, database_name, address, request_id, operation_id, , failure, duration) @command_name = command_name.to_s @database_name = database_name @address = address @request_id = request_id @operation_id = operation_id @message = @failure = failure @duration = duration end |
Instance Attribute Details
#address ⇒ Server::Address (readonly)
Returns address The server address.
25 26 27 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 25 def address @address end |
#command_name ⇒ String (readonly)
Returns command_name The name of the command.
28 29 30 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 28 def command_name @command_name end |
#database_name ⇒ String (readonly)
Returns database_name The name of the database_name.
31 32 33 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 31 def database_name @database_name end |
#duration ⇒ Float (readonly)
Returns duration The duration of the command in seconds.
34 35 36 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 34 def duration @duration end |
#failure ⇒ BSON::Document (readonly)
Returns failure The error document, if present. This will only be filled out for errors communicated by a MongoDB server. In other situations, for example in case of a network error, this attribute may be nil.
40 41 42 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 40 def failure @failure end |
#message ⇒ String (readonly)
Returns message The error message. Unlike the error document, the error message should always be present.
44 45 46 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 44 def @message end |
#operation_id ⇒ Integer (readonly)
Returns operation_id The operation id.
47 48 49 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 47 def operation_id @operation_id end |
#request_id ⇒ Integer (readonly)
Returns request_id The request id.
50 51 52 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 50 def request_id @request_id end |
Class Method Details
.generate(address, operation_id, payload, message, failure, duration) ⇒ 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 event from a wire protocol message payload.
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/mongo/monitoring/event/command_failed.rb', line 94 def self.generate(address, operation_id, payload, , failure, duration) new( payload[:command_name], payload[:database_name], address, payload[:request_id], operation_id, , failure, duration ) end |