Skip to content

Commit

Permalink
Added new status variable mysql_listener_paused
Browse files Browse the repository at this point in the history
New variable mysql_listener_paused added to table stats_mysql_global .
The variable is a boolean:
- true : listener is paused because PROXYSQL PAUSE was executed
- false : listener is not paused

The variable is also reported by Prometheus exporter as proxysql_mysql_listener_paused

Related to #4391
  • Loading branch information
renecannao committed Jan 18, 2024
1 parent 2840e18 commit 5326298
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/proxysql_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct p_admin_gauge {
stmt_cached,
fds_in_use,
version_info,
mysql_listener_paused,
__size
};
};
Expand Down
20 changes: 19 additions & 1 deletion lib/ProxySQL_Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,12 @@ admin_metrics_map = std::make_tuple(
)
},
admin_gauge_vector {
std::make_tuple (
p_admin_gauge::mysql_listener_paused,
"proxysql_mysql_listener_paused",
"MySQL listener paused because of PROXYSQL PAUSE.",
metric_tags {}
),
// memory metrics
std::make_tuple (
p_admin_gauge::connpool_memory_bytes,
Expand Down Expand Up @@ -9421,6 +9427,11 @@ void ProxySQL_Admin::p_update_metrics() {
this->p_stats___memory_metrics();
// Update stmt metrics
this->p_update_stmt_metrics();

// updated mysql_listener_paused
int st = ( proxysql_mysql_paused == true ? 1 : 0);
this->metrics.p_gauge_array[p_admin_gauge::mysql_listener_paused]->Set(st);

}

/**
Expand Down Expand Up @@ -9915,7 +9926,14 @@ void ProxySQL_Admin::stats___mysql_global() {
statsdb->execute(query);
free(query);
}

{
vn=(char *)"mysql_listener_paused";
sprintf(bu, "%s", ( proxysql_mysql_paused==true ? "true" : "false") );
query=(char *)malloc(strlen(a)+strlen(vn)+strlen(bu)+16);
sprintf(query,a,vn,bu);
statsdb->execute(query);
free(query);
}
statsdb->execute("COMMIT");
}

Expand Down

0 comments on commit 5326298

Please sign in to comment.