Skip to content

Commit c96e7cf

Browse files
authored
Merge pull request #2051 from murgatroid99/grpc-js_session_state_logging
grpc-js: Add session state logging at call start
2 parents 26b1c1f + d51dfff commit c96e7cf

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

doc/environment_variables.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ can be set.
3636
- `server` - Traces high-level server events
3737
- `server_call` - Traces server handling of individual requests
3838
- `subchannel` - Traces subchannel connectivity state and errors
39-
- `subchannel_refcount` - Traces subchannel refcount changes
40-
- `subchannel_flowctrl` - Traces HTTP/2 flow control
39+
- `subchannel_refcount` - Traces subchannel refcount changes. Includes per-call logs.
40+
- `subchannel_flowctrl` - Traces HTTP/2 flow control. Includes per-call logs.
41+
- `subchannel_internals` - Traces HTTP/2 session state. Includes per-call logs.
4142

4243
The following tracers are added by the `@grpc/grpc-js-xds` library:
4344
- `cds_balancer` - Traces the CDS load balancing policy

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.5.5",
3+
"version": "1.5.6",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/subchannel.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ export class Subchannel {
329329
logging.trace(LogVerbosity.DEBUG, FLOW_CONTROL_TRACER_NAME, '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
330330
}
331331

332+
private internalsTrace(text: string): void {
333+
logging.trace(LogVerbosity.DEBUG, 'subchannel_internals', '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
334+
}
335+
332336
private handleBackoffTimer() {
333337
if (this.continueConnecting) {
334338
this.transitionToState(
@@ -860,6 +864,13 @@ export class Subchannel {
860864
this.session!.state.remoteWindowSize
861865
);
862866
const streamSession = this.session;
867+
this.internalsTrace(
868+
'session.closed=' +
869+
streamSession!.closed +
870+
' session.destroyed=' +
871+
streamSession!.destroyed +
872+
' session.socket.destroyed=' +
873+
streamSession!.socket.destroyed);
863874
let statsTracker: SubchannelCallStatsTracker;
864875
if (this.channelzEnabled) {
865876
this.callTracker.addCallStarted();

0 commit comments

Comments
 (0)