Skip to content

Commit

Permalink
Merge pull request #1857 from murgatroid99/grpc-js_more_connection_lo…
Browse files Browse the repository at this point in the history
…gging

grpc-js: Add more trace logging around establishing connections
  • Loading branch information
murgatroid99 committed Jul 19, 2021
2 parents 0ae32bb + 776bcb4 commit e64adfa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 6 additions & 0 deletions packages/grpc-js/src/http_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions packages/grpc-js/src/subchannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e64adfa

Please sign in to comment.