class Cassie::Statements::Logging::ExecuteEvent

Public Instance Methods

duration() click to toggle source
Calls superclass method
# File lib/cassie/statements/logging/execute_event.rb, line 4
def duration # in milliseconds
  return super unless traced?

  # trace duration is in microseconds
  trace.duration / 1000.0
end
message() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 11
def message
  {
    event: "cassie.cql.execution",
    duration: duration.round(1),
    query: statement,
    consistency: consistency.upcase
  }.extend(Inspector)
end

Protected Instance Methods

consistency() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 41
def consistency
  if execution_info
    execution_info.consistency
  else
    "consistency level unknown"
  end
end
execution_info() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 22
def execution_info
  payload[:execution_info]
end
statement() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 26
def statement
  if execution_info
    statement = execution_info.statement
    if statement.respond_to? :cql
      str = statement.cql.dup
      str << " #{statement.params.map(&:to_s)}" if statement.respond_to? :params
    else
      str = statement.to_s
    end
    str
  else
    "CQL executed: (`execution_info` was not present?)"
  end
end
trace() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 53
def trace
  execution_info.trace
end
traced?() click to toggle source
# File lib/cassie/statements/logging/execute_event.rb, line 49
def traced?
  execution_info && !!trace
end