diff --git a/collector/binlog_test.go b/collector/binlog_test.go index 5ba55291f..8f2bc4f61 100644 --- a/collector/binlog_test.go +++ b/collector/binlog_test.go @@ -49,9 +49,9 @@ func TestScrapeBinlogSize(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{}, value: 574942, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 3, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 444, metricType: dto.MetricType_GAUGE}, + {name: "mysql_binlog_size_bytes", help: "Combined size of all registered binlog files.", labels: labelMap{}, value: 574942, metricType: dto.MetricType_GAUGE}, + {name: "mysql_binlog_files", help: "Number of registered binlog files.", labels: labelMap{}, value: 3, metricType: dto.MetricType_GAUGE}, + {name: "mysql_binlog_file_number", help: "The last binlog file number.", labels: labelMap{}, value: 444, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { diff --git a/collector/engine_innodb_test.go b/collector/engine_innodb_test.go index 49b8c1c35..1e70ee544 100644 --- a/collector/engine_innodb_test.go +++ b/collector/engine_innodb_test.go @@ -162,9 +162,9 @@ END OF INNODB MONITOR OUTPUT }() metricsExpected := []MetricResult{ - {labels: labelMap{}, value: 661, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 10, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 15, metricType: dto.MetricType_GAUGE}, + {name: "mysql_engine_innodb_queries_inside_innodb", help: "Queries inside InnoDB.", labels: labelMap{}, value: 661, metricType: dto.MetricType_GAUGE}, + {name: "mysql_engine_innodb_queries_in_queue", help: "Queries in queue.", labels: labelMap{}, value: 10, metricType: dto.MetricType_GAUGE}, + {name: "mysql_engine_innodb_read_views_open_inside_innodb", help: "Read views open inside InnoDB.", labels: labelMap{}, value: 15, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricsExpected { diff --git a/collector/engine_tokudb_test.go b/collector/engine_tokudb_test.go index 9b7485b6d..63bfb364a 100644 --- a/collector/engine_tokudb_test.go +++ b/collector/engine_tokudb_test.go @@ -66,9 +66,9 @@ func TestScrapeEngineTokudbStatus(t *testing.T) { }() metricsExpected := []MetricResult{ - {labels: labelMap{}, value: 1, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{}, value: 45316247, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{}, value: 9115.904484, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_engine_tokudb_indexer_number_of_calls_to_indexer_build_succeeded", help: "Generic metric from SHOW ENGINE TOKUDB STATUS.", labels: labelMap{}, value: 1, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_engine_tokudb_ft_promotion_stopped_anyway_after_locking_the_child", help: "Generic metric from SHOW ENGINE TOKUDB STATUS.", labels: labelMap{}, value: 45316247, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_engine_tokudb_locktree_time_spent_ending_the_sto_early_seconds", help: "Generic metric from SHOW ENGINE TOKUDB STATUS.", labels: labelMap{}, value: 9115.904484, metricType: dto.MetricType_UNTYPED}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricsExpected { diff --git a/collector/global_status.go b/collector/global_status.go index bb904718b..6ea5ddea4 100644 --- a/collector/global_status.go +++ b/collector/global_status.go @@ -194,11 +194,11 @@ func (ScrapeGlobalStatus) Scrape(ctx context.Context, db *sql.DB, ch chan<- prom } evsMap := []evsValue{ - evsValue{name: "min_seconds", value: 0, index: 0, help: "PXC/Galera group communication latency. Min value."}, - evsValue{name: "avg_seconds", value: 0, index: 1, help: "PXC/Galera group communication latency. Avg value."}, - evsValue{name: "max_seconds", value: 0, index: 2, help: "PXC/Galera group communication latency. Max value."}, - evsValue{name: "stdev", value: 0, index: 3, help: "PXC/Galera group communication latency. Standard Deviation."}, - evsValue{name: "sample_size", value: 0, index: 4, help: "PXC/Galera group communication latency. Sample Size."}, + {name: "min_seconds", value: 0, index: 0, help: "PXC/Galera group communication latency. Min value."}, + {name: "avg_seconds", value: 0, index: 1, help: "PXC/Galera group communication latency. Avg value."}, + {name: "max_seconds", value: 0, index: 2, help: "PXC/Galera group communication latency. Max value."}, + {name: "stdev", value: 0, index: 3, help: "PXC/Galera group communication latency. Standard Deviation."}, + {name: "sample_size", value: 0, index: 4, help: "PXC/Galera group communication latency. Sample Size."}, } evsParsingSuccess := true diff --git a/collector/global_status_test.go b/collector/global_status_test.go index 6ce48fa76..118c7d93b 100644 --- a/collector/global_status_test.go +++ b/collector/global_status_test.go @@ -70,33 +70,33 @@ func TestScrapeGlobalStatus(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{"command": "alter_db"}, value: 1, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"command": "show_status"}, value: 2, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"command": "select"}, value: 3, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"error": "internal"}, value: 4, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"handler": "commit"}, value: 5, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"state": "data"}, value: 6, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"operation": "flushed"}, value: 7, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 7, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"state": "free"}, value: 8, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"state": "misc"}, value: 9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"state": "old"}, value: 10, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_commands_total", help: "Total number of executed MySQL commands.", labels: labelMap{"command": "alter_db"}, value: 1, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_commands_total", help: "Total number of executed MySQL commands.", labels: labelMap{"command": "show_status"}, value: 2, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_commands_total", help: "Total number of executed MySQL commands.", labels: labelMap{"command": "select"}, value: 3, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_connection_errors_total", help: "Total number of MySQL connection errors.", labels: labelMap{"error": "internal"}, value: 4, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_handlers_total", help: "Total number of executed MySQL handlers.", labels: labelMap{"handler": "commit"}, value: 5, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_buffer_pool_pages", help: "Innodb buffer pool pages by state.", labels: labelMap{"state": "data"}, value: 6, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_buffer_pool_page_changes_total", help: "Innodb buffer pool page state changes.", labels: labelMap{"operation": "flushed"}, value: 7, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_buffer_pool_dirty_pages", help: "Innodb buffer pool dirty pages.", labels: labelMap{}, value: 7, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_buffer_pool_pages", help: "Innodb buffer pool pages by state.", labels: labelMap{"state": "free"}, value: 8, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_buffer_pool_pages", help: "Innodb buffer pool pages by state.", labels: labelMap{"state": "misc"}, value: 9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_buffer_pool_pages", help: "Innodb buffer pool pages by state.", labels: labelMap{"state": "old"}, value: 10, metricType: dto.MetricType_GAUGE}, //{labels: labelMap{"state": "total_pages"}, value: 11, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"operation": "lru_flushed"}, value: 13, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"operation": "made_not_young"}, value: 14, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"operation": "made_young"}, value: 15, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"operation": "read"}, value: 8, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"instrumentation": "users_lost"}, value: 9, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 0, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{}, value: 10, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{}, value: 11, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{}, value: 1, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{"wsrep_local_state_uuid": "6c06e583-686f-11e6-b9e3-8336ad58138c", "wsrep_cluster_state_uuid": "6c06e583-686f-11e6-b9e3-8336ad58138c", "wsrep_provider_version": "3.16(r5c765eb)"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 0.000227664, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 0.00034135, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 0.000544298, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 6.03708e-05, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 212, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_status_buffer_pool_page_changes_total", help: "Innodb buffer pool page state changes.", labels: labelMap{"operation": "lru_flushed"}, value: 13, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_buffer_pool_page_changes_total", help: "Innodb buffer pool page state changes.", labels: labelMap{"operation": "made_not_young"}, value: 14, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_buffer_pool_page_changes_total", help: "Innodb buffer pool page state changes.", labels: labelMap{"operation": "made_young"}, value: 15, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_innodb_row_ops_total", help: "Total number of MySQL InnoDB row operations.", labels: labelMap{"operation": "read"}, value: 8, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_performance_schema_lost_total", help: "Total number of MySQL instrumentations that could not be loaded or created due to memory constraints.", labels: labelMap{"instrumentation": "users_lost"}, value: 9, metricType: dto.MetricType_COUNTER}, + {name: "mysql_global_status_slave_running", help: "Generic metric from SHOW GLOBAL STATUS.", labels: labelMap{}, value: 0, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_global_status_uptime", help: "Generic metric from SHOW GLOBAL STATUS.", labels: labelMap{}, value: 10, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_global_status_validate_password_dictionary_file_words_count", help: "Generic metric from SHOW GLOBAL STATUS.", labels: labelMap{}, value: 11, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_global_status_wsrep_cluster_status", help: "Generic metric from SHOW GLOBAL STATUS.", labels: labelMap{}, value: 1, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_galera_status_info", help: "PXC/Galera status information.", labels: labelMap{"wsrep_local_state_uuid": "6c06e583-686f-11e6-b9e3-8336ad58138c", "wsrep_cluster_state_uuid": "6c06e583-686f-11e6-b9e3-8336ad58138c", "wsrep_provider_version": "3.16(r5c765eb)"}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_evs_repl_latency_min_seconds", help: "PXC/Galera group communication latency. Min value.", labels: labelMap{}, value: 0.000227664, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_evs_repl_latency_avg_seconds", help: "PXC/Galera group communication latency. Avg value.", labels: labelMap{}, value: 0.00034135, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_evs_repl_latency_max_seconds", help: "PXC/Galera group communication latency. Max value.", labels: labelMap{}, value: 0.000544298, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_evs_repl_latency_stdev", help: "PXC/Galera group communication latency. Standard Deviation.", labels: labelMap{}, value: 6.03708e-05, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_evs_repl_latency_sample_size", help: "PXC/Galera group communication latency. Sample Size.", labels: labelMap{}, value: 212, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { diff --git a/collector/global_variables_test.go b/collector/global_variables_test.go index f9c750f88..f497bc300 100644 --- a/collector/global_variables_test.go +++ b/collector/global_variables_test.go @@ -59,16 +59,16 @@ func TestScrapeGlobalVariables(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{}, value: 28800, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 4096, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 16777216, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"innodb_version": "5.6.30-76.3", "version": "5.6.30-76.3-56", "version_comment": "Percona XtraDB Cluster..."}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"wsrep_cluster_name": "supercluster"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: 134217728, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_wait_timeout", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 28800, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_userstat", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_transaction_prealloc_size", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 4096, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_tmp_table_size", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 16777216, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_sync_binlog", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_sync_frm", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_global_variables_slow_launch_time", help: "Generic gauge metric from SHOW GLOBAL VARIABLES.", labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, + {name: "mysql_version_info", help: "MySQL version and distribution.", labels: labelMap{"innodb_version": "5.6.30-76.3", "version": "5.6.30-76.3-56", "version_comment": "Percona XtraDB Cluster..."}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_variables_info", help: "PXC/Galera variables information.", labels: labelMap{"wsrep_cluster_name": "supercluster"}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_galera_gcache_size_bytes", help: "PXC/Galera gcache size.", labels: labelMap{}, value: 134217728, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { diff --git a/collector/heartbeat_test.go b/collector/heartbeat_test.go index 89576110c..0cc7d30d8 100644 --- a/collector/heartbeat_test.go +++ b/collector/heartbeat_test.go @@ -79,8 +79,8 @@ func TestScrapeHeartbeat(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{"server_id": "1"}, value: 1487598113.448042, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "1"}, value: 1487597613.00132, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_now_timestamp_seconds", help: "Timestamp of the current server.", labels: labelMap{"server_id": "1"}, value: 1487598113.448042, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_stored_timestamp_seconds", help: "Timestamp stored in the heartbeat table.", labels: labelMap{"server_id": "1"}, value: 1487597613.00132, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { diff --git a/collector/info_schema_clientstats_test.go b/collector/info_schema_clientstats_test.go index 2283735d1..a33493719 100644 --- a/collector/info_schema_clientstats_test.go +++ b/collector/info_schema_clientstats_test.go @@ -48,28 +48,28 @@ func TestScrapeClientStat(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"client": "localhost"}, value: 1002, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"client": "localhost"}, value: 127027, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 286, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 245, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: float64(2565104853), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 21090856, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: float64(2380108042), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 767691, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 1764, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 8778, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 1210741, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 1764, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 1214416, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 293, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 2430888, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_total_connections", help: "The number of connections created for this client.", labels: labelMap{"client": "localhost"}, value: 1002, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_concurrent_connections", help: "The number of concurrent connections for this client.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_client_statistics_connected_time_seconds_total", help: "The cumulative number of seconds elapsed while there were connections from this client.", labels: labelMap{"client": "localhost"}, value: 127027, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_busy_seconds_total", help: "The cumulative number of seconds there was activity on connections from this client.", labels: labelMap{"client": "localhost"}, value: 286, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_cpu_time_seconds_total", help: "The cumulative CPU time elapsed, in seconds, while servicing this client's connections.", labels: labelMap{"client": "localhost"}, value: 245, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_bytes_received_total", help: "The number of bytes received from this client’s connections.", labels: labelMap{"client": "localhost"}, value: float64(2565104853), metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_bytes_sent_total", help: "The number of bytes sent to this client’s connections.", labels: labelMap{"client": "localhost"}, value: 21090856, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_binlog_bytes_written_total", help: "The number of bytes written to the binary log from this client’s connections.", labels: labelMap{"client": "localhost"}, value: float64(2380108042), metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rows_read_total", help: "The number of rows read by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 767691, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rows_sent_total", help: "The number of rows sent by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 1764, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rows_deleted_total", help: "The number of rows deleted by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 8778, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rows_inserted_total", help: "The number of rows inserted by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 1210741, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rows_updated_total", help: "The number of rows updated by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_select_commands_total", help: "The number of SELECT commands executed from this client’s connections.", labels: labelMap{"client": "localhost"}, value: 1764, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_update_commands_total", help: "The number of UPDATE commands executed from this client’s connections.", labels: labelMap{"client": "localhost"}, value: 1214416, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_other_commands_total", help: "The number of other commands executed from this client’s connections.", labels: labelMap{"client": "localhost"}, value: 293, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_commit_transactions_total", help: "The number of COMMIT commands issued by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 2430888, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_rollback_transactions_total", help: "The number of ROLLBACK commands issued by this client’s connections.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_denied_connections_total", help: "The number of connections denied to this client.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_lost_connections_total", help: "The number of this client’s connections that were terminated uncleanly.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_access_denied_total", help: "The number of times this client’s connections issued commands that were denied.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_client_statistics_empty_queries_total", help: "The number of times this client’s connections sent empty queries to the server.", labels: labelMap{"client": "localhost"}, value: 0, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_innodb_cmp_test.go b/collector/info_schema_innodb_cmp_test.go index 27e7a121e..851ede818 100644 --- a/collector/info_schema_innodb_cmp_test.go +++ b/collector/info_schema_innodb_cmp_test.go @@ -45,11 +45,11 @@ func TestScrapeInnodbCmp(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"page_size": "1024"}, value: 10, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024"}, value: 20, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024"}, value: 30, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024"}, value: 40, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024"}, value: 50, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmp_compress_ops_total", help: "Number of times a B-tree page of the size PAGE_SIZE has been compressed.", labels: labelMap{"page_size": "1024"}, value: 10, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmp_compress_ops_ok_total", help: "Number of times a B-tree page of the size PAGE_SIZE has been successfully compressed.", labels: labelMap{"page_size": "1024"}, value: 20, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmp_compress_time_seconds_total", help: "Total time in seconds spent in attempts to compress B-tree pages.", labels: labelMap{"page_size": "1024"}, value: 30, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmp_uncompress_ops_total", help: "Number of times a B-tree page of the size PAGE_SIZE has been uncompressed.", labels: labelMap{"page_size": "1024"}, value: 40, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmp_uncompress_time_seconds_total", help: "Total time in seconds spent in uncompressing B-tree pages.", labels: labelMap{"page_size": "1024"}, value: 50, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_innodb_cmpmem_test.go b/collector/info_schema_innodb_cmpmem_test.go index 84c886ddc..7b40011c5 100644 --- a/collector/info_schema_innodb_cmpmem_test.go +++ b/collector/info_schema_innodb_cmpmem_test.go @@ -45,10 +45,10 @@ func TestScrapeInnodbCmpMem(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 30, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 40, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 50, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 6, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmpmem_pages_used_total", help: "Number of blocks of the size PAGE_SIZE that are currently in use.", labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 30, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmpmem_pages_free_total", help: "Number of blocks of the size PAGE_SIZE that are currently available for allocation.", labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 40, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmpmem_relocation_ops_total", help: "Number of times a block of the size PAGE_SIZE has been relocated.", labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 50, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_cmpmem_relocation_time_seconds_total", help: "Total time in seconds spent in relocating blocks.", labels: labelMap{"page_size": "1024", "buffer_pool": "0"}, value: 6, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_innodb_metrics_test.go b/collector/info_schema_innodb_metrics_test.go index ffb6daff5..925e6c0e2 100644 --- a/collector/info_schema_innodb_metrics_test.go +++ b/collector/info_schema_innodb_metrics_test.go @@ -53,13 +53,13 @@ func TestScrapeInnodbMetrics(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 1, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"type": "system_page"}, value: 3, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"type": "undo_log"}, value: 4, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 5, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"state": "data"}, value: 6, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_metrics_lock_lock_timeouts_total", help: "Number of lock timeouts", labels: labelMap{}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_metrics_buffer_buffer_pool_reads_total", help: "Number of reads directly from disk (innodb_buffer_pool_reads)", labels: labelMap{}, value: 1, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_metrics_server_buffer_pool_size", help: "Server buffer pool size (all buffer pools) in bytes", labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_metrics_buffer_page_read_total", help: "Total number of buffer pages read total.", labels: labelMap{"type": "system_page"}, value: 3, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_metrics_buffer_page_written_total", help: "Total number of buffer pages written total.", labels: labelMap{"type": "undo_log"}, value: 4, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_innodb_metrics_buffer_pool_dirty_pages", help: "Total number of dirty pages in the buffer pool.", labels: labelMap{}, value: 5, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_metrics_buffer_pool_pages", help: "Total number of buffer pool pages by state.", labels: labelMap{"state": "data"}, value: 6, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricExpected { diff --git a/collector/info_schema_innodb_sys_tablespaces_test.go b/collector/info_schema_innodb_sys_tablespaces_test.go index 0cd324efa..5e9af10f5 100644 --- a/collector/info_schema_innodb_sys_tablespaces_test.go +++ b/collector/info_schema_innodb_sys_tablespaces_test.go @@ -54,12 +54,12 @@ func TestScrapeInfoSchemaInnodbTablespaces(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"tablespace_name": "sys/sys_config", "file_format": "Barracuda", "row_format": "Dynamic", "space_type": "Single"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"tablespace_name": "sys/sys_config"}, value: 100, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"tablespace_name": "sys/sys_config"}, value: 100, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"tablespace_name": "db/compressed", "file_format": "Barracuda", "row_format": "Compressed", "space_type": "Single"}, value: 2, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"tablespace_name": "db/compressed"}, value: 300, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"tablespace_name": "db/compressed"}, value: 200, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_space_info", help: "The Tablespace information and Space ID.", labels: labelMap{"tablespace_name": "sys/sys_config", "file_format": "Barracuda", "row_format": "Dynamic", "space_type": "Single"}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_file_size_bytes", help: "The apparent size of the file, which represents the maximum size of the file, uncompressed.", labels: labelMap{"tablespace_name": "sys/sys_config"}, value: 100, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_allocated_size_bytes", help: "The actual size of the file, which is the amount of space allocated on disk.", labels: labelMap{"tablespace_name": "sys/sys_config"}, value: 100, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_space_info", help: "The Tablespace information and Space ID.", labels: labelMap{"tablespace_name": "db/compressed", "file_format": "Barracuda", "row_format": "Compressed", "space_type": "Single"}, value: 2, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_file_size_bytes", help: "The apparent size of the file, which represents the maximum size of the file, uncompressed.", labels: labelMap{"tablespace_name": "db/compressed"}, value: 300, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_innodb_tablespace_allocated_size_bytes", help: "The actual size of the file, which is the amount of space allocated on disk.", labels: labelMap{"tablespace_name": "db/compressed"}, value: 200, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_replica_host_test.go b/collector/info_schema_replica_host_test.go index 4b1e2950e..dab4b5ccd 100644 --- a/collector/info_schema_replica_host_test.go +++ b/collector/info_schema_replica_host_test.go @@ -46,17 +46,17 @@ func TestScrapeReplicaHost(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 1.2531328201293945, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.25, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.020069000244140625, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 2.0368164549078225, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.5, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_cpu_percent", help: "The CPU usage as a percentage.", labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 1.2531328201293945, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_slave_latency_seconds", help: "The master-slave latency in seconds.", labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.25, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_lag_seconds", help: "The replica lag in seconds.", labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.020069000244140625, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_log_stream_speed", help: "The log stream speed in kilobytes per second.", labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 2.0368164549078225, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_replay_latency_seconds", help: "The current replay latency in seconds.", labels: labelMap{"server_id": "dbtools-cluster-us-west-2c", "role": "reader"}, value: 0.5, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 1.9607843160629272, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.25, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 2.0368164549078225, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_cpu_percent", help: "The CPU usage as a percentage.", labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 1.9607843160629272, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_slave_latency_seconds", help: "The master-slave latency in seconds.", labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.25, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_lag_seconds", help: "The replica lag in seconds.", labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_log_stream_speed", help: "The log stream speed in kilobytes per second.", labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 2.0368164549078225, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_replica_host_replay_latency_seconds", help: "The current replay latency in seconds.", labels: labelMap{"server_id": "dbtools-cluster-writer", "role": "writer"}, value: 0.0, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_schemastats_test.go b/collector/info_schema_schemastats_test.go index aab76242a..5a0673f19 100644 --- a/collector/info_schema_schemastats_test.go +++ b/collector/info_schema_schemastats_test.go @@ -48,12 +48,12 @@ func TestScrapeSchemaStat(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"schema": "mysql"}, value: 238}, - {labels: labelMap{"schema": "mysql"}, value: 0}, - {labels: labelMap{"schema": "mysql"}, value: 8}, - {labels: labelMap{"schema": "default"}, value: 99}, - {labels: labelMap{"schema": "default"}, value: 1}, - {labels: labelMap{"schema": "default"}, value: 0}, + {name: "mysql_info_schema_schema_statistics_rows_read_total", help: "The number of rows read from the schema.", labels: labelMap{"schema": "mysql"}, value: 238}, + {name: "mysql_info_schema_schema_statistics_rows_changed_total", help: "The number of rows changed in the schema.", labels: labelMap{"schema": "mysql"}, value: 0}, + {name: "mysql_info_schema_schema_statistics_rows_changed_x_indexes_total", help: "The number of rows changed in the schema, multiplied by the number of indexes changed.", labels: labelMap{"schema": "mysql"}, value: 8}, + {name: "mysql_info_schema_schema_statistics_rows_read_total", help: "The number of rows read from the schema.", labels: labelMap{"schema": "default"}, value: 99}, + {name: "mysql_info_schema_schema_statistics_rows_changed_total", help: "The number of rows changed in the schema.", labels: labelMap{"schema": "default"}, value: 1}, + {name: "mysql_info_schema_schema_statistics_rows_changed_x_indexes_total", help: "The number of rows changed in the schema, multiplied by the number of indexes changed.", labels: labelMap{"schema": "default"}, value: 0}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_tablestats_test.go b/collector/info_schema_tablestats_test.go index 79d2988cd..aa5971325 100644 --- a/collector/info_schema_tablestats_test.go +++ b/collector/info_schema_tablestats_test.go @@ -49,15 +49,15 @@ func TestScrapeTableStat(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"schema": "mysql", "table": "db"}, value: 238}, - {labels: labelMap{"schema": "mysql", "table": "db"}, value: 0}, - {labels: labelMap{"schema": "mysql", "table": "db"}, value: 8}, - {labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 99}, - {labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 1}, - {labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 0}, - {labels: labelMap{"schema": "mysql", "table": "user"}, value: 1064}, - {labels: labelMap{"schema": "mysql", "table": "user"}, value: 2}, - {labels: labelMap{"schema": "mysql", "table": "user"}, value: 5}, + {name: "mysql_info_schema_table_statistics_rows_read_total", help: "The number of rows read from the table.", labels: labelMap{"schema": "mysql", "table": "db"}, value: 238}, + {name: "mysql_info_schema_table_statistics_rows_changed_total", help: "The number of rows changed in the table.", labels: labelMap{"schema": "mysql", "table": "db"}, value: 0}, + {name: "mysql_info_schema_table_statistics_rows_changed_x_indexes_total", help: "The number of rows changed in the table, multiplied by the number of indexes changed.", labels: labelMap{"schema": "mysql", "table": "db"}, value: 8}, + {name: "mysql_info_schema_table_statistics_rows_read_total", help: "The number of rows read from the table.", labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 99}, + {name: "mysql_info_schema_table_statistics_rows_changed_total", help: "The number of rows changed in the table.", labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 1}, + {name: "mysql_info_schema_table_statistics_rows_changed_x_indexes_total", help: "The number of rows changed in the table, multiplied by the number of indexes changed.", labels: labelMap{"schema": "mysql", "table": "proxies_priv"}, value: 0}, + {name: "mysql_info_schema_table_statistics_rows_read_total", help: "The number of rows read from the table.", labels: labelMap{"schema": "mysql", "table": "user"}, value: 1064}, + {name: "mysql_info_schema_table_statistics_rows_changed_total", help: "The number of rows changed in the table.", labels: labelMap{"schema": "mysql", "table": "user"}, value: 2}, + {name: "mysql_info_schema_table_statistics_rows_changed_x_indexes_total", help: "The number of rows changed in the table, multiplied by the number of indexes changed.", labels: labelMap{"schema": "mysql", "table": "user"}, value: 5}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/info_schema_userstats_test.go b/collector/info_schema_userstats_test.go index a88cb7645..5ade071bc 100644 --- a/collector/info_schema_userstats_test.go +++ b/collector/info_schema_userstats_test.go @@ -48,28 +48,28 @@ func TestScrapeUserStat(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{"user": "user_test"}, value: 1002, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"user": "user_test"}, value: 127027, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 286, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 245, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: float64(2565104853), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 21090856, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: float64(2380108042), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 767691, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 1764, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 8778, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 1210741, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 1764, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 1214416, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 293, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 2430888, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_total_connections", help: "The number of connections created for this user.", labels: labelMap{"user": "user_test"}, value: 1002, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_concurrent_connections", help: "The number of concurrent connections for this user.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_info_schema_user_statistics_connected_time_seconds_total", help: "The cumulative number of seconds elapsed while there were connections from this user.", labels: labelMap{"user": "user_test"}, value: 127027, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_busy_seconds_total", help: "The cumulative number of seconds there was activity on connections from this user.", labels: labelMap{"user": "user_test"}, value: 286, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_cpu_time_seconds_total", help: "The cumulative CPU time elapsed, in seconds, while servicing this user's connections.", labels: labelMap{"user": "user_test"}, value: 245, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_bytes_received_total", help: "The number of bytes received from this user’s connections.", labels: labelMap{"user": "user_test"}, value: float64(2565104853), metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_bytes_sent_total", help: "The number of bytes sent to this user’s connections.", labels: labelMap{"user": "user_test"}, value: 21090856, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_binlog_bytes_written_total", help: "The number of bytes written to the binary log from this user’s connections.", labels: labelMap{"user": "user_test"}, value: float64(2380108042), metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rows_read_total", help: "The number of rows read by this user's connections.", labels: labelMap{"user": "user_test"}, value: 767691, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rows_sent_total", help: "The number of rows sent by this user's connections.", labels: labelMap{"user": "user_test"}, value: 1764, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rows_deleted_total", help: "The number of rows deleted by this user's connections.", labels: labelMap{"user": "user_test"}, value: 8778, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rows_inserted_total", help: "The number of rows inserted by this user's connections.", labels: labelMap{"user": "user_test"}, value: 1210741, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rows_updated_total", help: "The number of rows updated by this user’s connections.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_select_commands_total", help: "The number of SELECT commands executed from this user’s connections.", labels: labelMap{"user": "user_test"}, value: 1764, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_update_commands_total", help: "The number of UPDATE commands executed from this user’s connections.", labels: labelMap{"user": "user_test"}, value: 1214416, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_other_commands_total", help: "The number of other commands executed from this user’s connections.", labels: labelMap{"user": "user_test"}, value: 293, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_commit_transactions_total", help: "The number of COMMIT commands issued by this user’s connections.", labels: labelMap{"user": "user_test"}, value: 2430888, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_rollback_transactions_total", help: "The number of ROLLBACK commands issued by this user’s connections.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_denied_connections_total", help: "The number of connections denied to this user.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_lost_connections_total", help: "The number of this user’s connections that were terminated uncleanly.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_access_denied_total", help: "The number of times this user’s connections issued commands that were denied.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, + {name: "mysql_info_schema_user_statistics_empty_queries_total", help: "The number of times this user’s connections sent empty queries to the server.", labels: labelMap{"user": "user_test"}, value: 0, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/perf_schema_file_instances_test.go b/collector/perf_schema_file_instances_test.go index f6ad00b61..1ba4ff082 100644 --- a/collector/perf_schema_file_instances_test.go +++ b/collector/perf_schema_file_instances_test.go @@ -55,18 +55,18 @@ func TestScrapePerfFileInstances(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "read"}, value: 3, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "write"}, value: 4, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "read"}, value: 725, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "write"}, value: 128, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "read"}, value: 23, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "write"}, value: 12, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "read"}, value: 3123, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "write"}, value: 967, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "read"}, value: 45, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "write"}, value: 32, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "read"}, value: 1337, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "write"}, value: 326, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "read"}, value: 3, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "write"}, value: 4, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "read"}, value: 725, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db1/file", "event_name": "event1", "mode": "write"}, value: 128, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "read"}, value: 23, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "write"}, value: 12, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "read"}, value: 3123, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db2/file", "event_name": "event2", "mode": "write"}, value: 967, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "read"}, value: 45, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_total", help: "The total number of file read/write operations.", labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "write"}, value: 32, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "read"}, value: 1337, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_file_instances_bytes", help: "The number of bytes processed by file read/write operations.", labels: labelMap{"file_name": "db3/file", "event_name": "event3", "mode": "write"}, value: 326, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricExpected { diff --git a/collector/perf_schema_index_io_waits_test.go b/collector/perf_schema_index_io_waits_test.go index 0ad118f34..e425e66e7 100644 --- a/collector/perf_schema_index_io_waits_test.go +++ b/collector/perf_schema_index_io_waits_test.go @@ -47,20 +47,20 @@ func TestScrapePerfIndexIOWaits(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "fetch"}, value: 10, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "update"}, value: 12, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "delete"}, value: 13, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "fetch"}, value: 14, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "update"}, value: 16, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "delete"}, value: 17, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "fetch"}, value: 20, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "insert"}, value: 21, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "update"}, value: 22, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "delete"}, value: 23, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "fetch"}, value: 24, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "insert"}, value: 25, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "update"}, value: 26, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "delete"}, value: 27, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "fetch"}, value: 10, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "update"}, value: 12, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "delete"}, value: 13, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "fetch"}, value: 14, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "update"}, value: 16, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "index", "operation": "delete"}, value: 17, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "fetch"}, value: 20, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "insert"}, value: 21, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "update"}, value: 22, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_total", help: "The total number of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "delete"}, value: 23, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "fetch"}, value: 24, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "insert"}, value: 25, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "update"}, value: 26, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_index_io_waits_seconds_total", help: "The total time of index I/O wait events for each index and operation.", labels: labelMap{"schema": "database", "name": "table", "index": "NONE", "operation": "delete"}, value: 27, metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricExpected { diff --git a/collector/perf_schema_memory_events_test.go b/collector/perf_schema_memory_events_test.go index d8fa4fc65..efeb206c8 100644 --- a/collector/perf_schema_memory_events_test.go +++ b/collector/perf_schema_memory_events_test.go @@ -61,18 +61,18 @@ func TestScrapePerfMemoryEvents(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"event_name": "innodb/event1"}, value: 1001, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "innodb/event1"}, value: 500, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "innodb/event1"}, value: 501, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"event_name": "performance_schema/event1"}, value: 6000, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "performance_schema/event1"}, value: 7, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "performance_schema/event1"}, value: -83904, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"event_name": "innodb/event2"}, value: 2002, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "innodb/event2"}, value: 1000, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "innodb/event2"}, value: 1002, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"event_name": "sql/event1"}, value: 30, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "sql/event1"}, value: 4, metricType: dto.MetricType_COUNTER}, - {labels: labelMap{"event_name": "sql/event1"}, value: 26, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_memory_events_alloc_bytes_total", help: "The total number of bytes allocated by events.", labels: labelMap{"event_name": "innodb/event1"}, value: 1001, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_free_bytes_total", help: "The total number of bytes freed by events.", labels: labelMap{"event_name": "innodb/event1"}, value: 500, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_used_bytes", help: "The number of bytes currently allocated by events.", labels: labelMap{"event_name": "innodb/event1"}, value: 501, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_memory_events_alloc_bytes_total", help: "The total number of bytes allocated by events.", labels: labelMap{"event_name": "performance_schema/event1"}, value: 6000, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_free_bytes_total", help: "The total number of bytes freed by events.", labels: labelMap{"event_name": "performance_schema/event1"}, value: 7, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_used_bytes", help: "The number of bytes currently allocated by events.", labels: labelMap{"event_name": "performance_schema/event1"}, value: -83904, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_memory_events_alloc_bytes_total", help: "The total number of bytes allocated by events.", labels: labelMap{"event_name": "innodb/event2"}, value: 2002, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_free_bytes_total", help: "The total number of bytes freed by events.", labels: labelMap{"event_name": "innodb/event2"}, value: 1000, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_used_bytes", help: "The number of bytes currently allocated by events.", labels: labelMap{"event_name": "innodb/event2"}, value: 1002, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_memory_events_alloc_bytes_total", help: "The total number of bytes allocated by events.", labels: labelMap{"event_name": "sql/event1"}, value: 30, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_free_bytes_total", help: "The total number of bytes freed by events.", labels: labelMap{"event_name": "sql/event1"}, value: 4, metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_memory_events_used_bytes", help: "The number of bytes currently allocated by events.", labels: labelMap{"event_name": "sql/event1"}, value: 26, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricExpected { diff --git a/collector/perf_schema_replication_applier_status_by_worker_test.go b/collector/perf_schema_replication_applier_status_by_worker_test.go index a6fde8f2c..35302437d 100644 --- a/collector/perf_schema_replication_applier_status_by_worker_test.go +++ b/collector/perf_schema_replication_applier_status_by_worker_test.go @@ -61,20 +61,20 @@ func TestScrapePerfReplicationApplierStatsByWorker(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521600001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521660001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521720001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521780001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521840001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521900001e+9, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521960001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_original_commit_timestamp_seconds", help: "A timestamp shows when the last transaction applied by this worker was committed on the original master.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_immediate_commit_timestamp_seconds", help: "A timestamp shows when the last transaction applied by this worker was committed on the immediate master.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_start_apply_timestamp_seconds", help: "A timestamp shows when this worker started applying the last applied transaction.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_end_apply_timestamp_seconds", help: "A shows when this worker finished applying the last applied transaction.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_original_commit_timestamp_seconds", help: "A timestamp that shows when the transaction this worker is currently applying was committed on the original master.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_immediate_commit_timestamp_seconds", help: "A timestamp shows when the transaction this worker is currently applying was committed on the immediate master.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_start_apply_timestamp_seconds", help: "A timestamp shows when this worker started its first attempt to apply the transaction that is currently being applied.", labels: labelMap{"channel_name": "dummy_0", "member_id": "0"}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_original_commit_timestamp_seconds", help: "A timestamp shows when the last transaction applied by this worker was committed on the original master.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521600001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_immediate_commit_timestamp_seconds", help: "A timestamp shows when the last transaction applied by this worker was committed on the immediate master.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521660001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_start_apply_timestamp_seconds", help: "A timestamp shows when this worker started applying the last applied transaction.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521720001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_last_applied_transaction_end_apply_timestamp_seconds", help: "A shows when this worker finished applying the last applied transaction.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521780001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_original_commit_timestamp_seconds", help: "A timestamp that shows when the transaction this worker is currently applying was committed on the original master.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521840001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_immediate_commit_timestamp_seconds", help: "A timestamp shows when the transaction this worker is currently applying was committed on the immediate master.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521900001e+9, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_applying_transaction_start_apply_timestamp_seconds", help: "A timestamp shows when this worker started its first attempt to apply the transaction that is currently being applied.", labels: labelMap{"channel_name": "dummy_1", "member_id": "1"}, value: 1.552521960001e+9, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range metricExpected { diff --git a/collector/perf_schema_replication_group_member_stats_test.go b/collector/perf_schema_replication_group_member_stats_test.go index 0f2e3aebd..86c8d0b29 100644 --- a/collector/perf_schema_replication_group_member_stats_test.go +++ b/collector/perf_schema_replication_group_member_stats_test.go @@ -73,14 +73,14 @@ func TestScrapePerfReplicationGroupMemberStats(t *testing.T) { }() expected := []MetricResult{ - {labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: float64(7389775), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: float64(1), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: float64(48), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{}, value: float64(22), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: float64(7389759), metricType: dto.MetricType_COUNTER}, - {labels: labelMap{}, value: float64(7), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_transactions_in_queue", help: "The number of transactions in the queue pending conflict detection checks.", labels: labelMap{}, value: 0, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_transactions_checked_total", help: "The number of transactions that have been checked for conflicts.", labels: labelMap{}, value: float64(7389775), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_conflicts_detected_total", help: "The number of transactions that have not passed the conflict detection check.", labels: labelMap{}, value: float64(1), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_transactions_rows_validating_total", help: "Number of transaction rows which can be used for certification, but have not been garbage collected.", labels: labelMap{}, value: float64(48), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_transactions_remote_in_applier_queue", help: "The number of transactions that this member has received from the replication group which are waiting to be applied.", labels: labelMap{}, value: 2, metricType: dto.MetricType_GAUGE}, + {name: "mysql_perf_schema_transactions_remote_applied_total", help: "Number of transactions this member has received from the group and applied.", labels: labelMap{}, value: float64(22), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_transactions_local_proposed_total", help: "Number of transactions which originated on this member and were sent to the group.", labels: labelMap{}, value: float64(7389759), metricType: dto.MetricType_COUNTER}, + {name: "mysql_perf_schema_transactions_local_rollback_total", help: "Number of transactions which originated on this member and were rolled back by the group.", labels: labelMap{}, value: float64(7), metricType: dto.MetricType_COUNTER}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range expected { diff --git a/collector/perf_schema_replication_group_members_test.go b/collector/perf_schema_replication_group_members_test.go index cf2b841b1..846ddbe65 100644 --- a/collector/perf_schema_replication_group_members_test.go +++ b/collector/perf_schema_replication_group_members_test.go @@ -15,12 +15,13 @@ package collector import ( "context" + "testing" + "github.com/DATA-DOG/go-sqlmock" "github.com/go-kit/kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/smartystreets/goconvey/convey" - "testing" ) func TestScrapePerfReplicationGroupMembers(t *testing.T) { @@ -56,11 +57,11 @@ func TestScrapePerfReplicationGroupMembers(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid1", "member_host": "hostname1", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid1", "member_host": "hostname1", "member_port": "3306", "member_state": "ONLINE", "member_role": "PRIMARY", "member_version": "8.0.19"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid2", "member_host": "hostname2", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid2", "member_host": "hostname2", "member_port": "3306", "member_state": "ONLINE", "member_role": "SECONDARY", "member_version": "8.0.19"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid3", "member_host": "hostname3", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid3", "member_host": "hostname3", "member_port": "3306", "member_state": "ONLINE", "member_role": "SECONDARY", "member_version": "8.0.19"}, value: 1, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { @@ -107,11 +108,11 @@ func TestScrapePerfReplicationGroupMembersMySQL57(t *testing.T) { }() metricExpected := []MetricResult{ - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid1", "member_host": "hostname1", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid1", "member_host": "hostname1", "member_port": "3306", "member_state": "ONLINE"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid2", "member_host": "hostname2", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid2", "member_host": "hostname2", "member_port": "3306", "member_state": "ONLINE"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid3", "member_host": "hostname3", "member_port": "3306", + {name: "mysql_perf_schema_replication_group_member_info", help: "Information about the replication group member: channel_name, member_id, member_host, member_port, member_state. (member_role and member_version where available)", labels: labelMap{"channel_name": "group_replication_applier", "member_id": "uuid3", "member_host": "hostname3", "member_port": "3306", "member_state": "ONLINE"}, value: 1, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { diff --git a/collector/slave_hosts_test.go b/collector/slave_hosts_test.go index 08b1612bf..4aab488ba 100644 --- a/collector/slave_hosts_test.go +++ b/collector/slave_hosts_test.go @@ -46,8 +46,8 @@ func TestScrapeSlaveHostsOldFormat(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{"server_id": "380239978", "slave_host": "backup_server_1", "port": "0", "master_id": "192168011", "slave_uuid": ""}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "11882498", "slave_host": "backup_server_2", "port": "0", "master_id": "192168011", "slave_uuid": ""}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_mysql_slave_hosts_info", help: "Information about running slaves", labels: labelMap{"server_id": "380239978", "slave_host": "backup_server_1", "port": "0", "master_id": "192168011", "slave_uuid": ""}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_mysql_slave_hosts_info", help: "Information about running slaves", labels: labelMap{"server_id": "11882498", "slave_host": "backup_server_2", "port": "0", "master_id": "192168011", "slave_uuid": ""}, value: 1, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { @@ -84,8 +84,8 @@ func TestScrapeSlaveHostsNewFormat(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{"server_id": "192168010", "slave_host": "iconnect2", "port": "3306", "master_id": "192168011", "slave_uuid": "14cb6624-7f93-11e0-b2c0-c80aa9429562"}, value: 1, metricType: dto.MetricType_GAUGE}, - {labels: labelMap{"server_id": "1921680101", "slave_host": "athena", "port": "3306", "master_id": "192168011", "slave_uuid": "07af4990-f41f-11df-a566-7ac56fdaf645"}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_mysql_slave_hosts_info", help: "Information about running slaves", labels: labelMap{"server_id": "192168010", "slave_host": "iconnect2", "port": "3306", "master_id": "192168011", "slave_uuid": "14cb6624-7f93-11e0-b2c0-c80aa9429562"}, value: 1, metricType: dto.MetricType_GAUGE}, + {name: "mysql_heartbeat_mysql_slave_hosts_info", help: "Information about running slaves", labels: labelMap{"server_id": "1921680101", "slave_host": "athena", "port": "3306", "master_id": "192168011", "slave_uuid": "07af4990-f41f-11df-a566-7ac56fdaf645"}, value: 1, metricType: dto.MetricType_GAUGE}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected { diff --git a/collector/slave_status_test.go b/collector/slave_status_test.go index 68ef2edb5..de9902344 100644 --- a/collector/slave_status_test.go +++ b/collector/slave_status_test.go @@ -45,10 +45,10 @@ func TestScrapeSlaveStatus(t *testing.T) { }() counterExpected := []MetricResult{ - {labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 1, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 0, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 1, metricType: dto.MetricType_UNTYPED}, - {labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 2, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_slave_status_read_master_log_pos", help: "Generic metric from SHOW SLAVE STATUS.", labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 1, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_slave_status_slave_io_running", help: "Generic metric from SHOW SLAVE STATUS.", labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 0, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_slave_status_slave_sql_running", help: "Generic metric from SHOW SLAVE STATUS.", labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 1, metricType: dto.MetricType_UNTYPED}, + {name: "mysql_slave_status_seconds_behind_master", help: "Generic metric from SHOW SLAVE STATUS.", labels: labelMap{"channel_name": "", "connection_name": "", "master_host": "127.0.0.1", "master_uuid": ""}, value: 2, metricType: dto.MetricType_UNTYPED}, } convey.Convey("Metrics comparison", t, func() { for _, expect := range counterExpected {