mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 14:06:20 +00:00
PG-338: Calls count is not correct in PG-13.
cherry-pick patch (b6838049b6) by Diego
and I did some refatoring.
This commit is contained in:
64
guc.c
64
guc.c
@@ -22,6 +22,7 @@ GucVariable conf[MAX_SETTINGS];
|
||||
static void DefineIntGUC(GucVariable *conf);
|
||||
static void DefineIntGUCWithCheck(GucVariable *conf, GucIntCheckHook check);
|
||||
static void DefineBoolGUC(GucVariable *conf);
|
||||
static void DefineEnumGUC(GucVariable *conf, const struct config_enum_entry *options);
|
||||
|
||||
/* Check hooks to ensure histogram_min < histogram_max */
|
||||
static bool check_histogram_min(int *newval, void **extra, GucSource source);
|
||||
@@ -34,6 +35,7 @@ void
|
||||
init_guc(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_max",
|
||||
.guc_desc = "Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor.",
|
||||
@@ -58,18 +60,6 @@ init_guc(void)
|
||||
};
|
||||
DefineIntGUC(&conf[i++]);
|
||||
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_enable",
|
||||
.guc_desc = "Enable/Disable statistics collector.",
|
||||
.guc_default = 1,
|
||||
.guc_min = 0,
|
||||
.guc_max = 0,
|
||||
.guc_restart = false,
|
||||
.guc_unit = 0,
|
||||
.guc_value = &PGSM_ENABLED
|
||||
};
|
||||
DefineBoolGUC(&conf[i++]);
|
||||
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_track_utility",
|
||||
.guc_desc = "Selects whether utility commands are tracked.",
|
||||
@@ -190,12 +180,39 @@ init_guc(void)
|
||||
};
|
||||
DefineBoolGUC(&conf[i++]);
|
||||
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_track",
|
||||
.guc_desc = "Selects which statements are tracked by pg_stat_monitor.",
|
||||
.n_options = 3,
|
||||
.guc_default = PGSM_TRACK_ALL,
|
||||
.guc_min = PSGM_TRACK_NONE,
|
||||
.guc_max = PGSM_TRACK_ALL,
|
||||
.guc_restart = false,
|
||||
.guc_unit = 0,
|
||||
.guc_value = &PGSM_TRACK
|
||||
};
|
||||
for (int j = 0; j < conf[i].n_options; ++j) {
|
||||
strlcpy(conf[i].guc_options[j], track_options[j].name, sizeof(conf[i].guc_options[j]));
|
||||
}
|
||||
DefineEnumGUC(&conf[i++], track_options);
|
||||
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_extract_comments",
|
||||
.guc_desc = "Enable/Disable extracting comments from queries.",
|
||||
.guc_default = 0,
|
||||
.guc_min = 0,
|
||||
.guc_max = 0,
|
||||
.guc_restart = false,
|
||||
.guc_unit = 0,
|
||||
.guc_value = &PGSM_EXTRACT_COMMENTS
|
||||
};
|
||||
DefineBoolGUC(&conf[i++]);
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
conf[i] = (GucVariable) {
|
||||
.guc_name = "pg_stat_monitor.pgsm_track_planning",
|
||||
.guc_desc = "Selects whether planning statistics are tracked.",
|
||||
.guc_default = 1,
|
||||
.guc_default = 0,
|
||||
.guc_min = 0,
|
||||
.guc_max = 0,
|
||||
.guc_restart = false,
|
||||
@@ -208,6 +225,7 @@ init_guc(void)
|
||||
|
||||
static void DefineIntGUCWithCheck(GucVariable *conf, GucIntCheckHook check)
|
||||
{
|
||||
conf->type = PGC_INT;
|
||||
DefineCustomIntVariable(conf->guc_name,
|
||||
conf->guc_desc,
|
||||
NULL,
|
||||
@@ -231,6 +249,7 @@ DefineIntGUC(GucVariable *conf)
|
||||
static void
|
||||
DefineBoolGUC(GucVariable *conf)
|
||||
{
|
||||
conf->type = PGC_BOOL;
|
||||
DefineCustomBoolVariable(conf->guc_name,
|
||||
conf->guc_desc,
|
||||
NULL,
|
||||
@@ -243,10 +262,27 @@ DefineBoolGUC(GucVariable *conf)
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
DefineEnumGUC(GucVariable *conf, const struct config_enum_entry *options)
|
||||
{
|
||||
conf->type = PGC_ENUM;
|
||||
DefineCustomEnumVariable(conf->guc_name,
|
||||
conf->guc_desc,
|
||||
NULL,
|
||||
conf->guc_value,
|
||||
conf->guc_default,
|
||||
options,
|
||||
conf->guc_restart ? PGC_POSTMASTER : PGC_USERSET,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GucVariable*
|
||||
get_conf(int i)
|
||||
{
|
||||
return &conf[i];
|
||||
return &conf[i];
|
||||
}
|
||||
|
||||
static bool check_histogram_min(int *newval, void **extra, GucSource source)
|
||||
|
||||
Reference in New Issue
Block a user