Skip to content

Commit

Permalink
Merge pull request #2041 from nimf/http2-flowctrl-tracing
Browse files Browse the repository at this point in the history
HTTP/2 flow control tracing
  • Loading branch information
murgatroid99 committed Feb 10, 2022
2 parents faa79fe + da66707 commit d57df93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions packages/grpc-js/src/subchannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d57df93

Please sign in to comment.