-
Notifications
You must be signed in to change notification settings - Fork 110
Control Gorouter log level using debugserver reconfigurable sink #495
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
base: develop
Are you sure you want to change the base?
Control Gorouter log level using debugserver reconfigurable sink #495
Conversation
|
@@ -42,6 +43,27 @@ func DebugAddress(flags *flag.FlagSet) string { | |||
return dbgFlag.Value.String() | |||
} | |||
|
|||
func validateloglevelrequest(w http.ResponseWriter, r *http.Request, level []byte) error { |
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.
I'll remove this change in the vendor copy of debugserver/server.go. This change will be part of another PR for debugserver repo.
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.
Thanks for calling this out. You can remove this change, and link the related PR in the main section. Regular contributors will know how to bump the submodules with multiple linked PRs.
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.
If you've already made the change in the debugserver you can just add a commit on top of this PR to bump to dependency and re-vendor to make this PR self-contained.
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.
The other PR is still not merged cloudfoundry/debugserver#73. I'll get that merged first.
Following log entries are seen in the /var/vcap/sys/log/gorouter/gorouter.stdout.log for various inputs on the Router VM. $ curl http://127.0.0.1:17002/log-level -d info time=2025-06-20T07:46:21.091Z level=INFO msg="Gorouter logger -> zapcore log level updated." new-level=info $ curl http://127.0.0.1:17002/log-level -d debug time=2025-06-20T07:46:21.091Z level=INFO msg="Gorouter logger -> zapcore log level updated." new-level=debug $ curl -X GET http://127.0.0.1:17002/log-level -d info $ curl -X PUT http://127.0.0.1:17002/log-level -d info $ curl -X POST https://127.0.0.1:17002/log-level -d info $ curl -X POST http://127.0.0.1:17002/log-level -d {} $ curl -X POST http://127.0.0.1:17002/log-level |
@@ -42,6 +43,27 @@ func DebugAddress(flags *flag.FlagSet) string { | |||
return dbgFlag.Value.String() | |||
} | |||
|
|||
func validateloglevelrequest(w http.ResponseWriter, r *http.Request, level []byte) error { |
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.
If you've already made the change in the debugserver you can just add a commit on top of this PR to bump to dependency and re-vendor to make this PR self-contained.
Hello @navinms711 , |
One more thought: Instead of adding all that code to |
ceef6d7
to
d66a05d
Compare
I looked into this. To change the debugserver support |
I have moved most changes from main.go to adapter.go in the same
All tests have passed. Ran 189 of 189 Specs in 2100.664 seconds |
src/code.cloudfoundry.org/gorouter/integration/test_utils_test.go
Outdated
Show resolved
Hide resolved
bb0cbd0
to
07a996b
Compare
g modified: src/code.cloudfoundry.org/gorouter/test_util/helpers.go
07a996b
to
08feac8
Compare
Summary
[1] Briefly explain why this PR is necessary
Gorouter uses slog with zap handler as backend for current logging levels. The Gorouter runs a debugserver (a http server) which listens to a few API endpoints. The
/log-level -d <debug/info/error/fatal>
was introduced to make changes to the log level on demand at runtime. However, a POST request to thelog-level
endpoint has no effect in the current code. This PR proposes changes needed to make log level change work through a POST request.[2] Provide details of where this request is coming from including links, GitHub Issues, etc..
This is a request from Broadcom Engineering team to fix it and recorded in TNZ-23119.
[3] Provide details of prior work (if applicable) including links to commits, github issues, etc...
cloudfoundry/gorouter#452
[4] Backward Compatibility
Breaking Change? NO
[5] If this is a breaking change, or modifies currently expected behaviors of core functionality.
[6] Are there any other dependent PRs?
Yes, this PR needs the latest changes to debugserver code in cloudfoundry/debugserver#73