mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Merge pull request #2040 from nimf/http2-settings-tracing
Add HTTP/2 settings frame tracing
This commit is contained in:
commit
faa79fe19e
@ -108,10 +108,12 @@ export function trace(
|
||||
tracer: string,
|
||||
text: string
|
||||
): void {
|
||||
if (
|
||||
!disabledTracers.has(tracer) &&
|
||||
(allEnabled || enabledTracers.has(tracer))
|
||||
) {
|
||||
if (isTracerEnabled(tracer)) {
|
||||
log(severity, new Date().toISOString() + ' | ' + tracer + ' | ' + text);
|
||||
}
|
||||
}
|
||||
|
||||
export function isTracerEnabled(tracer: string): boolean {
|
||||
return !disabledTracers.has(tracer) &&
|
||||
(allEnabled || enabledTracers.has(tracer));
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user