Class: Cql::Client::QueryTrace

Inherits:
Object
  • Object
show all
Defined in:
lib/cql/client/query_trace.rb

Direct Known Subclasses

NullQueryTrace

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, events) ⇒ QueryTrace

Returns a new instance of QueryTrace.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cql/client/query_trace.rb', line 10

def initialize(session, events)
  if session
    raise IncompleteTraceError, 'Trace incomplete, try loading it again' unless session['duration']
    @coordinator = session['coordinator']
    @cql = (parameters = session['parameters']) && parameters['query']
    @started_at = session['started_at']
    @duration = session['duration']/1_000_000.0
    if events
      @events = events.map { |e| TraceEvent.new(e) }.freeze
    end
  else
    @events = [].freeze
  end
end

Instance Attribute Details

#coordinatorObject (readonly)

Returns the value of attribute coordinator.



7
8
9
# File 'lib/cql/client/query_trace.rb', line 7

def coordinator
  @coordinator
end

#cqlObject (readonly)

Returns the value of attribute cql.



7
8
9
# File 'lib/cql/client/query_trace.rb', line 7

def cql
  @cql
end

#durationObject (readonly)

Returns the value of attribute duration.



7
8
9
# File 'lib/cql/client/query_trace.rb', line 7

def duration
  @duration
end

#eventsObject (readonly)

Returns the value of attribute events.



7
8
9
# File 'lib/cql/client/query_trace.rb', line 7

def events
  @events
end

#started_atObject (readonly)

Returns the value of attribute started_at.



7
8
9
# File 'lib/cql/client/query_trace.rb', line 7

def started_at
  @started_at
end