Class: Mongo::Monitoring::Event::CommandSucceeded
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::Mongo::Event::Base
|
|
Instance Chain:
self,
Secure ,
::Mongo::Event::Base
|
|
Inherits: |
Mongo::Event::Base
|
Defined in: | lib/mongo/monitoring/event/command_succeeded.rb |
Overview
::Mongo::Monitoring::Event
that is fired when a command operation succeeds.
Constant Summary
Secure
- Included
Class Method Summary
-
.generate(address, operation_id, command_payload, reply_payload, duration, started_event:, server_connection_id: nil, service_id: nil) ⇒ CommandCompleted
Internal use only
Internal use only
Create the event from a wire protocol message payload.
-
.new(command_name, database_name, address, request_id, operation_id, reply, duration, started_event:, server_connection_id: nil, service_id: nil) ⇒ CommandSucceeded
constructor
Internal use only
Internal use only
Create the new event.
- .generate_reply(command_payload, reply_payload) private
- .namespace(payload) private
Instance Attribute Summary
- #address ⇒ Server::Address readonly
- #command_name ⇒ String readonly
- #database_name ⇒ String readonly
- #duration ⇒ Float readonly
- #operation_id ⇒ Integer readonly
- #reply ⇒ BSON::Document readonly
- #request_id ⇒ Integer readonly
- #server_connection_id ⇒ Integer readonly
- #service_id ⇒ nil | Object readonly
- #started_event ⇒ Monitoring::Event::CommandStarted readonly Internal use only Internal use only
Instance Method Summary
-
#summary ⇒ String
Returns a concise yet useful summary of the event.
Secure
- Included
#compression_allowed? | Is compression allowed for a given command message. |
#redacted | Redact secure information from the document if: |
#sensitive? | Check whether the command is sensitive in terms of command monitoring spec. |
::Mongo::Event::Base
- Inherited
#summary | Returns a concise yet useful summary of the event. |
#short_class_name |
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 for internal use only.
Create the event from a wire protocol message payload.
# 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
.generate_reply(command_payload, reply_payload) (private)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 143
def self.generate_reply(command_payload, reply_payload) if reply_payload reply = reply_payload[:reply] if cursor = reply[:cursor] if !cursor.key?(Collection::NS) cursor.merge!(Collection::NS => namespace(command_payload)) end end reply else BSON::Document.new(Operation::Result::OK => 1) end end
.namespace(payload) (private)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 157
def self.namespace(payload) command = payload[:command] "#{payload[:database_name]}.#{command[:collection] || command.values.first}" end
Instance Attribute Details
#address ⇒ Server::Address
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 29
attr_reader :address
#command_name ⇒ String
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 32
attr_reader :command_name
#database_name ⇒ String
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 38
attr_reader :database_name
#duration ⇒ Float
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 41
attr_reader :duration
#operation_id ⇒ Integer
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 44
attr_reader :operation_id
#reply ⇒ BSON::Document
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 35
attr_reader :reply
#request_id ⇒ Integer
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 47
attr_reader :request_id
#server_connection_id ⇒ Integer
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 50
attr_reader :server_connection_id
#service_id ⇒ nil
| Object
(readonly)
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 53
attr_reader :service_id
#started_event ⇒ Monitoring::Event::CommandStarted (readonly)
This method is for internal use only.
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 59
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.
# File 'lib/mongo/monitoring/event/command_succeeded.rb', line 101
def summary "#<#{short_class_name} address=#{address} #{database_name}.#{command_name}>" end