mirror of
https://github.com/fluencelabs/redis
synced 2025-06-14 17:51:21 +00:00
Extend modules API to allow modules report to redis INFO
this implements #6012
This commit is contained in:
16
src/server.c
16
src/server.c
@ -3809,12 +3809,15 @@ sds genRedisInfoString(char *section) {
|
||||
time_t uptime = server.unixtime-server.stat_starttime;
|
||||
int j;
|
||||
struct rusage self_ru, c_ru;
|
||||
int allsections = 0, defsections = 0;
|
||||
int allsections = 0, defsections = 0, everything = 0, modules = 0;
|
||||
int sections = 0;
|
||||
|
||||
if (section == NULL) section = "default";
|
||||
allsections = strcasecmp(section,"all") == 0;
|
||||
defsections = strcasecmp(section,"default") == 0;
|
||||
everything = strcasecmp(section,"everything") == 0;
|
||||
modules = strcasecmp(section,"modules") == 0;
|
||||
if (everything) allsections = 1;
|
||||
|
||||
getrusage(RUSAGE_SELF, &self_ru);
|
||||
getrusage(RUSAGE_CHILDREN, &c_ru);
|
||||
@ -4357,6 +4360,17 @@ sds genRedisInfoString(char *section) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get info from modules.
|
||||
* if user asked for "everything" or "modules", or a specific section
|
||||
* that's not found yet. */
|
||||
if (everything || modules ||
|
||||
(!allsections && !defsections && sections==0)) {
|
||||
info = modulesCollectInfo(info,
|
||||
everything || modules ? NULL: section,
|
||||
0, /* not a crash report */
|
||||
sections);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user