Skip to content

Commit cb11e66

Browse files
committed
grpc-js: Add channel option to enable TLS tracing
1 parent 6b036f3 commit cb11e66

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
@@ -427,6 +427,8 @@ export class Server {
427427
serverOptions,
428428
creds._getSettings()!
429429
);
430+
secureServerOptions.enableTrace =
431+
this.options['grpc-node.tls_enable_trace'] === 1;
430432
http2Server = http2.createSecureServer(secureServerOptions);
431433
http2Server.on('secureConnection', (socket: TLSSocket) => {
432434
/* 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
@@ -677,6 +677,7 @@ export class Http2SubchannelConnector implements SubchannelConnector {
677677
connectionOptions = {
678678
...connectionOptions,
679679
...address,
680+
enableTrace: options['grpc-node.tls_enable_trace'] === 1,
680681
};
681682

682683
/* http2.connect uses the options here:
@@ -760,6 +761,9 @@ export class Http2SubchannelConnector implements SubchannelConnector {
760761
connectionOptions.servername = hostPort?.host ?? targetPath;
761762
}
762763
}
764+
if (options['grpc-node.tls_enable_trace']) {
765+
connectionOptions.enableTrace = true;
766+
}
763767
}
764768

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

0 commit comments

Comments
 (0)