Class: Skylight::Normalizers::Moped::Query Private

Inherits:
Normalizer show all
Defined in:
lib/skylight/normalizers/moped/query.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

CAT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"db.mongo.query".freeze

Instance Attribute Summary

Attributes inherited from Normalizer

#config

Instance Method Summary collapse

Methods inherited from Normalizer

#initialize, register

Constructor Details

This class inherits a constructor from Skylight::Normalizers::Normalizer

Instance Method Details

#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.

[View source]

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