From 3ebf494eb428fede2e7215c3df02725ea5c8f064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Mon, 17 Jul 2023 09:21:30 +0000 Subject: [PATCH 1/2] Changing error type in MySQL_Monitor_State_Data::create_new_connection() --- lib/MySQL_Monitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 01a0df6135..655244adf9 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -1526,7 +1526,7 @@ bool MySQL_Monitor_State_Data::create_new_connection() { if (myrc==NULL) { mysql_error_msg=strdup(mysql_error(mysql)); int myerrno=mysql_errno(mysql); - MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, hostgroup_id, hostname, port, myerrno); + MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, hostgroup_id, hostname, port, myerrno); if (myerrno < 2000) { mysql_close(mysql); } else { From d450d86bcb18d24e8a02c3fbb1b505e54639fc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Mon, 17 Jul 2023 09:23:13 +0000 Subject: [PATCH 2/2] Adding "code" in mysql error code counters exported to Prometheus --- lib/MySQL_HostGroups_Manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 22c13d6398..ae3dc20809 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -1449,7 +1449,7 @@ void MySQL_HostGroups_Manager::p_update_mysql_error_counter(p_mysql_error_type e std::string s_port = std::to_string(port); // TODO: Create switch here to classify error codes std::string s_code = std::to_string(code); - std::string metric_id = s_hostgroup + ":" + address + ":" + s_port; + std::string metric_id = s_hostgroup + ":" + address + ":" + s_port + ":" + s_code; std::map metric_labels { { "hostgroup", s_hostgroup }, { "address", address },