diff --git a/include/proxysql_glovars.hpp b/include/proxysql_glovars.hpp index 39eb3ce8d2..c8fb5c583f 100644 --- a/include/proxysql_glovars.hpp +++ b/include/proxysql_glovars.hpp @@ -1,9 +1,13 @@ #ifndef __CLASS_PROXYSQL_GLOVARS_H #define __CLASS_PROXYSQL_GLOVARS_H +#include + #include "configfile.hpp" #include "proxy_defines.h" +#include + namespace ez { class ezOptionParser; }; @@ -60,6 +64,7 @@ class ProxySQL_GlobalVariables { char * web_interface_plugin; char * ldap_auth_plugin; std::string prometheus_plugin {""}; + std::shared_ptr prometheus_registry { nullptr }; struct { unsigned long long start_time; bool gdbg; diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 97f8e1e1c5..1b355169fd 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -672,7 +672,7 @@ EXTERN global_variables glovars; #ifdef PROXYSQL_EXTERN #ifndef GLOBAL_DEFINED_OPTS_ENTRIES #define GLOBAL_DEFINED_OPTS_ENTRIES -ProxySQL_GlobalVariables GloVars; +ProxySQL_GlobalVariables GloVars {}; #endif // GLOBAL_DEFINED_OPTS_ENTRIES #ifndef GLOBAL_DEFINED_HOSTGROUP #define GLOBAL_DEFINED_HOSTGROUP diff --git a/lib/ProxySQL_GloVars.cpp b/lib/ProxySQL_GloVars.cpp index ea7a02948e..ae251939eb 100644 --- a/lib/ProxySQL_GloVars.cpp +++ b/lib/ProxySQL_GloVars.cpp @@ -1,4 +1,5 @@ #include "ezOptionParser.hpp" +#include "prometheus/registry.h" #include "proxysql.h" #include "cpp.h" #include @@ -44,7 +45,9 @@ ProxySQL_GlobalVariables::~ProxySQL_GlobalVariables() { } }; -ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() { +ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() : + prometheus_registry(std::make_shared()) +{ confFile=NULL; __cmd_proxysql_config_file=NULL; __cmd_proxysql_datadir=NULL;