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

improvement(log): add call stack to func on the record #14052

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elliothllm
Copy link

Description

Moved the stack.Caller to a func on the Record. Calling the stack multiple times every log gets expensive even when you are logging under the level defined in config. This is because the call stack will get created every time the Log() func runs on the handlers, even if the call stack is not being used.

Context

This issue came up in CDK Erigon saying the log was performing poorly in a pprof benchmark.

Issue 1: 1637
Issue 2: 1770

After running a bechmark pprof after this changeset, the call stack has gone from the flame graph and improves performance.

CDK Erigon changeset

1f4cca638da71ffec4490bf21fa84004984b3546

improvement(log): comment call stack handler
@elliothllm elliothllm force-pushed the improvement/log-caller branch from 6920090 to 7525db3 Compare March 4, 2025 15:33
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

Successfully merging this pull request may close these issues.

1 participant