class G5PromRails::MetricsContainer

Constants

MODEL_COUNT_NAME

Attributes

per_application[R]
per_process[R]

Public Class Methods

new() click to toggle source
# File lib/g5_prom_rails/metrics.rb, line 12
def initialize
  @per_process = Prometheus::Client::Registry.new
  @per_application = Prometheus::Client::Registry.new
  @model_count_gauge = @per_application.gauge(MODEL_COUNT_NAME, "model row counts")
  try(:initialize_sidekiq_application)
end

Public Instance Methods

update_model_count_gauge(*models) click to toggle source
# File lib/g5_prom_rails/metrics.rb, line 19
def update_model_count_gauge(*models)
  models.each do |model|
    @model_count_gauge.set(
      { model: model.name.tableize },
      model.count
    )
  end
end