Class: Skylight::Normalizers::OrientdbClient::Query

Inherits:
Normalizer
  • Object
show all
Defined in:
lib/orientdb_client/integration/skylight_normalizer.rb

Constant Summary collapse

CAT =
"db.orientdb.query".freeze
QUERY_REGEX =
/\/([^\/]+)/
SUPPORTED_QUERY_TYPES =
["query".freeze, "command".freeze]

Instance Method Summary collapse

Instance Method Details

#normalize(trace, name, payload) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/orientdb_client/integration/skylight_normalizer.rb', line 14

def normalize(trace, name, payload)
  url = payload[:url]
  query_type = nil
  begin
    uri = URI.parse(url)
    match = uri.path.match(QUERY_REGEX)
    if match
      query_type = match[1]
    end
  rescue URI::Error
    return :skip
  end

  return :skip unless SUPPORTED_QUERY_TYPES.include?(query_type)

  [ CAT, "orientdb: #{query_type}", nil ]
end