Class: PrometheusClientAddons::Prometheus::Client::ActiveRecord
- Inherits:
-
MultiMetric
- Object
- Prometheus::Client::Metric
- MultiMetric
- PrometheusClientAddons::Prometheus::Client::ActiveRecord
show all
- Defined in:
- lib/prometheus_client_addons/prometheus/client/active_record.rb
Constant Summary
collapse
- HANDLES =
{
size: 'Size of pool',
connections: 'Connections count',
busy: 'Busy count',
dead: 'Dead count',
idle: 'Idle count',
waiting: 'Num waiting in queue',
checkout_timeout: 'Checkout timeout'
}.freeze
Instance Attribute Summary
Attributes inherited from MultiMetric
#base_labels, #name, #prefix
Instance Method Summary
collapse
Methods inherited from MultiMetric
#initialize
Instance Method Details
#multi_name_docstring ⇒ Object
23
24
25
|
# File 'lib/prometheus_client_addons/prometheus/client/active_record.rb', line 23
def multi_name_docstring
Hash[HANDLES.map { |key, value| ["#{prefix}#{key}".to_sym, value] }]
end
|
#multi_name_type ⇒ Object
18
19
20
21
|
# File 'lib/prometheus_client_addons/prometheus/client/active_record.rb', line 18
def multi_name_type
full_handles = HANDLES.keys.map { |key| "#{prefix}#{key}" }.map(&:to_sym)
Hash[full_handles.zip([:gauge] * HANDLES.size)]
end
|
#multi_values ⇒ Object
27
28
29
30
|
# File 'lib/prometheus_client_addons/prometheus/client/active_record.rb', line 27
def multi_values
stat = ::ActiveRecord::Base.connection_pool.stat
Hash[stat.map { |key, value| ["#{prefix}#{key}".to_sym, { {} => value }] }]
end
|