Module: NewRelic::Security::Instrumentation::Mongo::Collection::View

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

Instance Method Summary collapse

Instance Method Details

#delete_many_on_enter(opts) ⇒ Object



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 191

def delete_many_on_enter(opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:opts] = opts
  hash[:payloadType] = :delete
  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

#delete_many_on_exit(event) ⇒ Object



207
208
209
210
211
212
213
214
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 207

def delete_many_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#delete_one_on_enter(opts) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 141

def delete_one_on_enter(opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:opts] = opts
  hash[:payloadType] = :delete
  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

#delete_one_on_exit(event) ⇒ Object



157
158
159
160
161
162
163
164
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 157

def delete_one_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#find_one_and_delete_on_enter(opts) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 166

def find_one_and_delete_on_enter(opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:opts] = opts
  hash[:payloadType] = :delete
  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_one_and_delete_on_exit(event) ⇒ Object



182
183
184
185
186
187
188
189
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 182

def find_one_and_delete_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#find_one_and_update_on_enter(document, opts) ⇒ Object



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 242

def find_one_and_update_on_enter(document, opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:document] = document
  hash[:payload][:opts] = opts
  hash[:payloadType] = :update
  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_one_and_update_on_exit(event) ⇒ Object



259
260
261
262
263
264
265
266
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 259

def find_one_and_update_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#replace_one_on_enter(replacement, opts) ⇒ Object



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 216

def replace_one_on_enter(replacement, opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:replacement] = replacement
  hash[:payload][:opts] = opts
  hash[:payloadType] = :update
  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

#replace_one_on_exit(event) ⇒ Object



233
234
235
236
237
238
239
240
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 233

def replace_one_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#update_many_on_enter(spec, opts) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 115

def update_many_on_enter(spec, opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:spec] = spec
  hash[:payload][:opts] = opts
  hash[:payloadType] = :update
  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

#update_many_on_exit(event) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 132

def update_many_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#update_one_on_enter(spec, opts) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 89

def update_one_on_enter(spec, opts)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  hash = {}
  hash[:payload] = {}
  hash[:payload][:filter] = instance_variable_get(:@filter)
  hash[:payload][:spec] = spec
  hash[:payload][:opts] = opts
  hash[:payloadType] = :update
  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

#update_one_on_exit(event) ⇒ Object



106
107
108
109
110
111
112
113
# File 'lib/newrelic_security/instrumentation-security/mongo/instrumentation.rb', line 106

def update_one_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end