Sha256: 030912ddc1a1038cf4d9d02d745e175c1b1376db867237479a1db87e759e2865

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

require 'trifle/stats/designator/custom'
require 'trifle/stats/designator/geometric'
require 'trifle/stats/designator/linear'
require 'trifle/stats/driver/mongo'
require 'trifle/stats/driver/postgres'
require 'trifle/stats/driver/process'
require 'trifle/stats/driver/redis'
require 'trifle/stats/mixins/packer'
require 'trifle/stats/nocturnal'
require 'trifle/stats/configuration'
require 'trifle/stats/operations/timeseries/classify'
require 'trifle/stats/operations/timeseries/increment'
require 'trifle/stats/operations/timeseries/set'
require 'trifle/stats/operations/timeseries/values'
require 'trifle/stats/version'

module Trifle
  module Stats
    class Error < StandardError; end
    class DriverNotFound < Error; end

    def self.default
      @default ||= Configuration.new
    end

    def self.configure
      yield(default)

      default
    end

    def self.track(key:, at:, values:, config: nil)
      Trifle::Stats::Operations::Timeseries::Increment.new(
        key: key,
        at: at,
        values: values,
        config: config
      ).perform
    end

    def self.assert(key:, at:, values:, config: nil)
      Trifle::Stats::Operations::Timeseries::Set.new(
        key: key,
        at: at,
        values: values,
        config: config
      ).perform
    end

    def self.assort(key:, at:, values:, config: nil)
      Trifle::Stats::Operations::Timeseries::Classify.new(
        key: key,
        at: at,
        values: values,
        config: config
      ).perform
    end

    def self.values(key:, from:, to:, range:, config: nil)
      Trifle::Stats::Operations::Timeseries::Values.new(
        key: key,
        from: from,
        to: to,
        range: range,
        config: config
      ).perform
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trifle-stats-1.2.0 lib/trifle/stats.rb
trifle-stats-1.1.2 lib/trifle/stats.rb
trifle-stats-1.1.1 lib/trifle/stats.rb