Method: Skylight::Normalizers::Moped::Query#normalize

Defined in:
lib/skylight/normalizers/moped/query.rb

#normalize(trace, name, payload) ⇒ Object

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.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/skylight/normalizers/moped/query.rb', line 9

def normalize(trace, name, payload)
  # payload: { prefix: "  MOPED: #{address.resolved}", ops: operations }

  # We can sometimes have multiple operations. However, it seems like this only happens when doing things
  # like an insert, followed by a get last error, so we can probably ignore all but the first.
  operation = payload[:ops] ? payload[:ops].first : nil
  type = operation && operation.class.to_s =~ /^Moped::Protocol::(.+)$/ ? $1 : nil

  case type
  when "Query"       then normalize_query(operation)
  when "GetMore"     then normalize_get_more(operation)
  when "Insert"      then normalize_insert(operation)
  when "Update"      then normalize_update(operation)
  when "Delete"      then normalize_delete(operation)
  else :skip
  end
end