Skip to content
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

Support non-blocking logger #1675

Open
WillSewell opened this issue Dec 28, 2024 · 0 comments
Open

Support non-blocking logger #1675

WillSewell opened this issue Dec 28, 2024 · 0 comments

Comments

@WillSewell
Copy link

Something we've identified with load testing with is that the latency cost of logging "starting request" and "request completed" is very high under load: we observed p95 latency being 7x higher with log level at info vs log level at warn.

The reason for this is zerolog is currently configured to log to os.Stderr directly, without any buffering. This is relatively expensive in a cloud environment with network attached storage. To optimise this, it would help to use buffered logging. It looks like zerolog supports this.

The problem is, I don't think encore currently provides a way of configuring the RootLogger in runtimes/go/appruntime/logging.

I'm wondering whether

a. you'd be open to making this configurable
b. what your thoughts are on the config interface

For b., I can imagine either making it very flexible and allowing the caller to pass in an arbitrary zerolog.Logger with something like SetLogger, but maybe you'd prefer to be more opinionated and allow a non-blocking logging to be configured via standard Encore config.

Let me know your thoughts and I could have a stab at implementating this.

(Note, I brought this up in Discord here, but I think an issue is probably a better place to track this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant