module Sematext::Metrics

Constants

VERSION

Public Class Methods

initialize(token, args = {}) click to toggle source
# File lib/sematext/metrics.rb, line 24
def self.initialize(token, args = {})
  raise "Token should be defined" unless token

  opts = { :async => false }
  if !!args == args
    opts[:async] = args
  elsif args.kind_of?(Hash)
    opts.merge!(args)
  end
  @client = opts[:async] ? Client.async(token, opts[:receiver_url]) : Client.sync(token, opts[:receiver_url])
end
send(datapoint) click to toggle source
# File lib/sematext/metrics.rb, line 36
def self.send datapoint
  client.send datapoint
end
send_batch(datapoints) click to toggle source
# File lib/sematext/metrics.rb, line 40
def self.send_batch datapoints
  client.send_batch datapoints
end

Private Class Methods

client() click to toggle source
# File lib/sematext/metrics.rb, line 45
def self.client
  raise "Client should be initialized (forgot to call Sematext::Metrics.initialize?)" unless @client
  @client
end