Skip to content

Commit ff25a75

Browse files
authored
Merge pull request #2507 from murgatroid99/grpc-js_tls_trace
grpc-js: Add channel option to enable TLS tracing
2 parents 8f1a48c + cb11e66 commit ff25a75

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/grpc-js/src/channel-options.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export interface ChannelOptions {
5757
'grpc-node.max_session_memory'?: number;
5858
'grpc.service_config_disable_resolution'?: number;
5959
'grpc.client_idle_timeout_ms'?: number;
60+
/**
61+
* Set the enableTrace option in TLS clients and servers
62+
*/
63+
'grpc-node.tls_enable_trace'?: number;
6064
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6165
[key: string]: any;
6266
}
@@ -91,6 +95,7 @@ export const recognizedOptions = {
9195
'grpc-node.max_session_memory': true,
9296
'grpc.service_config_disable_resolution': true,
9397
'grpc.client_idle_timeout_ms': true,
98+
'grpc-node.tls_enable_trace': true,
9499
};
95100

96101
export function channelOptionsEqual(

packages/grpc-js/src/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ export class Server {
426426
serverOptions,
427427
creds._getSettings()!
428428
);
429+
secureServerOptions.enableTrace =
430+
this.options['grpc-node.tls_enable_trace'] === 1;
429431
http2Server = http2.createSecureServer(secureServerOptions);
430432
http2Server.on('secureConnection', (socket: TLSSocket) => {
431433
/* These errors need to be handled by the user of Http2SecureServer,

packages/grpc-js/src/transport.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ export class Http2SubchannelConnector implements SubchannelConnector {
712712
connectionOptions = {
713713
...connectionOptions,
714714
...address,
715+
enableTrace: options['grpc-node.tls_enable_trace'] === 1,
715716
};
716717

717718
/* http2.connect uses the options here:
@@ -795,6 +796,9 @@ export class Http2SubchannelConnector implements SubchannelConnector {
795796
connectionOptions.servername = hostPort?.host ?? targetPath;
796797
}
797798
}
799+
if (options['grpc-node.tls_enable_trace']) {
800+
connectionOptions.enableTrace = true;
801+
}
798802
}
799803

800804
return getProxiedConnection(address, options, connectionOptions).then(

0 commit comments

Comments
 (0)