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

Idea: sampling of logs #60

Open
frekw opened this issue Mar 13, 2020 · 4 comments
Open

Idea: sampling of logs #60

frekw opened this issue Mar 13, 2020 · 4 comments

Comments

@frekw
Copy link

frekw commented Mar 13, 2020

Hi!

Something I often struggle with is getting the log levels in production right. Either I get way too much noise, or run the risk of not having enough context to efficiently debug production errors.

One approach to improve this that I've used in the past is to do log sampling on a per-request-basis. It more or less works by buffering all log calls during the duration of the request, but only actually emits ~1% of requests' logs if nothing goes wrong. But, if a log line with level warn >= is logged, emit everything that's been buffered. This gives you the ability to use liberal debug logging in production while still keeping your log volumes at manageable levels.

I realize that this may very well be outside of the scope for this project, but wanted to open an issue for discussion!

@zhiwilliam
Copy link

I will add some more ideas. We need several different loggers. One is for error happened, I need log every step information but if nothing happened, I want log nothing. Which could be done by mapError( yourLogger => saveLog...) Another one is for performance log. You log every time we call every IO or method, log running time. But don't write them out. Instead, in your logger you record average time cost and max one (with all steps log for that max one).

@pshemass
Copy link
Collaborator

pshemass commented Nov 18, 2020

@zhiwilliam do you want to open PR with one of your ideas?

@zhiwilliam
Copy link

zhiwilliam commented Nov 18, 2020 via email

@pshemass
Copy link
Collaborator

feel free to reach me out on discord maybe we could put something together

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

3 participants