-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Add CONFIG SET and GET loglevel feature in Sentinel #11214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
enjoy-binbin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about using config get, like config get loglevel?
btw, i am curious why the client needs this information and is there any usecase?
|
i'm also not certain why we want this info to be visible in the INFO command. |
|
@oranagra @enjoy-binbin The reason I add this feature is that in Sentinel Mode
Thanks. |
|
ok, so i think the problem is with sentinel, it does parse the redis conf file at startup, but offers no way to interact with the config at runtime, maybe that's what we should fix. |
|
@oranagra, IMHO, there is no need to expose this arguments. I do see that loglevel is not documented |
|
@moticless In sentinel, so far there is no way to check current the loglevel and change the loglevel, do you think it makes sense to provide the function similar to redis server: config get loglevel and config set loglvel XXX |
|
@hwware, I think it can be nice to have such option. If we add setter to loglevel, then we also need getter. Anyway, we need to add loglevel section to sentinel.conf. |
ok, I will follow your idea to finish this function and let you know when I update the code in this PR, thanks, |
2ba86ac to
e155bd9
Compare
oranagra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@moticless?
|
@hwware please copy the |
|
@oranagra @moticless Sorry mislead you, some features are not finished yet. I change the title to WIP status |
|
@moticless @oranagra Feature and test case ar done, please do a code review when you have time, Thanks a lot |
src/sentinel.c
Outdated
| /* =========================== SENTINEL command ============================= */ | ||
|
|
||
| /* SENTINEL CONFIG SET <option> */ | ||
| const char* getLogLevel(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const char* getLogLevel(){ | |
| const char* getLogLevel() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update it. Thanks
|
|
||
| test "Update log level" { | ||
| set current_loglevel [S 0 SENTINEL CONFIG GET loglevel] | ||
| assert {[lindex $$current_loglevel 1] == {notice}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert {[lindex $$current_loglevel 1] == {notice}} | |
| assert {[lindex $current_loglevel 1] == {notice}} |
| assert {[lindex $$current_loglevel 1] == {notice}} | ||
| S 0 SENTINEL CONFIG SET loglevel warning | ||
| set updated_loglevel [S 0 SENTINEL CONFIG GET loglevel] | ||
| assert {[lindex $$updated_loglevel 1] == {warning}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert {[lindex $$updated_loglevel 1] == {warning}} | |
| assert {[lindex $updated_loglevel 1] == {warning}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update it. Thanks. But in sentinel test case, double $$ can pass. Weird.
oranagra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@redis/core-team technically a major decision.
loglevel was supported in sentinel.conf, but not at runtime CONFIG SET and GET
Apparently we set `loglevel debug` for tls in spawn_instance. At the same time, in order to better distinguish the tests, change the name of `test-centos7-tls` to `test-centos7-tls-module`, change the name of `test-centos7-tls-no-tls` to `test-centos7-tls-module-no-tls-module`. Note that in `test-centos7-tls-module`, we did not pass `--tls-module` in sentinel test because it is not supported, see 4faddf1, added in redis#9320. So only test-ubuntu-tls fails in daily CI. The test was introduced in redis#11214.
|
|
||
| test "Update log level" { | ||
| set current_loglevel [S 0 SENTINEL CONFIG GET loglevel] | ||
| assert {[lindex $current_loglevel 1] == {notice}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this failed in test-ubuntu-tls: https://github.com/redis/redis/actions/runs/3510377800/jobs/5880112424
because we set loglevel to debug for tls, see #11528
Apparently we used to set `loglevel debug` for tls in spawn_instance. I.e. cluster and sentinel tests used to run with debug logging, only when tls mode was enabled. this was probably a leftover from when creating the tls mode tests. it cause a new test created for #11214 to fail in tls mode. At the same time, in order to better distinguish the tests, change the name of `test-centos7-tls` to `test-centos7-tls-module`, change the name of `test-centos7-tls-no-tls` to `test-centos7-tls-module-no-tls`. Note that in `test-centos7-tls-module`, we did not pass `--tls-module` in sentinel test because it is not supported, see 4faddf1, added in #9320. So only `test-ubuntu-tls` fails in daily CI. Co-authored-by: Oran Agra <oran@redislabs.com>
Till now Sentinel allowed modifying the log level in the config file, but not at runtime. this makes it possible to tune the log level at runtime
Apparently we used to set `loglevel debug` for tls in spawn_instance. I.e. cluster and sentinel tests used to run with debug logging, only when tls mode was enabled. this was probably a leftover from when creating the tls mode tests. it cause a new test created for redis#11214 to fail in tls mode. At the same time, in order to better distinguish the tests, change the name of `test-centos7-tls` to `test-centos7-tls-module`, change the name of `test-centos7-tls-no-tls` to `test-centos7-tls-module-no-tls`. Note that in `test-centos7-tls-module`, we did not pass `--tls-module` in sentinel test because it is not supported, see 4faddf1, added in redis#9320. So only `test-ubuntu-tls` fails in daily CI. Co-authored-by: Oran Agra <oran@redislabs.com>
We add a new loglevel 'nothing' to disable logging in redis#12133. This PR syncs that config change to sentinel. Because in redis#11214 we support modifying loglevel in runtime. Although I think sentinel doesn't need this nothing config, it's better to be consistent.
Till now Sentinel allowed modifying the log level in the config file, but not at runtime. this makes it possible to tune the log level at runtime
Apparently we used to set `loglevel debug` for tls in spawn_instance. I.e. cluster and sentinel tests used to run with debug logging, only when tls mode was enabled. this was probably a leftover from when creating the tls mode tests. it cause a new test created for redis#11214 to fail in tls mode. At the same time, in order to better distinguish the tests, change the name of `test-centos7-tls` to `test-centos7-tls-module`, change the name of `test-centos7-tls-no-tls` to `test-centos7-tls-module-no-tls`. Note that in `test-centos7-tls-module`, we did not pass `--tls-module` in sentinel test because it is not supported, see 4faddf1, added in redis#9320. So only `test-ubuntu-tls` fails in daily CI. Co-authored-by: Oran Agra <oran@redislabs.com>
Till now Sentinel allowed modifying the log level in the config file, but not at runtime.
this makes it possible to tune the log level at runtime