Module: G5PromRails

Defined in:
lib/g5_prom_rails.rb,
lib/g5_prom_rails/engine.rb,
lib/g5_prom_rails/version.rb,
app/helpers/g5_prom_rails/application_helper.rb,
app/controllers/g5_prom_rails/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, RefreshingExporter Classes: ApplicationController, Engine, MetricsContainer, SettableCounter, SidekiqTimingMiddleware

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.add_refresh_hook(&block) ⇒ Object



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

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

.count_models(*models) ⇒ Object



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

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

.refresh_gaugesObject



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

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