Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Fix Gorouter's debugserver endpoint to allow log level changes at runtime#452

Open
MarcPaquette wants to merge 3 commits into
main from
WIP_debugserver-loglevel
Open

Fix Gorouter's debugserver endpoint to allow log level changes at runtime #452
MarcPaquette wants to merge 3 commits into
main from
WIP_debugserver-loglevel

Conversation

@MarcPaquette

@MarcPaquette MarcPaquette commented Oct 31, 2024

Copy link
Copy Markdown
Member

We have a debugserver in gorouter + explicit code trying to support reconfiguring the log level on the fly. Being able to do this helps operators + support troubleshoot live issues without having to restart Gorouters. This has been broken since ~2017.

This change allows CF Administrators to change gorouter's logging on the fly to triage issue in much finer detail.

This is related to the change in the debug server cloudfoundry/debugserver#72

@MarcPaquette MarcPaquette requested a review from a team as a code owner October 31, 2024 14:34
Comment thread logger/logger.go
Comment thread logger/logger.go

var (
conf dynamicLoggingConfig
Conf DynamicLoggingConfig

@ameowlia ameowlia Nov 1, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this exported now? I assume for the change in main.go?

exposing the variable means anyone anywhere can change it. what about adding a getter function instead?

@MarcPaquette MarcPaquette Nov 5, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We need the satisfy the debugserver's reconfigurable sink: https://github.com/cloudfoundry/debugserver/blob/main/server.go#L24-L26

The base gorouter logger is inited at the package level and privately puts us in a bit of an odd spot with further changes to the logger. I exported the config as we need the debugserver to actually change the config via SetMinLevel()

Basically since the grlogger.baseLogger is initialized on importation via init() and private to the package, I pushed the config out as public as we need something to satisfy the ReconfigurableSinkInterface. A getter doesn't quite fit the pattern. There is an argument for pushing it further down, but this was a bit simpler.

I went with the config as it's the area where adding the method to satisfy the ReconfigurableSinkInterface was the least intrusive.

Comment thread logger/logger.go
Comment on lines +95 to +96
mutex.Lock()
defer mutex.Unlock()

@MarcPaquette MarcPaquette Nov 6, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ameowlia
I added the Mutex here since there are a few different ways the logging level can get changed.

Copy link
Copy Markdown
Member Author

@ameowlia Is this okay to merge in now?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@andy-a-d-nguyen andy-a-d-nguyen andy-a-d-nguyen left review comments
@ameowlia ameowlia ameowlia requested changes
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /