diff --git a/include/MySQL_HostGroups_Manager.h b/include/MySQL_HostGroups_Manager.h index 86a00cbc1..1403f4e80 100644 --- a/include/MySQL_HostGroups_Manager.h +++ b/include/MySQL_HostGroups_Manager.h @@ -300,6 +300,7 @@ struct p_hg_counter { myhgm_myconnpool_push, myhgm_myconnpool_reset, myhgm_myconnpool_destroy, + auto_increment_delay_multiplex, __size }; }; @@ -458,6 +459,7 @@ class MySQL_HostGroups_Manager { unsigned long long access_denied_max_connections; unsigned long long access_denied_max_user_connections; unsigned long long select_for_update_or_equivalent; + unsigned long long auto_increment_delay_multiplex; ////////////////////////////////////////////////////// /// Prometheus Metrics /// diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 3f2c97116..49585ae17 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -1215,7 +1215,16 @@ hg_metrics_map = std::make_tuple( "proxysql_myhgm_myconnpool_destroy_total", "The number of connections considered unhealthy and therefore closed.", metric_tags {} - ) + ), + + // ==================================================================== + + std::make_tuple ( + p_hg_counter::auto_increment_delay_multiplex, + "proxysql_myhgm_auto_increment_multiplex_total", + "The number of times that 'auto_increment_delay_multiplex' has been triggered.", + metric_tags {} + ), }, // prometheus gauges hg_gauge_vector { @@ -4295,6 +4304,8 @@ void MySQL_HostGroups_Manager::p_update_metrics() { p_update_counter(status.p_counter_array[p_hg_counter::myhgm_myconnpool_reset], status.myconnpoll_reset); p_update_counter(status.p_counter_array[p_hg_counter::myhgm_myconnpool_destroy], status.myconnpoll_destroy); + p_update_counter(status.p_counter_array[p_hg_counter::auto_increment_delay_multiplex], status.auto_increment_delay_multiplex); + // Update the *connection_pool* metrics this->p_update_connection_pool(); // Update the *gtid_executed* metrics diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index ffe65f51d..7d090f04e 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4360,6 +4360,7 @@ handler_again: last_HG_affected_rows = current_hostgroup; if (mysql_thread___auto_increment_delay_multiplex && myconn->mysql->insert_id) { myconn->auto_increment_delay_token = mysql_thread___auto_increment_delay_multiplex + 1; + __sync_fetch_and_add(&MyHGM->status.auto_increment_delay_multiplex, 1); } } }