Class: Cloudscale::Plugins::MySqlQueryCache
- Defined in:
- lib/cloudscale/plugins/mysql/mysql_querycache.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Attributes inherited from Plugin
Instance Method Summary collapse
- #collect(agentInstanceId) ⇒ Object
-
#initialize ⇒ MySqlQueryCache
constructor
A new instance of MySqlQueryCache.
- #is_enabled ⇒ Object
- #report_database_stats(registry, metrics) ⇒ Object
Methods inherited from Plugin
Constructor Details
#initialize ⇒ MySqlQueryCache
Returns a new instance of MySqlQueryCache.
18 19 20 21 22 23 |
# File 'lib/cloudscale/plugins/mysql/mysql_querycache.rb', line 18 def initialize super if is_enabled @connection = Preops::MysqlPreop.instance.connection end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
12 13 14 |
# File 'lib/cloudscale/plugins/mysql/mysql_querycache.rb', line 12 def connection @connection end |
Instance Method Details
#collect(agentInstanceId) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/cloudscale/plugins/mysql/mysql_querycache.rb', line 25 def collect(agentInstanceId) registry = Monitor::Registry.instance metrics = Metrics::Agent.new log.info("Calling Collect on MysqlQueryCache") end |
#is_enabled ⇒ Object
14 15 16 |
# File 'lib/cloudscale/plugins/mysql/mysql_querycache.rb', line 14 def is_enabled Preops::MysqlPreop.instance.is_enabled end |
#report_database_stats(registry, metrics) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cloudscale/plugins/mysql/mysql_querycache.rb', line 32 def report_database_stats(registry, metrics) results = mysql.query('SHOW GLOBAL STATUS') registry.metrics["mysql.qcache.queries.cache"] = metrics.gauge :queriesInCache do { :value => results['queriesInCache'] } end registry.metrics["mysql.qcache.cache.hits"] = metrics.gauge :cacheHits do { :value => results['cacheHits'] } end registry.metrics["mysql.qcache.inserts"] = metrics.gauge :inserts do { :value => results['inserts'] } end registry.metrics["mysql.qcache.notcached"] = metrics.gauge :notCached do { :value => results['notCached'] } end registry.metrics["mysql.qcache.lowmem.prunes"] = metrics.gauge :lowMemPrunes do { :value => results['lowMemPrunes'] } end end |