Module: G5PromRails

Defined in:
lib/g5_prom_rails.rb,
lib/g5_prom_rails/engine.rb,
lib/g5_prom_rails/version.rb,
app/jobs/g5_prom_rails/application_job.rb,
app/models/g5_prom_rails/application_record.rb,
app/helpers/g5_prom_rails/application_helper.rb,
app/mailers/g5_prom_rails/application_mailer.rb,
app/controllers/g5_prom_rails/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, RefreshingExporter, SidekiqApplicationMetrics Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Engine, MetricsContainer, SettableCounter, SidekiqTimingMiddleware

Constant Summary collapse

PER_PROCESS_PATH =
"/metrics"
PER_APPLICATION_PATH =
"/probe"
VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.add_refresh_hook(&block) ⇒ Object



9
10
11
12
# File 'lib/g5_prom_rails.rb', line 9

def self.add_refresh_hook(&block)
  @@refresh_hooks ||= []
  @@refresh_hooks << block
end

.count_models(*models) ⇒ Object



19
20
21
22
23
# File 'lib/g5_prom_rails.rb', line 19

def self.count_models(*models)
  add_refresh_hook do
    Metrics.update_model_count_gauge(*models)
  end
end

.refresh_gaugesObject



14
15
16
17
# File 'lib/g5_prom_rails.rb', line 14

def self.refresh_gauges
  return if @@refresh_hooks.nil?
  @@refresh_hooks.each { |b| b.call }
end