CommandSucceeded — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Monitoring::Event::CommandSucceeded

Overview

Event that is fired when a command operation succeeds.

Constant Summary

Constants included from Secure

Secure::REDACTED_COMMANDS

Instance Attribute Summary collapse

Class Method Summarycollapse

Instance Method Summarycollapse

Methods included from Secure

#compression_allowed?, #redacted, #sensitive?

Constructor Details

#initialize(command_name, database_name, address, request_id, operation_id, reply, duration, started_event:, server_connection_id: nil, service_id: nil) ⇒ CommandSucceeded

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.

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 78 def initialize(command_name, database_name, address, request_id, operation_id, reply, 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 @started_event = started_event @reply = redacted(command_name, reply) @duration = duration @server_connection_id = server_connection_id end

Instance Attribute Details

#address ⇒ Server::Address

Returns address The server address.

29 30 31 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 29 def address @address end

#command_name ⇒ String

Returns command_name The name of the command.

32 33 34 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 32 def command_name @command_name end

#database_name ⇒ String

Returns database_name The name of the database.

38 39 40 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 38 def database_name @database_name end

#duration ⇒ Float

Returns duration The duration of the event.

41 42 43 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 41 def duration @duration end

#operation_id ⇒ Integer

Returns operation_id The operation id.

44 45 46 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 44 def operation_id @operation_id end

#reply ⇒ BSON::Document

Returns reply The command reply.

35 36 37 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 35 def reply @reply end

#request_id ⇒ Integer

Returns request_id The request id.

47 48 49 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 47 def request_id @request_id end

#server_connection_id ⇒ Integer

Returns server_connection_id The server connection id.

50 51 52 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 50 def server_connection_id @server_connection_id end

#service_id ⇒ nil | Object

Returns The service id, if any.

53 54 55 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 53 def service_id @service_id end

#started_eventMonitoring::Event::CommandStarted

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.

59 60 61 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 59 def started_event @started_event end

Class Method Details

.generate(address, operation_id, command_payload, reply_payload, duration, started_event:, server_connection_id: nil, service_id: nil) ⇒ CommandCompleted

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.

123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 123 def self.generate(address, operation_id, command_payload, reply_payload, duration, started_event:, server_connection_id: nil, service_id: nil ) new( command_payload[:command_name], command_payload[:database_name], address, command_payload[:request_id], operation_id, generate_reply(command_payload, reply_payload), duration, started_event: started_event, server_connection_id: server_connection_id, service_id: service_id, ) end

Instance Method Details

#summary ⇒ String

Note:

This method is experimental and subject to change.

Returns a concise yet useful summary of the event.

101 102 103 # File 'lib/mongo/monitoring/event/command_succeeded.rb', line 101 def summary "#<#{short_class_name} address=#{address} #{database_name}.#{command_name}>" end