Class: Bigcommerce::Prometheus::Integrations::Puma
- Inherits:
-
Object
- Object
- Bigcommerce::Prometheus::Integrations::Puma
- Defined in:
- lib/bigcommerce/prometheus/integrations/puma.rb
Overview
Plugin for puma
Class Method Summary collapse
- .active_record_enabled? ⇒ Boolean
- .puma_enabled? ⇒ Boolean
-
.start(client: nil, frequency: nil) ⇒ Object
Start the puma collector.
Class Method Details
.active_record_enabled? ⇒ Boolean
53 54 55 |
# File 'lib/bigcommerce/prometheus/integrations/puma.rb', line 53 def self.active_record_enabled? defined?(ActiveRecord) && ::ActiveRecord::Base.connection_pool.respond_to?(:stat) end |
.puma_enabled? ⇒ Boolean
60 61 62 |
# File 'lib/bigcommerce/prometheus/integrations/puma.rb', line 60 def self.puma_enabled? defined?(::Puma) && ::Puma.respond_to?(:stats) end |
.start(client: nil, frequency: nil) ⇒ Object
Start the puma collector
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bigcommerce/prometheus/integrations/puma.rb', line 28 def self.start(client: nil, frequency: nil) return unless puma_enabled? if puma_enabled? ::PrometheusExporter::Instrumentation::Puma.start( client: client || ::Bigcommerce::Prometheus.client, frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency ) end if active_record_enabled? ::PrometheusExporter::Instrumentation::ActiveRecord.start( client: client || ::Bigcommerce::Prometheus.client, frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency ) end ::PrometheusExporter::Instrumentation::Process.start( client: client || ::Bigcommerce::Prometheus.client, type: ::Bigcommerce::Prometheus.puma_process_label, frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency ) end |