Class: Logtail::Events::SQLQuery

Inherits:
Logtail::Event show all
Defined in:
lib/logtail/events/sql_query.rb

Instance Attribute Summary collapse

Attributes inherited from Logtail::Event

#metadata

Instance Method Summary collapse

Methods inherited from Logtail::Event

#inspect, #to_json, #to_msgpack, #to_s

Constructor Details

#initialize(attributes) ⇒ SQLQuery

Returns a new instance of SQLQuery.



10
11
12
13
14
# File 'lib/logtail/events/sql_query.rb', line 10

def initialize(attributes)
  @sql = attributes[:sql]
  @duration_ms = attributes[:duration_ms]
  @message = attributes[:message]
end

Instance Attribute Details

#duration_msObject (readonly)

Returns the value of attribute duration_ms.



8
9
10
# File 'lib/logtail/events/sql_query.rb', line 8

def duration_ms
  @duration_ms
end

#messageObject (readonly)

Returns the value of attribute message.



8
9
10
# File 'lib/logtail/events/sql_query.rb', line 8

def message
  @message
end

#sqlObject (readonly)

Returns the value of attribute sql.



8
9
10
# File 'lib/logtail/events/sql_query.rb', line 8

def sql
  @sql
end

Instance Method Details

#to_hashObject



16
17
18
19
20
21
22
23
# File 'lib/logtail/events/sql_query.rb', line 16

def to_hash
  {
    sql_query_executed: Util::NonNilHashBuilder.build do |h|
      h.add(:sql, sql)
      h.add(:duration_ms, duration_ms)
    end
  }
end