Module: SqlMetrics

Defined in:
lib/sql_metrics.rb,
lib/sql_metrics/config.rb,
lib/sql_metrics/railtie.rb,
lib/sql_metrics/version.rb,
lib/sql_metrics/sql_metrics.rb

Defined Under Namespace

Classes: Configuration, Railtie

Constant Summary collapse

VERSION =
"0.1.10"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



9
10
11
# File 'lib/sql_metrics.rb', line 9

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



16
17
18
# File 'lib/sql_metrics.rb', line 16

def self.configure
  yield(configuration) if block_given?
end

.create_events_tableObject



15
16
17
18
19
# File 'lib/sql_metrics/sql_metrics.rb', line 15

def create_events_table
  conn = pg_connection

  conn.exec("CREATE TABLE #{SqlMetrics.configuration.event_table_name} (created_at timestamp, name varchar(200), properties json);")
end

.track(name, properties = {}, request = nil, options = nil) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/sql_metrics/sql_metrics.rb', line 3

def track(name, properties = {}, request = nil, options = nil)
  created_at = Time.now.utc

  Thread.new do
    track_now(created_at, name, properties, request, options)
  end
end

.track_user(user) ⇒ Object



11
12
13
# File 'lib/sql_metrics/sql_metrics.rb', line 11

def track_user(user)

end