Class: Gitlab::Metrics::Samplers::DatabaseSampler
- Inherits:
-
BaseSampler
- Object
- Daemon
- BaseSampler
- Gitlab::Metrics::Samplers::DatabaseSampler
- Defined in:
- lib/gitlab/metrics/samplers/database_sampler.rb
Constant Summary collapse
- DEFAULT_SAMPLING_INTERVAL_SECONDS =
5
- METRIC_PREFIX =
'gitlab_database_connection_pool_'
- METRIC_DESCRIPTIONS =
{ size: 'Total connection pool capacity', connections: 'Current connections in the pool', busy: 'Connections in use where the owner is still alive', dead: 'Connections in use where the owner is not alive', idle: 'Connections not in use', waiting: 'Threads currently waiting on this queue' }.freeze
Instance Attribute Summary
Attributes inherited from BaseSampler
Attributes inherited from Daemon
Instance Method Summary collapse
Methods inherited from BaseSampler
#initialize, #safe_sample, #sleep_interval
Methods inherited from Daemon
#enabled?, #initialize, initialize_instance, instance, #start, #stop, #thread?, #thread_name
Constructor Details
This class inherits a constructor from Gitlab::Metrics::Samplers::BaseSampler
Instance Method Details
#metrics ⇒ Object
20 21 22 |
# File 'lib/gitlab/metrics/samplers/database_sampler.rb', line 20 def metrics @metrics ||= init_metrics end |
#sample ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/gitlab/metrics/samplers/database_sampler.rb', line 24 def sample host_stats.each do |host_stat| METRIC_DESCRIPTIONS.each_key do |metric| metrics[metric].set(host_stat[:labels], host_stat[:stats][metric]) end end end |