Module: NewRelic::Security::Instrumentation::Mongo::Collection
- Included in:
- Prepend
- Defined in:
- lib/newrelic_security/instrumentation-security/mongo/chain.rb,
lib/newrelic_security/instrumentation-security/mongo/prepend.rb,
lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb
Defined Under Namespace
Modules: Chain, Prepend, View
Instance Method Summary
collapse
Instance Method Details
#find_on_enter(filter, options) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 8
def find_on_enter(filter, options)
event = nil
NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
hash = {}
hash[:payload] = {}
hash[:payload][:filter] = filter
hash[:payload][:options] = options
hash[:payloadType] = :find event = NewRelic::Security::Agent::Control::Collector.collect(NOSQL_DB_COMMAND, [hash], MONGO)
rescue => exception
NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
yield
return event
end
|
#find_on_exit(event) ⇒ Object
#insert_many_on_enter(documents, options) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 62
def insert_many_on_enter(documents, options)
event = nil
NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
hash = {}
hash[:payload] = {}
hash[:payload][:documents] = documents
hash[:payload][:options] = options
hash[:payloadType] = :insert
event = NewRelic::Security::Agent::Control::Collector.collect(NOSQL_DB_COMMAND, [hash], MONGO)
rescue => exception
NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
yield
return event
end
|
#insert_many_on_exit(event) ⇒ Object
#insert_one_on_enter(document, opts) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 33
def insert_one_on_enter(document, opts)
event = nil
NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
if caller_locations[1].label.to_s == "insert_one_with_clear_cache"
NewRelic::Security::Agent.logger.debug "Filtered to break the loop calling #{self.class}.#{__method__} from 'insert_one_with_clear_cache'"
return
end
hash = {}
hash[:payload] = {}
hash[:payload][:document] = document
hash[:payload][:opts] = opts
hash[:payloadType] = :insert
event = NewRelic::Security::Agent::Control::Collector.collect(NOSQL_DB_COMMAND, [hash], MONGO)
rescue => exception
NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
yield
return event
end
|
#insert_one_on_exit(event) ⇒ Object