From ae2a2ac7d0880433b6b8fc584885a14e2ec4fd97 Mon Sep 17 00:00:00 2001 From: Yuri Golobokov Date: Mon, 7 Feb 2022 17:21:14 -0800 Subject: [PATCH] Add HTTP/2 settings frame tracing. This adds HTTP/2 settings frame information to debug logs. HTTP/2 settings frame contains important information like max_concurrent_streams and initial_window_size useful for debugging concurrency, latency, and throughput issues. --- packages/grpc-js/src/subchannel.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/grpc-js/src/subchannel.ts b/packages/grpc-js/src/subchannel.ts index 6f9471bb..9945b988 100644 --- a/packages/grpc-js/src/subchannel.ts +++ b/packages/grpc-js/src/subchannel.ts @@ -555,6 +555,24 @@ export class Subchannel { (error as Error).message ); }); + if (logging.isTracerEnabled(TRACER_NAME)) { + session.on('remoteSettings', (settings: http2.Settings) => { + this.trace( + 'new settings received' + + (this.session !== session ? ' on the old connection' : '') + + ': ' + + JSON.stringify(settings) + ); + }); + session.on('localSettings', (settings: http2.Settings) => { + this.trace( + 'local settings acknowledged by remote' + + (this.session !== session ? ' on the old connection' : '') + + ': ' + + JSON.stringify(settings) + ); + }); + } } private startConnectingInternal() {