Class: PgHero::Database
- Inherits:
-
Object
- Object
- PgHero::Database
- Includes:
- Methods::Basic, Methods::Connections, Methods::Explain, Methods::Indexes, Methods::Kill, Methods::Maintenance, Methods::Queries, Methods::QueryStats, Methods::Replica, Methods::Sequences, Methods::Space, Methods::SuggestedIndexes, Methods::System, Methods::Tables, Methods::Users
- Defined in:
- lib/pghero/database.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #cache_hit_rate_threshold ⇒ Object
- #capture_query_stats? ⇒ Boolean
- #db_instance_identifier ⇒ Object
-
#initialize(id, config) ⇒ Database
constructor
A new instance of Database.
- #long_running_query_sec ⇒ Object
- #name ⇒ Object
- #slow_query_calls ⇒ Object
- #slow_query_ms ⇒ Object
- #total_connections_threshold ⇒ Object
Methods included from Methods::Users
Methods included from Methods::Tables
#table_caching, #table_hit_rate, #table_stats, #unused_tables
Methods included from Methods::System
#access_key_id, #connection_stats, #cpu_usage, #rds_stats, #read_iops_stats, #region, #replication_lag_stats, #secret_access_key, #system_stats_enabled?, #write_iops_stats
Methods included from Methods::SuggestedIndexes
#autoindex, #autoindex_all, #best_index, #suggested_indexes, #suggested_indexes_by_query, #suggested_indexes_enabled?
Methods included from Methods::Space
#capture_space_stats, #database_size, #relation_sizes
Methods included from Methods::Sequences
Methods included from Methods::Replica
Methods included from Methods::QueryStats
#capture_query_stats, #disable_query_stats, #enable_query_stats, #historical_query_stats_enabled?, #insert_stats, #query_stats, #query_stats_available?, #query_stats_enabled?, #query_stats_extension_enabled?, #query_stats_readable?, #reset_query_stats, #slow_queries, #supports_query_hash?, #supports_query_stats_user?
Methods included from Methods::Queries
#blocked_queries, #locks, #long_running_queries, #running_queries
Methods included from Methods::Maintenance
#autovacuum_danger, #maintenance_info, #transaction_id_danger
Methods included from Methods::Kill
#kill, #kill_all, #kill_long_running_queries
Methods included from Methods::Indexes
#duplicate_indexes, #index_caching, #index_hit_rate, #index_usage, #indexes, #invalid_indexes, #missing_indexes, #unused_indexes
Methods included from Methods::Explain
Methods included from Methods::Connections
#connection_sources, #total_connections
Methods included from Methods::Basic
#database_name, #server_version, #settings, #ssl_used?
Constructor Details
#initialize(id, config) ⇒ Database
Returns a new instance of Database.
21 22 23 24 |
# File 'lib/pghero/database.rb', line 21 def initialize(id, config) @id = id @config = config || {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
19 20 21 |
# File 'lib/pghero/database.rb', line 19 def config @config end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19 20 21 |
# File 'lib/pghero/database.rb', line 19 def id @id end |
Instance Method Details
#cache_hit_rate_threshold ⇒ Object
38 39 40 |
# File 'lib/pghero/database.rb', line 38 def cache_hit_rate_threshold (config["cache_hit_rate_threshold"] || PgHero.config["cache_hit_rate_threshold"] || PgHero.cache_hit_rate_threshold).to_i end |
#capture_query_stats? ⇒ Boolean
34 35 36 |
# File 'lib/pghero/database.rb', line 34 def capture_query_stats? config["capture_query_stats"] != false end |
#db_instance_identifier ⇒ Object
30 31 32 |
# File 'lib/pghero/database.rb', line 30 def db_instance_identifier @db_instance_identifier ||= @config["db_instance_identifier"] end |
#long_running_query_sec ⇒ Object
54 55 56 |
# File 'lib/pghero/database.rb', line 54 def long_running_query_sec (config["long_running_query_sec"] || PgHero.config["long_running_query_sec"] || PgHero.long_running_query_sec).to_i end |
#name ⇒ Object
26 27 28 |
# File 'lib/pghero/database.rb', line 26 def name @name ||= @config["name"] || id.titleize end |
#slow_query_calls ⇒ Object
50 51 52 |
# File 'lib/pghero/database.rb', line 50 def slow_query_calls (config["slow_query_calls"] || PgHero.config["slow_query_calls"] || PgHero.slow_query_calls).to_i end |
#slow_query_ms ⇒ Object
46 47 48 |
# File 'lib/pghero/database.rb', line 46 def slow_query_ms (config["slow_query_ms"] || PgHero.config["slow_query_ms"] || PgHero.slow_query_ms).to_i end |
#total_connections_threshold ⇒ Object
42 43 44 |
# File 'lib/pghero/database.rb', line 42 def total_connections_threshold (config["total_connections_threshold"] || PgHero.config["total_connections_threshold"] || PgHero.total_connections_threshold).to_i end |