require "influxdb/rails/sql/normalizer" module InfluxDB module Rails module Sql class Query # :nodoc: attr_reader :query, :name TRACKED_SQL_COMMANDS = %w[SELECT INSERT UPDATE DELETE].freeze def initialize(payload) @query = payload[:sql].to_s.dup @name = payload[:name].to_s.dup end def operation query.split.first.upcase end def class_name name.split.first end def track? @track ||= query.start_with?(*TRACKED_SQL_COMMANDS) end end end end end