class Promenade::Prometheus::Options

Constants

BUCKET_PRESETS

Public Class Methods

new() click to toggle source
# File lib/promenade/prometheus.rb, line 41
def initialize
  @buckets = BUCKET_PRESETS[:network]
  @base_labels = {}
  @doc = nil
  @multiprocess_mode = :all
end

Public Instance Methods

args(type) click to toggle source
# File lib/promenade/prometheus.rb, line 69
def args(type)
  case type
  when :gauge
    [@doc, @base_labels, @multiprocess_mode]
  when :histogram
    [@doc, @base_labels, @buckets]
  when :counter, :summary
    [@doc, @base_labels]
  else
    fail "Unsupported metric type: #{type}"
  end
end
base_labels(labels) click to toggle source
# File lib/promenade/prometheus.rb, line 52
def base_labels(labels)
  @base_labels = labels
end
buckets(buckets) click to toggle source
# File lib/promenade/prometheus.rb, line 60
def buckets(buckets)
  if buckets.is_a?(Symbol)
    @buckets = BUCKET_PRESETS[buckets]
    fail "#{buckets} is not a valid bucket preset" if @buckets.nil?
  else
    @buckets = buckets
  end
end
doc(str) click to toggle source
# File lib/promenade/prometheus.rb, line 48
def doc(str)
  @doc = str
end
evaluate(&block) click to toggle source
# File lib/promenade/prometheus.rb, line 82
def evaluate(&block)
  instance_eval(&block)
  self
end
multiprocess_mode(mode) click to toggle source
# File lib/promenade/prometheus.rb, line 56
def multiprocess_mode(mode)
  @multiprocess_mode = mode
end