class PrometheusAggregator::Client

Constants

DEFAULT_BUCKETS

Public Class Methods

new(host, port, opts = {}) click to toggle source
# File lib/prometheus_aggregator/client.rb, line 9
def initialize(host, port, opts = {})
  @default_labels = opts.delete(:default_labels) || {}
  @exporter = Exporter.new(host, port, opts)
end

Public Instance Methods

counter(name:, value:, help:, labels: {}) click to toggle source
# File lib/prometheus_aggregator/client.rb, line 14
def counter(name:, value:, help:, labels: {})
  @exporter.enqueue(
    type: "counter",
    name: name,
    value: value,
    help: help,
    labels: @default_labels.dup.merge(labels)
  )
end
gauge(name:, value:, help:, labels: {}) click to toggle source
# File lib/prometheus_aggregator/client.rb, line 24
def gauge(name:, value:, help:, labels: {})
  @exporter.enqueue(
    type: "gauge",
    name: name,
    value: value,
    help: help,
    labels: @default_labels.dup.merge(labels)
  )
end
histogram(name:, value:, help:, buckets: DEFAULT_BUCKETS, labels: {}) click to toggle source
# File lib/prometheus_aggregator/client.rb, line 34
def histogram(name:, value:, help:, buckets: DEFAULT_BUCKETS, labels: {})
  @exporter.enqueue(
    type: "histogram",
    name: name,
    value: value,
    help: help,
    buckets: buckets,
    labels: @default_labels.dup.merge(labels)
  )
end
stop() click to toggle source
# File lib/prometheus_aggregator/client.rb, line 45
def stop
  @exporter.stop
end