mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2085 from murgatroid99/grpc-js_keepalive_traces
grpc-js: Add more details to keepalive ping tracing
This commit is contained in:
commit
0feeab3d09
|
@ -321,6 +321,10 @@ export class Subchannel {
|
||||||
logging.trace(LogVerbosity.DEBUG, 'subchannel_internals', '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
|
logging.trace(LogVerbosity.DEBUG, 'subchannel_internals', '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private keepaliveTrace(text: string): void {
|
||||||
|
logging.trace(LogVerbosity.DEBUG, 'keepalive', '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
|
||||||
|
}
|
||||||
|
|
||||||
private handleBackoffTimer() {
|
private handleBackoffTimer() {
|
||||||
if (this.continueConnecting) {
|
if (this.continueConnecting) {
|
||||||
this.transitionToState(
|
this.transitionToState(
|
||||||
|
@ -351,18 +355,15 @@ export class Subchannel {
|
||||||
if (this.channelzEnabled) {
|
if (this.channelzEnabled) {
|
||||||
this.keepalivesSent += 1;
|
this.keepalivesSent += 1;
|
||||||
}
|
}
|
||||||
logging.trace(
|
this.keepaliveTrace('Sending ping with timeout ' + this.keepaliveTimeoutMs + 'ms');
|
||||||
LogVerbosity.DEBUG,
|
|
||||||
'keepalive',
|
|
||||||
'(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' +
|
|
||||||
'Sending ping'
|
|
||||||
);
|
|
||||||
this.keepaliveTimeoutId = setTimeout(() => {
|
this.keepaliveTimeoutId = setTimeout(() => {
|
||||||
|
this.keepaliveTrace('Ping timeout passed without response');
|
||||||
this.transitionToState([ConnectivityState.READY], ConnectivityState.IDLE);
|
this.transitionToState([ConnectivityState.READY], ConnectivityState.IDLE);
|
||||||
}, this.keepaliveTimeoutMs);
|
}, this.keepaliveTimeoutMs);
|
||||||
this.keepaliveTimeoutId.unref?.();
|
this.keepaliveTimeoutId.unref?.();
|
||||||
this.session!.ping(
|
this.session!.ping(
|
||||||
(err: Error | null, duration: number, payload: Buffer) => {
|
(err: Error | null, duration: number, payload: Buffer) => {
|
||||||
|
this.keepaliveTrace('Received ping response');
|
||||||
clearTimeout(this.keepaliveTimeoutId);
|
clearTimeout(this.keepaliveTimeoutId);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue