Skip to content

Conversation

@hwware
Copy link
Contributor

@hwware hwware commented Aug 30, 2022

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

@hwware hwware requested a review from oranagra August 30, 2022 19:07
Copy link
Contributor

@enjoy-binbin enjoy-binbin left a 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?

@oranagra
Copy link
Member

i'm also not certain why we want this info to be visible in the INFO command.
arguably, we can push the entire CONFIG into the INFO command, but that doesn't make any sense.
i think the only few things that make sense are configs that are useful for monitoring systems.
like maxmemory to compare to used_memory, and maxclients to compare to connected_clients.

@oranagra oranagra added the state:to-be-closed requesting the core team to close the issue label Aug 31, 2022
@hwware
Copy link
Contributor Author

hwware commented Aug 31, 2022

@oranagra @enjoy-binbin The reason I add this feature is that in Sentinel Mode

  1. Monitors have no way to know current loglevel and logfile location, config get loglevel does not work in sentinel mode and sentinel config get loglevel do not support this feature as well.
  2. There is no way to change the loglevel by using config set loglevel XXX in sentinel mode..

Thanks.

@oranagra
Copy link
Member

oranagra commented Sep 1, 2022

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.
@moticless @yossigo WDYT?

@moticless
Copy link
Collaborator

@oranagra,
As sentinel is actually a modified redis-server, it hides many unused redis-server configuration.
Exposing config get * will expose all those unused parameters.
On the other hand it doesn't support natively sentinel configuration.
It requires to refactor config infrastructure. I doubt it worth the effort for sentinel alone.

IMHO, there is no need to expose this arguments. I do see that loglevel is not documented
at file sentinel.conf, maybe this is what we should only need to fix.

@hwware
Copy link
Contributor Author

hwware commented Sep 1, 2022

@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

@moticless
Copy link
Collaborator

@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.

@hwware
Copy link
Contributor Author

hwware commented Sep 1, 2022

@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,

@enjoy-binbin enjoy-binbin removed the state:to-be-closed requesting the core team to close the issue label Sep 2, 2022
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
@moticless?

@oranagra oranagra changed the title Add log information in the info command Add CONFIG SET loglevel to Sntinel Oct 22, 2022
@oranagra
Copy link
Member

@hwware please copy the loglevel documentation to sentinel.conf

@hwware hwware changed the title Add CONFIG SET loglevel to Sntinel Add CONFIG SET loglevel to Sentinel Oct 24, 2022
@hwware hwware changed the title Add CONFIG SET loglevel to Sentinel WIP---Add CONFIG SET loglevel to Sentinel Oct 24, 2022
@hwware
Copy link
Contributor Author

hwware commented Oct 24, 2022

@oranagra @moticless Sorry mislead you, some features are not finished yet. I change the title to WIP status

@hwware hwware changed the title WIP---Add CONFIG SET loglevel to Sentinel Add CONFIG SET and GET loglevel feature in Sentinel Nov 14, 2022
@hwware
Copy link
Contributor Author

hwware commented Nov 14, 2022

@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(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const char* getLogLevel(){
const char* getLogLevel() {

Copy link
Contributor Author

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}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert {[lindex $$updated_loglevel 1] == {warning}}
assert {[lindex $updated_loglevel 1] == {warning}}

Copy link
Contributor Author

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.

Copy link
Member

@oranagra oranagra left a 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

@oranagra oranagra added the release-notes indication that this issue needs to be mentioned in the release notes label Nov 16, 2022
@oranagra oranagra added the approval-needed Waiting for core team approval to be merged label Nov 16, 2022
@oranagra oranagra merged commit 2f41177 into redis:unstable Nov 20, 2022
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request Nov 21, 2022
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}}
Copy link
Contributor

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

oranagra added a commit that referenced this pull request Nov 21, 2022
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>
madolson pushed a commit to madolson/redis that referenced this pull request Apr 19, 2023
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
madolson pushed a commit to madolson/redis that referenced this pull request Apr 19, 2023
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>
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request May 24, 2023
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.
oranagra pushed a commit that referenced this pull request May 24, 2023
We add a new loglevel 'nothing' to disable logging in #12133.
This PR syncs that config change to sentinel. Because in #11214
we support modifying loglevel in runtime.

Although I think sentinel doesn't need this nothing config,
it's better to be consistent.
enjoy-binbin pushed a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
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
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants