Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
Sentinel: add more commonly useful sections to INFO.
Browse files Browse the repository at this point in the history
Debugging is hard without those when there are problems like the one
investigated in issue redis#2700.
  • Loading branch information
antirez committed Jul 29, 2015
1 parent 4bc42ca commit 6233d21
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/sentinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,16 @@ void sentinelCommand(client *c) {
(char*)c->argv[1]->ptr);
}

#define info_section_from_redis(section_name) do { \
if (defsections || allsections || !strcasecmp(section,section_name)) { \
sds redissection; \
if (sections++) info = sdscat(info,"\r\n"); \
redissection = genRedisInfoString(section_name); \
info = sdscatlen(info,redissection,sdslen(redissection)); \
sdsfree(redissection); \
} \
} while(0)

/* SENTINEL INFO [section] */
void sentinelInfoCommand(client *c) {
if (c->argc > 2) {
Expand All @@ -3183,12 +3193,11 @@ void sentinelInfoCommand(client *c) {

int sections = 0;
sds info = sdsempty();
if (defsections || allsections || !strcasecmp(section,"server")) {
if (sections++) info = sdscat(info,"\r\n");
sds serversection = genRedisInfoString("server");
info = sdscatlen(info,serversection,sdslen(serversection));
sdsfree(serversection);
}

info_section_from_redis("server");
info_section_from_redis("clients");
info_section_from_redis("cpu");
info_section_from_redis("stats");

if (defsections || allsections || !strcasecmp(section,"sentinel")) {
dictIterator *di;
Expand Down

0 comments on commit 6233d21

Please sign in to comment.