Skip to content

Commit

Permalink
Added prometheus registry to gloval variables and modified definition…
Browse files Browse the repository at this point in the history
… for calling default constructor
  • Loading branch information
JavierJF committed Apr 17, 2020
1 parent c319db2 commit c2c4723
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions include/proxysql_glovars.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#ifndef __CLASS_PROXYSQL_GLOVARS_H
#define __CLASS_PROXYSQL_GLOVARS_H

#include <memory>

#include "configfile.hpp"
#include "proxy_defines.h"

#include <prometheus/registry.h>

namespace ez {
class ezOptionParser;
};
Expand Down Expand Up @@ -60,6 +64,7 @@ class ProxySQL_GlobalVariables {
char * web_interface_plugin;
char * ldap_auth_plugin;
std::string prometheus_plugin {""};
std::shared_ptr<prometheus::Registry> prometheus_registry { nullptr };
struct {
unsigned long long start_time;
bool gdbg;
Expand Down
2 changes: 1 addition & 1 deletion include/proxysql_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion lib/ProxySQL_GloVars.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ezOptionParser.hpp"
#include "prometheus/registry.h"
#include "proxysql.h"
#include "cpp.h"
#include <string>
Expand Down Expand Up @@ -44,7 +45,9 @@ ProxySQL_GlobalVariables::~ProxySQL_GlobalVariables() {
}
};

ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() {
ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() :
prometheus_registry(std::make_shared<prometheus::Registry>())
{
confFile=NULL;
__cmd_proxysql_config_file=NULL;
__cmd_proxysql_datadir=NULL;
Expand Down

0 comments on commit c2c4723

Please sign in to comment.