grpc-js: Add more trace logging around establishing connections

This commit is contained in:
Michael Lumish 2021-07-19 10:12:17 -07:00
parent 0ae32bb05e
commit 776bcb4632
3 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.3.5",
"version": "1.3.6",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -254,6 +254,12 @@ export function getProxiedConnection(
reject();
});
} else {
trace(
'Successfully established a plaintext connection to ' +
options.path +
' through proxy ' +
proxyAddressString
);
resolve({
socket,
realTarget: parsedTarget,

View File

@ -303,6 +303,11 @@ export class Subchannel {
}
private createSession(proxyConnectionResult: ProxyConnectionResult) {
if (proxyConnectionResult.realTarget) {
trace(this.subchannelAddressString + ' creating HTTP/2 session through proxy to ' + proxyConnectionResult.realTarget);
} else {
trace(this.subchannelAddressString + ' creating HTTP/2 session');
}
const targetAuthority = getDefaultAuthority(
proxyConnectionResult.realTarget ?? this.channelTarget
);
@ -403,6 +408,7 @@ export class Subchannel {
});
session.once('close', () => {
if (this.session === session) {
trace(this.subchannelAddressString + ' connection closed');
this.transitionToState(
[ConnectivityState.CONNECTING],
ConnectivityState.TRANSIENT_FAILURE