HTTP/2 flow control tracing

subchannel_flowctrl tracer, if enabled, logs local and remote window
sizes of subchannel's HTTP2 session to debug log on the start of every
call.
This commit is contained in:
Yuri Golobokov 2022-02-08 15:53:34 -08:00
parent faa79fe19e
commit da66707d3b
2 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,7 @@ can be set.
- `server_call` - Traces server handling of individual requests
- `subchannel` - Traces subchannel connectivity state and errors
- `subchannel_refcount` - Traces subchannel refcount changes
- `subchannel_flowctrl` - Traces HTTP/2 flow control
The following tracers are added by the `@grpc/grpc-js-xds` library:
- `cds_balancer` - Traces the CDS load balancing policy

View File

@ -41,6 +41,7 @@ import { SubchannelRef, ChannelzTrace, ChannelzChildrenTracker, SubchannelInfo,
const clientVersion = require('../../package.json').version;
const TRACER_NAME = 'subchannel';
const FLOW_CONTROL_TRACER_NAME = 'subchannel_flowctrl';
const MIN_CONNECT_TIMEOUT_MS = 20000;
const INITIAL_BACKOFF_MS = 1000;
@ -324,6 +325,10 @@ export class Subchannel {
logging.trace(LogVerbosity.DEBUG, 'subchannel_refcount', '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
}
private flowControlTrace(text: string): void {
logging.trace(LogVerbosity.DEBUG, FLOW_CONTROL_TRACER_NAME, '(' + this.channelzRef.id + ') ' + this.subchannelAddressString + ' ' + text);
}
private handleBackoffTimer() {
if (this.continueConnecting) {
this.transitionToState(
@ -848,6 +853,12 @@ export class Subchannel {
' with headers\n' +
headersString
);
this.flowControlTrace(
'local window size: ' +
this.session!.state.localWindowSize +
' remote window size: ' +
this.session!.state.remoteWindowSize
);
const streamSession = this.session;
let statsTracker: SubchannelCallStatsTracker;
if (this.channelzEnabled) {