Sha256: b82329f275ea05045edfaac921aa103d435c741f4c319c8f87c0e6ee1fe58091

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

require 'influxdb'

module Skalera
  module Services
    class InfluxDB
      SERVICE_NAME = 'influxdb-8086'
      def self.instance(database)
        influxdb_config = Diplomat::Service.get(SERVICE_NAME)

        influxdb = ::InfluxDB::Client.new(database,
                                          host: influxdb_config.Address,
                                          port: influxdb_config.ServicePort,
                                          user: key('user'),
                                          password: key('password'))
        # does not need an at_exit, as the influx clients takes care of it
        influxdb
      rescue Diplomat::KeyNotFound
        STDERR.puts "ERROR: service not found: #{SERVICE_NAME}"
      end

      def self.key(key)
        Diplomat.get("influxdb/#{key}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skalera-services-0.2.4 lib/skalera/services/influxdb.rb