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

allow to trace with lazy text calculation #2816

Closed
wants to merge 1 commit into from
Closed

Conversation

ygalbel
Copy link

@ygalbel ygalbel commented Sep 4, 2024

In internal-channel.ts file there is a trace after channel is constructed.
In this trace, the full stacktrace is added.

The trace is written only when the log level is on trace, but the stacktrace is calculated in any case.
We found in our usage, that if you have a big bundle file it can take few seconds to calculate the stacktrace, it can be reasonable in trace mode but not in production.

I suggest to made the text in trace function to allow also a delegate that returns a function.
The delegate will be called only when the trace is materialized.

Copy link

linux-foundation-easycla bot commented Sep 4, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@murgatroid99
Copy link
Member

Simpler solution: surround that call to trace with if (isTracerEnabled('channel_stacktrace')) { ... }. This is how we are handling other cases where producing the trace log text is expensive.

Even simpler solution: just delete that trace log line. I don't think it's actually that valuable.

Either way, I recommend rebasing the change onto the @grpc/[email protected] branch to get the change out faster.

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.

2 participants