Skip to content

Commit e64adfa

Browse files
authored
Merge pull request #1857 from murgatroid99/grpc-js_more_connection_logging
grpc-js: Add more trace logging around establishing connections
2 parents 0ae32bb + 776bcb4 commit e64adfa

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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.3.5",
3+
"version": "1.3.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/http_proxy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ export function getProxiedConnection(
254254
reject();
255255
});
256256
} else {
257+
trace(
258+
'Successfully established a plaintext connection to ' +
259+
options.path +
260+
' through proxy ' +
261+
proxyAddressString
262+
);
257263
resolve({
258264
socket,
259265
realTarget: parsedTarget,

packages/grpc-js/src/subchannel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ export class Subchannel {
303303
}
304304

305305
private createSession(proxyConnectionResult: ProxyConnectionResult) {
306+
if (proxyConnectionResult.realTarget) {
307+
trace(this.subchannelAddressString + ' creating HTTP/2 session through proxy to ' + proxyConnectionResult.realTarget);
308+
} else {
309+
trace(this.subchannelAddressString + ' creating HTTP/2 session');
310+
}
306311
const targetAuthority = getDefaultAuthority(
307312
proxyConnectionResult.realTarget ?? this.channelTarget
308313
);
@@ -403,6 +408,7 @@ export class Subchannel {
403408
});
404409
session.once('close', () => {
405410
if (this.session === session) {
411+
trace(this.subchannelAddressString + ' connection closed');
406412
this.transitionToState(
407413
[ConnectivityState.CONNECTING],
408414
ConnectivityState.TRANSIENT_FAILURE

0 commit comments

Comments
 (0)