Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mysql] enhancing the catalog of metrics reported. #2116

Merged
merged 1 commit into from
Feb 1, 2016
Merged

Conversation

truthbk
Copy link
Member

@truthbk truthbk commented Dec 1, 2015

MySQL Check Enhancement

This PR combines multiple efforts by @ovaistariq (huge effort!) @garnermccloud @c960657 @zdannar @polynomial @leucos to greatly improve the catalog of MySQL metrics reported. Metrics have been added to provide additional insight into:

  • Performance Schema
  • Replication
  • Galera Cluster
  • Per schema performance and size metrics

Additional work has gone into improving the test and attempt to test the entire catalog.

This overhaul will now allow us to provide the following new metrics (hang tight):

New Status Metrics

* MySQL name: 'Com_replace' - Datadog metric name: 'mysql.performance.com_replace' - Metric type: RATE
* MySQL name: 'Com_load' - Datadog metric name: 'mysql.performance.com_load' - Metric type: RATE
* MySQL name: 'Aborted_clients' - Datadog metric name: 'mysql.net.aborted_clients' - Metric type: RATE
* MySQL name: 'Aborted_connects' - Datadog metric name: 'mysql.net.aborted_connects' - Metric type: RATE
* MySQL name: 'Bytes_sent' - Datadog metric name: 'mysql.performance.bytes_sent' - Metric type: RATE
* MySQL name: 'Bytes_received' - Datadog metric name: 'mysql.performance.bytes_received' - Metric type: RATE
* MySQL name: 'Qcache_hits' - Datadog metric name: 'mysql.performance.qcache_hits' - Metric type: RATE
* MySQL name: 'Qcache_inserts' - Datadog metric name: 'mysql.performance.qcache_inserts' - Metric type: RATE
* MySQL name: 'Qcache_lowmem_prunes' - Datadog metric name: 'mysql.performance.qcache_lowmem_prunes' - Metric type: RATE

MyISAM Metrics

* MySQL name: 'Key_buffer_bytes_unflushed' - Datadog metric name: 'mysql.myisam.key_buffer_bytes_unflushed' - Metric type: RATE
* MySQL name: 'Key_buffer_bytes_used' - Datadog metric name: 'mysql.myisam.key_buffer_bytes_used' - Metric type: GAUGE
* MySQL name: 'Key_read_requests' - Datadog metric name: 'mysql.myisam.key_read_requests' - Metric type: RATE
* MySQL name: 'Key_reads' - Datadog metric name: 'mysql.myisam.key_reads' - Metric type: RATE
* MySQL name: 'Key_write_requests' - Datadog metric name: 'mysql.myisam.key_write_requests' - Metric type: RATE
* MySQL name: 'Key_writes' - Datadog metric name: 'mysql.myisam.key_writes' - Metric type: RATE

Global Variable Metrics

* MySQL name: 'Key_buffer_size' - Datadog metric name: 'mysql.myisam.key_buffer_size' - Metric type: GAUGE
* MySQL name: 'Key_cache_utilization' - Datadog metric name: 'mysql.performance.key_cache_utilization' - Metric type: GAUGE
* MySQL name: 'max_connections' - Datadog metric name: 'mysql.net.max_connections_available' - Metric type: GAUGE
* MySQL name: 'query_cache_size' - Datadog metric name: 'mysql.performance.qcache_size' - Metric type: GAUGE
* MySQL name: 'table_open_cache' - Datadog metric name: 'mysql.performance.table_open_cache' - Metric type: GAUGE
* MySQL name: 'thread_cache_size' - Datadog metric name: 'mysql.performance.thread_cache_size' - Metric type: GAUGE

InnoDB Metrics

* MySQL name: 'Innodb_data_reads' - Datadog metric name: 'mysql.innodb.data_reads' - Metric type: RATE
* MySQL name: 'Innodb_data_writes' - Datadog metric name: 'mysql.innodb.data_writes' - Metric type: RATE
* MySQL name: 'Innodb_os_log_fsyncs' - Datadog metric name: 'mysql.innodb.os_log_fsyncs' - Metric type: RATE
* MySQL name: 'Innodb_mutex_spin_waits' - Datadog metric name: 'mysql.innodb.mutex_spin_waits' - Metric type: RATE
* MySQL name: 'Innodb_mutex_spin_rounds' - Datadog metric name: 'mysql.innodb.mutex_spin_rounds' - Metric type: RATE
* MySQL name: 'Innodb_mutex_os_waits' - Datadog metric name: 'mysql.innodb.mutex_os_waits' - Metric type: RATE
* MySQL name: 'Innodb_row_lock_waits' - Datadog metric name: 'mysql.innodb.row_lock_waits' - Metric type: RATE
* MySQL name: 'Innodb_row_lock_time' - Datadog metric name: 'mysql.innodb.row_lock_time' - Metric type: RATE
* MySQL name: 'Innodb_row_lock_current_waits' - Datadog metric name: 'mysql.innodb.row_lock_current_waits' - Metric type: GAUGE
* MySQL name: 'Innodb_current_row_locks' - Datadog metric name: 'mysql.innodb.current_row_locks' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_bytes_dirty' - Datadog metric name: 'mysql.innodb.buffer_pool_dirty' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_bytes_free' - Datadog metric name: 'mysql.innodb.buffer_pool_free' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_bytes_used' - Datadog metric name: 'mysql.innodb.buffer_pool_used' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_bytes_total' - Datadog metric name: 'mysql.innodb.buffer_pool_total' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_read_requests' - Datadog metric name: 'mysql.innodb.buffer_pool_read_requests' - Metric type: RATE
* MySQL name: 'Innodb_buffer_pool_reads' - Datadog metric name: 'mysql.innodb.buffer_pool_reads' - Metric type: RATE
* MySQL name: 'Innodb_buffer_pool_pages_utilization' - Datadog metric name: 'mysql.innodb.buffer_pool_utilization' - Metric type: GAUGE

BINLog Metrics

* MySQL name: 'Binlog_space_usage_bytes' - Datadog metric name: 'mysql.binlog.disk_use' - Metric type: GAUGE

Additional (and optional) Status Metrics

* MySQL name: 'Binlog_cache_disk_use' - Datadog metric name: 'mysql.binlog.cache_disk_use' - Metric type: GAUGE
* MySQL name: 'Binlog_cache_use' - Datadog metric name: 'mysql.binlog.cache_use' - Metric type: GAUGE
* MySQL name: 'Handler_commit' - Datadog metric name: 'mysql.performance.handler_commit' - Metric type: RATE
* MySQL name: 'Handler_delete' - Datadog metric name: 'mysql.performance.handler_delete' - Metric type: RATE
* MySQL name: 'Handler_prepare' - Datadog metric name: 'mysql.performance.handler_prepare' - Metric type: RATE
* MySQL name: 'Handler_read_first' - Datadog metric name: 'mysql.performance.handler_read_first' - Metric type: RATE
* MySQL name: 'Handler_read_key' - Datadog metric name: 'mysql.performance.handler_read_key' - Metric type: RATE
* MySQL name: 'Handler_read_next' - Datadog metric name: 'mysql.performance.handler_read_next' - Metric type: RATE
* MySQL name: 'Handler_read_prev' - Datadog metric name: 'mysql.performance.handler_read_prev' - Metric type: RATE
* MySQL name: 'Handler_read_rnd' - Datadog metric name: 'mysql.performance.handler_read_rnd' - Metric type: RATE
* MySQL name: 'Handler_read_rnd_next' - Datadog metric name: 'mysql.performance.handler_read_rnd_next' - Metric type: RATE
* MySQL name: 'Handler_rollback' - Datadog metric name: 'mysql.performance.handler_rollback' - Metric type: RATE
* MySQL name: 'Handler_update' - Datadog metric name: 'mysql.performance.handler_update' - Metric type: RATE
* MySQL name: 'Handler_write' - Datadog metric name: 'mysql.performance.handler_write' - Metric type: RATE
* MySQL name: 'Opened_tables' - Datadog metric name: 'mysql.performance.opened_tables' - Metric type: RATE
* MySQL name: 'Qcache_total_blocks' - Datadog metric name: 'mysql.performance.qcache_total_blocks' - Metric type: GAUGE
* MySQL name: 'Qcache_free_blocks' - Datadog metric name: 'mysql.performance.qcache_free_blocks' - Metric type: GAUGE
* MySQL name: 'Qcache_free_memory' - Datadog metric name: 'mysql.performance.qcache_free_memory' - Metric type: GAUGE
* MySQL name: 'Qcache_not_cached' - Datadog metric name: 'mysql.performance.qcache_not_cached' - Metric type: RATE
* MySQL name: 'Qcache_queries_in_cache' - Datadog metric name: 'mysql.performance.qcache_queries_in_cache' - Metric type: GAUGE
* MySQL name: 'Select_full_join' - Datadog metric name: 'mysql.performance.select_full_join' - Metric type: RATE
* MySQL name: 'Select_full_range_join' - Datadog metric name: 'mysql.performance.select_full_range_join' - Metric type: RATE
* MySQL name: 'Select_range' - Datadog metric name: 'mysql.performance.select_range' - Metric type: RATE
* MySQL name: 'Select_range_check' - Datadog metric name: 'mysql.performance.select_range_check' - Metric type: RATE
* MySQL name: 'Select_scan' - Datadog metric name: 'mysql.performance.select_scan' - Metric type: RATE
* MySQL name: 'Sort_merge_passes' - Datadog metric name: 'mysql.performance.sort_merge_passes' - Metric type: RATE
* MySQL name: 'Sort_range' - Datadog metric name: 'mysql.performance.sort_range' - Metric type: RATE
* MySQL name: 'Sort_rows' - Datadog metric name: 'mysql.performance.sort_rows' - Metric type: RATE
* MySQL name: 'Sort_scan' - Datadog metric name: 'mysql.performance.sort_scan' - Metric type: RATE
* MySQL name: 'Table_locks_immediate' - Datadog metric name: 'mysql.performance.table_locks_immediate' - Metric type: RATE
* MySQL name: 'Threads_cached' - Datadog metric name: 'mysql.performance.threads_cached' - Metric type: GAUGE
* MySQL name: 'Threads_created' - Datadog metric name: 'mysql.performance.threads_created' - Metric type: GAUGE)

Optional Status metrics available for MySQL >= 5.6.6

* MySQL name: 'Table_open_cache_hits' - Datadog metric name: 'mysql.performance.table_cache_hits' - Metric type: RATE
* MySQL name: 'Table_open_cache_misses' - Datadog metric name: 'mysql.performance.table_cache_misses' - Metric type: RATE

Optional InnoDB Metrics

* MySQL name: 'Innodb_active_transactions' - Datadog metric name: 'mysql.innodb.active_transactions' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_bytes_data' - Datadog metric name: 'mysql.innodb.buffer_pool_data' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_pages_data' - Datadog metric name: 'mysql.innodb.buffer_pool_pages_data' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_pages_dirty' - Datadog metric name: 'mysql.innodb.buffer_pool_pages_dirty' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_pages_flushed' - Datadog metric name: 'mysql.innodb.buffer_pool_pages_flushed' - Metric type: RATE
* MySQL name: 'Innodb_buffer_pool_pages_free' - Datadog metric name: 'mysql.innodb.buffer_pool_pages_free' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_pages_total' - Datadog metric name: 'mysql.innodb.buffer_pool_pages_total' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_read_ahead' - Datadog metric name: 'mysql.innodb.buffer_pool_read_ahead' - Metric type: RATE
* MySQL name: 'Innodb_buffer_pool_read_ahead_evicted' - Datadog metric name: 'mysql.innodb.buffer_pool_read_ahead_evicted' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_read_ahead_rnd' - Datadog metric name: 'mysql.innodb.buffer_pool_read_ahead_rnd' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_wait_free' - Datadog metric name: 'mysql.innodb.buffer_pool_wait_free' - Metric type: GAUGE
* MySQL name: 'Innodb_buffer_pool_write_requests' - Datadog metric name: 'mysql.innodb.buffer_pool_write_requests' - Metric type: RATE
* MySQL name: 'Innodb_checkpoint_age' - Datadog metric name: 'mysql.innodb.checkpoint_age' - Metric type: GAUGE
* MySQL name: 'Innodb_current_transactions' - Datadog metric name: 'mysql.innodb.current_transactions' - Metric type: GAUGE
* MySQL name: 'Innodb_data_fsyncs' - Datadog metric name: 'mysql.innodb.data_fsyncs' - Metric type: GAUGE
* MySQL name: 'Innodb_data_pending_fsyncs' - Datadog metric name: 'mysql.innodb.data_pending_fsyncs' - Metric type: GAUGE
* MySQL name: 'Innodb_data_pending_reads' - Datadog metric name: 'mysql.innodb.data_pending_reads' - Metric type: GAUGE
* MySQL name: 'Innodb_data_pending_writes' - Datadog metric name: 'mysql.innodb.data_pending_writes' - Metric type: GAUGE
* MySQL name: 'Innodb_data_read' - Datadog metric name: 'mysql.innodb.data_read' - Metric type: GAUGE
* MySQL name: 'Innodb_data_written' - Datadog metric name: 'mysql.innodb.data_written' - Metric type: GAUGE
* MySQL name: 'Innodb_dblwr_pages_written' - Datadog metric name: 'mysql.innodb.dblwr_pages_written' - Metric type: GAUGE
* MySQL name: 'Innodb_dblwr_writes' - Datadog metric name: 'mysql.innodb.dblwr_writes' - Metric type: GAUGE
* MySQL name: 'Innodb_hash_index_cells_total' - Datadog metric name: 'mysql.innodb.hash_index_cells_total' - Metric type: GAUGE
* MySQL name: 'Innodb_hash_index_cells_used' - Datadog metric name: 'mysql.innodb.hash_index_cells_used' - Metric type: GAUGE
* MySQL name: 'Innodb_history_list_length' - Datadog metric name: 'mysql.innodb.history_list_length' - Metric type: GAUGE
* MySQL name: 'Innodb_ibuf_free_list' - Datadog metric name: 'mysql.innodb.ibuf_free_list' - Metric type: GAUGE
* MySQL name: 'Innodb_ibuf_merged' - Datadog metric name: 'mysql.innodb.ibuf_merged' - Metric type: RATE
* MySQL name: 'Innodb_ibuf_merged_delete_marks' - Datadog metric name: 'mysql.innodb.ibuf_merged_delete_marks' - Metric type: RATE
* MySQL name: 'Innodb_ibuf_merged_deletes' - Datadog metric name: 'mysql.innodb.ibuf_merged_deletes' - Metric type: RATE
* MySQL name: 'Innodb_ibuf_merged_inserts' - Datadog metric name: 'mysql.innodb.ibuf_merged_inserts' - Metric type: RATE
* MySQL name: 'Innodb_ibuf_merges' - Datadog metric name: 'mysql.innodb.ibuf_merges' - Metric type: RATE
* MySQL name: 'Innodb_ibuf_segment_size' - Datadog metric name: 'mysql.innodb.ibuf_segment_size' - Metric type: GAUGE
* MySQL name: 'Innodb_ibuf_size' - Datadog metric name: 'mysql.innodb.ibuf_size' - Metric type: GAUGE
* MySQL name: 'Innodb_lock_structs' - Datadog metric name: 'mysql.innodb.lock_structs' - Metric type: RATE
* MySQL name: 'Innodb_locked_tables' - Datadog metric name: 'mysql.innodb.locked_tables' - Metric type: GAUGE
* MySQL name: 'Innodb_locked_transactions' - Datadog metric name: 'mysql.innodb.locked_transactions' - Metric type: GAUGE
* MySQL name: 'Innodb_log_waits' - Datadog metric name: 'mysql.innodb.log_waits' - Metric type: RATE
* MySQL name: 'Innodb_log_write_requests' - Datadog metric name: 'mysql.innodb.log_write_requests' - Metric type: RATE
* MySQL name: 'Innodb_log_writes' - Datadog metric name: 'mysql.innodb.log_writes' - Metric type: RATE
* MySQL name: 'Innodb_lsn_current' - Datadog metric name: 'mysql.innodb.lsn_current' - Metric type: RATE
* MySQL name: 'Innodb_lsn_flushed' - Datadog metric name: 'mysql.innodb.lsn_flushed' - Metric type: RATE
* MySQL name: 'Innodb_lsn_last_checkpoint' - Datadog metric name: 'mysql.innodb.lsn_last_checkpoint' - Metric type: RATE
* MySQL name: 'Innodb_mem_adaptive_hash' - Datadog metric name: 'mysql.innodb.mem_adaptive_hash' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_additional_pool' - Datadog metric name: 'mysql.innodb.mem_additional_pool' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_dictionary' - Datadog metric name: 'mysql.innodb.mem_dictionary' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_file_system' - Datadog metric name: 'mysql.innodb.mem_file_system' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_lock_system' - Datadog metric name: 'mysql.innodb.mem_lock_system' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_page_hash' - Datadog metric name: 'mysql.innodb.mem_page_hash' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_recovery_system' - Datadog metric name: 'mysql.innodb.mem_recovery_system' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_thread_hash' - Datadog metric name: 'mysql.innodb.mem_thread_hash' - Metric type: GAUGE
* MySQL name: 'Innodb_mem_total' - Datadog metric name: 'mysql.innodb.mem_total' - Metric type: GAUGE
* MySQL name: 'Innodb_os_file_fsyncs' - Datadog metric name: 'mysql.innodb.os_file_fsyncs' - Metric type: RATE
* MySQL name: 'Innodb_os_file_reads' - Datadog metric name: 'mysql.innodb.os_file_reads' - Metric type: RATE
* MySQL name: 'Innodb_os_file_writes' - Datadog metric name: 'mysql.innodb.os_file_writes' - Metric type: RATE
* MySQL name: 'Innodb_os_log_pending_fsyncs' - Datadog metric name: 'mysql.innodb.os_log_pending_fsyncs' - Metric type: RATE
* MySQL name: 'Innodb_os_log_pending_writes' - Datadog metric name: 'mysql.innodb.os_log_pending_writes' - Metric type: RATE
* MySQL name: 'Innodb_os_log_written' - Datadog metric name: 'mysql.innodb.os_log_written' - Metric type: RATE
* MySQL name: 'Innodb_pages_created' - Datadog metric name: 'mysql.innodb.pages_created' - Metric type: RATE
* MySQL name: 'Innodb_pages_read' - Datadog metric name: 'mysql.innodb.pages_read' - Metric type: RATE
* MySQL name: 'Innodb_pages_written' - Datadog metric name: 'mysql.innodb.pages_written' - Metric type: RATE
* MySQL name: 'Innodb_pending_aio_log_ios' - Datadog metric name: 'mysql.innodb.pending_aio_log_ios' - Metric type: RATE
* MySQL name: 'Innodb_pending_aio_sync_ios' - Datadog metric name: 'mysql.innodb.pending_aio_sync_ios' - Metric type: RATE
* MySQL name: 'Innodb_pending_buffer_pool_flushes' - Datadog metric name: 'mysql.innodb.pending_buffer_pool_flushes' - Metric type: RATE
* MySQL name: 'Innodb_pending_checkpoint_writes' - Datadog metric name: 'mysql.innodb.pending_checkpoint_writes' - Metric type: RATE
* MySQL name: 'Innodb_pending_ibuf_aio_reads' - Datadog metric name: 'mysql.innodb.pending_ibuf_aio_reads' - Metric type: RATE
* MySQL name: 'Innodb_pending_log_flushes' - Datadog metric name: 'mysql.innodb.pending_log_flushes' - Metric type: RATE
* MySQL name: 'Innodb_pending_log_writes' - Datadog metric name: 'mysql.innodb.pending_log_writes' - Metric type: RATE
* MySQL name: 'Innodb_pending_normal_aio_reads' - Datadog metric name: 'mysql.innodb.pending_normal_aio_reads' - Metric type: RATE
* MySQL name: 'Innodb_pending_normal_aio_writes' - Datadog metric name: 'mysql.innodb.pending_normal_aio_writes' - Metric type: RATE
* MySQL name: 'Innodb_queries_inside' - Datadog metric name: 'mysql.innodb.queries_inside' - Metric type: RATE
* MySQL name: 'Innodb_queries_queued' - Datadog metric name: 'mysql.innodb.queries_queued' - Metric type: RATE
* MySQL name: 'Innodb_read_views' - Datadog metric name: 'mysql.innodb.read_views' - Metric type: GAUGE
* MySQL name: 'Innodb_rows_deleted' - Datadog metric name: 'mysql.innodb.rows_deleted' - Metric type: RATE
* MySQL name: 'Innodb_rows_inserted' - Datadog metric name: 'mysql.innodb.rows_inserted' - Metric type: RATE
* MySQL name: 'Innodb_rows_read' - Datadog metric name: 'mysql.innodb.rows_read' - Metric type: RATE
* MySQL name: 'Innodb_rows_updated' - Datadog metric name: 'mysql.innodb.rows_updated' - Metric type: RATE
* MySQL name: 'Innodb_s_lock_os_waits' - Datadog metric name: 'mysql.innodb.s_lock_os_waits' - Metric type: RATE
* MySQL name: 'Innodb_s_lock_spin_rounds' - Datadog metric name: 'mysql.innodb.s_lock_spin_rounds' - Metric type: RATE
* MySQL name: 'Innodb_s_lock_spin_waits' - Datadog metric name: 'mysql.innodb.s_lock_spin_waits' - Metric type: RATE
* MySQL name: 'Innodb_semaphore_wait_time' - Datadog metric name: 'mysql.innodb.semaphore_wait_time' - Metric type: GAUGE
* MySQL name: 'Innodb_semaphore_waits' - Datadog metric name: 'mysql.innodb.semaphore_waits' - Metric type: GAUGE
* MySQL name: 'Innodb_tables_in_use' - Datadog metric name: 'mysql.innodb.tables_in_use' - Metric type: GAUGE
* MySQL name: 'Innodb_x_lock_os_waits' - Datadog metric name: 'mysql.innodb.x_lock_os_waits' - Metric type: RATE
* MySQL name: 'Innodb_x_lock_spin_rounds' - Datadog metric name: 'mysql.innodb.x_lock_spin_rounds' - Metric type: RATE
* MySQL name: 'Innodb_x_lock_spin_waits' - Datadog metric name: 'mysql.innodb.x_lock_spin_waits' - Metric type: RATE

Galera Cluster Metrics

* MySQL name: 'wsrep_cluster_size' - Datadog metric name: 'mysql.galera.wsrep_cluster_size' - Metric type: GAUGE
* MySQL name: 'wsrep_local_recv_queue_avg' - Datadog metric name: 'mysql.galera.wsrep_local_recv_queue_avg' - Metric type: GAUGE
* MySQL name: 'wsrep_flow_control_paused' - Datadog metric name: 'mysql.galera.wsrep_flow_control_paused' - Metric type: GAUGE
* MySQL name: 'wsrep_cert_deps_distance' - Datadog metric name: 'mysql.galera.wsrep_cert_deps_distance' - Metric type: GAUGE
* MySQL name: 'wsrep_local_send_queue_avg' - Datadog metric name: 'mysql.galera.wsrep_local_send_queue_avg' - Metric type: GAUGE

Performance Metrics

* MySQL name: 'query_run_time_avg' : 'mysql.performance.query_run_time.avg' - Metric type: GAUGE
* MySQL name: 'perf_digest_95th_percentile_avg_us' - Datadog metric name: 'mysql.performance.digest_95th_percentile.avg_us' - Metric type: GAUGE

Schema Metrics

* MySQL name: 'information_schema_size' - Datadog metric name: 'mysql.info.schema.size' - Metric type: GAUGE

Replication Metrics

* MySQL name: 'Seconds_Behind_Master' - Datadog metric name: 'mysql.replication.seconds_behind_master' - Metric type: GAUGE

Qcache Utilization Metrics

* Reference name: 'Qcache_utilization' - Datadog metric name: 'mysql.performance.qcache.utilization' - Metric type: GAUGE
* Reference name: 'Qcache_instant_utilization' - Datadog metric name: 'mysql.performance.qcache.utilization.instant' - Metric type: GAUGE

PRs referenced:

@truthbk truthbk changed the title [mysql] PR consolidating several efforts to enhance the catalog of metrics reported [mysql] Enhancing the catalog of metrics reported. Dec 1, 2015
@truthbk truthbk changed the title [mysql] Enhancing the catalog of metrics reported. [mysql] enhancing the catalog of metrics reported. Dec 1, 2015
@truthbk truthbk force-pushed the jaime/mysql_cons branch 6 times, most recently from c25c519 to 092afc8 Compare December 8, 2015 23:46
@truthbk truthbk force-pushed the jaime/mysql_cons branch 2 times, most recently from e16020d to c02acf7 Compare December 9, 2015 15:19
@@ -6,6 +6,7 @@

# 3p
import pymysql
import psutil # permissions issues?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add a try except ImportError here. psutil might not be available on source installs that don't have a compiler

@remh
Copy link

remh commented Dec 9, 2015

@truthbk can you describe what metrics have been removed (if any) and added ? This PR is huge and can potentially break a lot of things for users as it's one of the most used integrations. So the more details we have about what it does the better :)


def __init__(self, name, init_config, agentConfig, instances=None):
AgentCheck.__init__(self, name, init_config, agentConfig, instances)
self.mysql_version = {}
self.greater_502 = {}
self.host = None
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't store instance level variables at the AgentCheck level. You might end up breaking multi instances configuration

@truthbk
Copy link
Member Author

truthbk commented Dec 10, 2015

@remh updated PR description with new metric list. Let me know if you want me to put it somewhere else too.

@ovaistariq
Copy link
Contributor

@leucos I agree that to monitor query cache fragmentation you need to be able to monitor the ratio of Qcache_free_blocks and Qcache_free_memory so it would be beneficial to report Qcache_free_blocks for users of MySQL query cache.

@olivielpeau
Copy link
Member

I've only started reviewing the PR, some great work here :)

I've added a bunch of comments on metrics that are reported by MySql as "counters since the server started", so that should be rates instead of gauges. That said a lot of these metrics are useful as gauges when computed in ratios with other gauges, so we need to be clear on the type we actually want to send these metrics as. Related to the discussion in #2173.

'Innodb_os_file_reads': ('mysql.innodb.os_file_reads', RATE),
'Innodb_os_file_writes': ('mysql.innodb.os_file_writes', RATE),
'Innodb_os_log_pending_fsyncs': ('mysql.innodb.os_log_pending_fsyncs', RATE),
'Innodb_os_log_pending_writes': ('mysql.innodb.os_log_pending_writes', RATE),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Innodb_os_log_pending_fsyncs and Innodb_os_log_pending_writes are probably gauges (http://dev.mysql.com/doc/refman/5.7/en/server-status-variables.html#statvar_Innodb_os_log_pending_fsyncs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@olivielpeau
Copy link
Member

One last thing: could you document the ssl option in mysql.yaml.example?
(According to https://github.com/PyMySQL/PyMySQL/blob/97b88bfec9b88aa047d93570cf8b78f6ab0894ce/pymysql/connections.py#L563-L565 it should be a dict of the parameters defined here: http://dev.mysql.com/doc/refman/5.7/en/mysql-ssl-set.html)

There are still a 2 comments from @remh that are not addressed, but apart from that it looks great!

@truthbk
Copy link
Member Author

truthbk commented Jan 22, 2016

@olivielpeau comments have been addressed, and ssl section added to config file.

Thanks a ton for the long review!


# 3p
import pymysql
try:
import psutil # permissions issues?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean exactly by this comment? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing - will be removed. psutil has like two different levels of usage stats - not all stats are available if you don't have privileges, but we should handle that case just fine.

@truthbk truthbk force-pushed the jaime/mysql_cons branch 3 times, most recently from f7f502b to a39e38c Compare January 28, 2016 20:50
@olivielpeau
Copy link
Member

Awesome, looks good! Could you squash your commits?

Let's merge once the CI passes 🎉

@truthbk truthbk force-pushed the jaime/mysql_cons branch 7 times, most recently from 0f23096 to 1b72f70 Compare January 29, 2016 21:47
…cation, caching, ssl.

The following changes have been made to the mysql check:
a. Its heavily inspired by MySQL cacti template provided by Percona
which contains an extensive set of checks that are important to measure
the performance and health of a MySQL server. For reference please look
at this URL:
http://www.percona.com/doc/percona-monitoring-plugins/1.1/cacti/mysql-templates.html#sample-graphs

b. Many of the important metrics exposed by Percona Server / MariaDB Server are
not available in MySQL Server as status variables, these have been added
by parsing the output of "SHOW ENGINE INNODB STATUS"

Collect Binary log stats only when binlogging is enabled

mysql.net.max_connections_available was improperly set to be a RATE instead of a GAUGE

The metric mysql.innodb.row_lock_waits was incorrectly being sent as GAUGE while its a RATE

Float values in InnoDB status were not being parsed correctly

[mysql] Cleaned up, rebased and added testing to PR for Innodb Status parsing for Percona metrics

Check for mysql version 5.6.6 metrics

Add a new check mysql_ps which collects metrics available with performance_schema. Currrently it only collects 95th percentile query run time

- Added a new check that reports avg MySQL query response time per
  schema. This will be really helpful for those applications that are
multi-tenant to know which schema makes up for most of the query
response time.

The average query response time per schema was not being computed correctly

[mysql] Added Galera specific gauges.

[mysql] Consolidating multiple efforts into revamped MySQL check.

Close connection if anything happens.

Try to report usage stats using psutil.

Cleaning up collection of query_run_time_avg - putting it into PERFORMANCE_VARS.

Add mysql.replication.slave_running service check

[mysql] Multiple fixes, clean-up, resilience for different versions.

Don't check db if db is None.

More characters we need to strip of rows.

Minor improvements to mysql parser.

Actually collect extra innodb stats.

Fixing generator.

Add some more logging.

Metrics unavailable in 5.5 - considering case.

Support multiple MySQL instances on same host.

Older MySQL's will not support some performance queries.

Performance metrics may be unavailable in an inactive DB.

Service check should no loger send a 'host' tag, but a 'server' tag instead.

We can grab OSX stats from PS - but only total cpu_time no break down.

Adding extra_innodb_metrics to test. Updating ruby script to create performance_schema stats.

test already in main mysql.py test - removing.

Adding support for per schema size reporting.

Add test support for schema size metrics.

Adding some resilience for None metrics

[mysql_test] Both performance metrics will be missing if ver<5.6.0.

We also get metrics for information and performance schemas for schema size.

[mysql] Fixing minor issues.

[mysql] handle with care: psutil could be unavaiable in source installs.

[mysql] Adds new query cache metrics

This commit adds 7 new query cache (QCache) metrics to the mysql
monitor:

- Qcache_free_blocks
- Qcache_free_memory
- Qcache_inserts
- Qcache_lowmem_prunes
- Qcache_not_cached
- Qcache_queries_in_cache
- Qcache_total_blocks

These metrics are very helpful tuning the query cache.

[mysql] Adding handle_prepare metrics.

[mysql] adding qcache utilization stats - agent computed.

[mysql] adding synthetic vars to test.

[mysql] Adding SSL support.

[mysql] removing mysql_ps.yaml.example, never used, just debris from PR merge.

[mysql] some clean-up.

[mysql] adding context managers for cursors, check perf schema is enabled. Touch up..

[mysql] removing unused schema dict flakes.

[mysql] convert strings to ints and floats.

[mysql] make sure performance schema is enabled before grabbing performance metrics.

[mysql] if we've got no hits, also report instant usage as 0.

[mysql] adding variables and performance note to mysql yaml sample config.

[mysql] use _is_affirmative, use defaultdict instead of whitelist.

[mysql] removing whitelist

[mysql] qcache stats are per instance.

[mysql] helper functions to keep track of instance specific vars and stats.

[mysql] cleaning up mysql SSL connecting code (ssl param can be None).

[mysql] fixing types for MySQL metrics.

[mysql] adding count and monotonic_count as possible metric types.

[mysql] adding configuration note.

[mysql] use contextmanager to ensure close() of db connection.

[mysql] adding ssl section to mysql sample config file.

[mysql] do not compute metrics if source metrics unavailable.

[mysq] use correct service_check tags for Replication check.

[mysql] use psutil to grab pid instead of spawning a subprocess. Nitpicks.

[mysql] Ensure db conenction ready. Fix test. Always send replica status gauge.

[mysql] fix test - replication service_check tags.

[mysql] always send deprecated gauge for slave status.

[mysql] some more nitpicking.
@olivielpeau
Copy link
Member

Let's :shipit: !

🎉 🚀 🎆

truthbk added a commit that referenced this pull request Feb 1, 2016
[mysql] enhancing the catalog of metrics reported.
@truthbk truthbk merged commit f6a463a into master Feb 1, 2016
@truthbk truthbk deleted the jaime/mysql_cons branch February 1, 2016 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants