Class: Skylight::Core::Normalizers::Moped::Query Private
- Inherits:
-
Normalizer
- Object
- Normalizer
- Skylight::Core::Normalizers::Moped::Query
- Defined in:
- lib/skylight/core/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
Instance Method Summary collapse
-
#normalize(_trace, _name, payload) ⇒ Array, :skip
private
Normalizes a Moped operation.
Methods inherited from Normalizer
#initialize, #normalize_after, register
Constructor Details
This class inherits a constructor from Skylight::Core::Normalizers::Normalizer
Instance Method Details
#normalize(_trace, _name, payload) ⇒ Array, :skip
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.
Normalizes a Moped operation
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/skylight/core/normalizers/moped/query.rb', line 18 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".freeze then normalize_query(operation) when "GetMore".freeze then normalize_get_more(operation) when "Insert".freeze then normalize_insert(operation) when "Update".freeze then normalize_update(operation) when "Delete".freeze then normalize_delete(operation) else :skip end end |