Class: Mongo::Monitoring::Event::CommandFailed
- Inherits:
-
Event::Base
- Object
- Event::Base
- Mongo::Monitoring::Event::CommandFailed
- Includes:
- Secure
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb
Overview
Event that is fired when a command operation fails.
Constant Summary
Constants included from Secure
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.
-
#server_connection_id ⇒ Integer
readonly
Server_connection_id The server connection id.
-
#service_id ⇒ nil | Object
readonly
The service id, if any.
-
#started_event ⇒ Monitoring::Event::CommandStarted
readonly
private
Started_event The corresponding started event.
Class Method Summary collapse
-
.generate(address, operation_id, payload, message, failure, duration, started_event:, server_connection_id: nil, service_id: nil) ⇒ 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, started_event:, server_connection_id: nil, service_id: nil) ⇒ CommandFailed
constructor
private
Create the new event.
-
#summary ⇒ String
Returns a concise yet useful summary of the event.
Methods included from Secure
#compression_allowed?, #redacted, #sensitive?
Constructor Details
#initialize(command_name, database_name, address, request_id, operation_id, message, failure, duration, started_event:, server_connection_id: nil, 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.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 85 def initialize(command_name, database_name, address, request_id, operation_id, , failure, duration, started_event:, server_connection_id: nil, 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 = @started_event = started_event @failure = redacted(command_name, failure) @duration = duration @server_connection_id = server_connection_id end |
Instance Attribute Details
#address ⇒ Server::Address (readonly)
Returns address The server address.
29 30 31 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 29 def address @address end |
#command_name ⇒ String (readonly)
Returns command_name The name of the command.
32 33 34 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 32 def command_name @command_name end |
#database_name ⇒ String (readonly)
Returns database_name The name of the database_name.
35 36 37 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 35 def database_name @database_name end |
#duration ⇒ Float (readonly)
Returns duration The duration of the command in seconds.
38 39 40 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 38 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.
44 45 46 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 44 def failure @failure end |
#message ⇒ String (readonly)
Returns message The error message. Unlike the error document, the error message should always be present.
48 49 50 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 48 def @message end |
#operation_id ⇒ Integer (readonly)
Returns operation_id The operation id.
51 52 53 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 51 def operation_id @operation_id end |
#request_id ⇒ Integer (readonly)
Returns request_id The request id.
54 55 56 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 54 def request_id @request_id end |
#server_connection_id ⇒ Integer (readonly)
Returns server_connection_id The server connection id.
57 58 59 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 57 def server_connection_id @server_connection_id end |
#service_id ⇒ nil | Object (readonly)
Returns The service id, if any.
60 61 62 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 60 def service_id @service_id end |
#started_event ⇒ Monitoring::Event::CommandStarted (readonly)
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.
Returns started_event The corresponding started event.
66 67 68 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 66 def started_event @started_event end |
Class Method Details
.generate(address, operation_id, payload, message, failure, duration, started_event:, server_connection_id: nil, 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 event from a wire protocol message payload.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 132 def self.generate(address, operation_id, payload, , failure, duration, started_event:, server_connection_id: nil, service_id: nil ) new( payload[:command_name], payload[:database_name], address, payload[:request_id], operation_id, , failure, duration, started_event: started_event, server_connection_id: server_connection_id, service_id: service_id, ) end |
Instance Method Details
#summary ⇒ String
This method is experimental and subject to change.
Returns a concise yet useful summary of the event.
109 110 111 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/event/command_failed.rb', line 109 def summary "#<#{short_class_name} address=#{address} #{database_name}.#{command_name}>" end |