Class: G5PromRails::MetricsContainer
- Inherits:
-
Object
- Object
- G5PromRails::MetricsContainer
- Includes:
- SidekiqApplicationMetrics
- Defined in:
- lib/g5_prom_rails/metrics.rb
Constant Summary collapse
- MODEL_COUNT_NAME =
:model_rows
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#per_application ⇒ Object
readonly
Returns the value of attribute per_application.
-
#per_process ⇒ Object
readonly
Returns the value of attribute per_process.
Instance Method Summary collapse
-
#initialize(app) ⇒ MetricsContainer
constructor
A new instance of MetricsContainer.
- #update_model_count_gauge(*models) ⇒ Object
Methods included from SidekiqApplicationMetrics
#initialize_sidekiq_application, #update_sidekiq_statistics
Constructor Details
#initialize(app) ⇒ MetricsContainer
Returns a new instance of MetricsContainer.
13 14 15 16 17 18 19 |
# File 'lib/g5_prom_rails/metrics.rb', line 13 def initialize(app) @app = app @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 |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/g5_prom_rails/metrics.rb', line 10 def app @app end |
#per_application ⇒ Object (readonly)
Returns the value of attribute per_application.
11 12 13 |
# File 'lib/g5_prom_rails/metrics.rb', line 11 def per_application @per_application end |
#per_process ⇒ Object (readonly)
Returns the value of attribute per_process.
11 12 13 |
# File 'lib/g5_prom_rails/metrics.rb', line 11 def per_process @per_process end |
Instance Method Details
#update_model_count_gauge(*models) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/g5_prom_rails/metrics.rb', line 21 def update_model_count_gauge(*models) models.each do |model| @model_count_gauge.set( { app: app, model: model.name.tableize }, model.count ) end end |