Skip to content

feat(grpc-js): add option to disable caller stack trace capture - #3083

Open
olavloite wants to merge 1 commit into
grpc:masterfrom
olavloite:stack-trace-capture-option
Open

olavloite wants to merge 1 commit into
grpc:masterfrom
olavloite:stack-trace-capture-option

Conversation

@olavloite

Copy link
Copy Markdown

Currently, Client constructs a new Error on every RPC invocation to capture the caller's stack trace in case the call fails. Constructing an Error captures a full V8 stack trace synchronously on every call, which adds noticeable CPU and GC overhead in high-throughput applications.

This adds a channel option grpc.enable_caller_stack_traces (enabled by default) that allows clients to opt out of caller stack trace capture. When disabled, the client omits caller stack frame capture during call dispatch, reducing per-RPC overhead.

The default behavior of the gRPC client remains unchanged by this PR.

Currently, Client constructs a new Error on every RPC invocation to
capture the caller's stack trace in case the call fails. Constructing an
Error captures a full V8 stack trace synchronously on every call, which
adds noticeable CPU and GC overhead in high-throughput applications.

This adds a channel option `grpc.enable_caller_stack_traces` (enabled by
default) that allows clients to opt out of caller stack trace capture.
When disabled, the client omits caller stack frame capture during call
dispatch, reducing per-RPC overhead.

The default behavior of the gRPC client remains unchanged by this PR.
* stack trace. Enabled by default (1). Can be set to 0 to disable and avoid
* stack trace capture overhead for every RPC.
*/
'grpc.enable_caller_stack_traces'?: number;

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.

For consistency with other channel options that are specific to this implementation, and have no reason to ever be shared with the C++ implementation, this option name should be grpc-node.enable_caller_stack_traces.

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.

3 participants