module InfluxDB::Rails
InfluxDB::Rails
contains the glue code needed to integrate with InfluxDB
and Rails
. This is a singleton class.
Constants
- VERSION
Attributes
client[W]
configuration[W]
Public Class Methods
client()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/influxdb-rails.rb, line 35 def client @client ||= begin cfg = configuration.client InfluxDB::Client.new \ database: cfg.database, username: cfg.username, password: cfg.password, auth_method: cfg.auth_method, hosts: cfg.hosts, port: cfg.port, async: cfg.async, use_ssl: cfg.use_ssl, retry: cfg.retry, open_timeout: cfg.open_timeout, read_timeout: cfg.read_timeout, max_delay: cfg.max_delay, time_precision: cfg.time_precision end end
configuration()
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/influxdb-rails.rb, line 57 def configuration @configuration ||= InfluxDB::Rails::Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/influxdb-rails.rb, line 26 def configure return configuration unless block_given? yield configuration self.client = nil # if we change configuration, reload the client end
current()
click to toggle source
# File lib/influxdb-rails.rb, line 61 def current @current ||= InfluxDB::Rails::Context.new end
instrument(name, options = {}) { || ... }
click to toggle source
# File lib/influxdb-rails.rb, line 65 def instrument(name, options = {}) ActiveSupport::Notifications.instrument "block_instrumentation.influxdb_rails", **options.merge(name: name) do yield if block_given? end end