Skip to content

Commit

Permalink
Merge pull request #2061 from murgatroid99/grpc-js_channel_stacktrace…
Browse files Browse the repository at this point in the history
…_trace

grpc-js: Add channel construction stacktrace traces
  • Loading branch information
murgatroid99 authored Mar 16, 2022
2 parents d8e73f3 + 97584dc commit 18286da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ can be set.
- `subchannel_refcount` - Traces subchannel refcount changes. Includes per-call logs.
- `subchannel_flowctrl` - Traces HTTP/2 flow control. Includes per-call logs.
- `subchannel_internals` - Traces HTTP/2 session state. Includes per-call logs.
- `channel_stacktrace` - Traces channel construction events with stack traces.

The following tracers are added by the `@grpc/grpc-js-xds` library:
- `cds_balancer` - Traces the CDS load balancing policy
Expand Down
2 changes: 2 additions & 0 deletions packages/grpc-js/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ export class ChannelImplementation implements Channel {
new CompressionFilterFactory(this, this.options),
]);
this.trace('Channel constructed with options ' + JSON.stringify(options, undefined, 2));
const error = new Error();
trace(LogVerbosity.DEBUG, 'channel_stacktrace', '(' + this.channelzRef.id + ') ' + 'Channel constructed \n' + error.stack?.substring(error.stack.indexOf('\n')+1));
}

private getChannelzInfo(): ChannelInfo {
Expand Down

0 comments on commit 18286da

Please sign in to comment.