Merge branch 'develop' into 70-screener-openapi-constraints
This commit is contained in:
@@ -18,6 +18,7 @@ const allowedFields = new Set([
|
|||||||
'grpcCode',
|
'grpcCode',
|
||||||
'headersReceived',
|
'headersReceived',
|
||||||
'method',
|
'method',
|
||||||
|
'networkMs',
|
||||||
'operation',
|
'operation',
|
||||||
'queueWaitMs',
|
'queueWaitMs',
|
||||||
'requestId',
|
'requestId',
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ describe('TbankClient operations', () => {
|
|||||||
operation: 'getAccounts', grpcCode: status.DEADLINE_EXCEEDED,
|
operation: 'getAccounts', grpcCode: status.DEADLINE_EXCEEDED,
|
||||||
queueWaitMs: 0, channelState: 'CONNECTING', headersReceived: false,
|
queueWaitMs: 0, channelState: 'CONNECTING', headersReceived: false,
|
||||||
}));
|
}));
|
||||||
|
const [, , fields] = logger.event.mock.calls.at(-1) as [string, string, { networkMs: unknown }];
|
||||||
|
expect(typeof fields.networkMs).toBe('number');
|
||||||
expect(JSON.stringify(logger.event.mock.calls)).not.toContain('secret');
|
expect(JSON.stringify(logger.event.mock.calls)).not.toContain('secret');
|
||||||
} finally {
|
} finally {
|
||||||
jest.useRealTimers();
|
jest.useRealTimers();
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ type TbankClientService = Client & Record<string, Unary<never, never>>;
|
|||||||
type RpcDiagnostics = {
|
type RpcDiagnostics = {
|
||||||
channelState?: string;
|
channelState?: string;
|
||||||
headersReceived?: boolean;
|
headersReceived?: boolean;
|
||||||
|
networkMs?: number;
|
||||||
queueWaitMs?: number;
|
queueWaitMs?: number;
|
||||||
trackingId?: string;
|
trackingId?: string;
|
||||||
};
|
};
|
||||||
@@ -524,10 +525,13 @@ export class TbankClient {
|
|||||||
throw new ServiceUnavailableException({ code: TbankErrorCode.Unavailable });
|
throw new ServiceUnavailableException({ code: TbankErrorCode.Unavailable });
|
||||||
}
|
}
|
||||||
const response = await this.queue.run(() => {
|
const response = await this.queue.run(() => {
|
||||||
diagnostics.queueWaitMs = Math.round(performance.now() - startedAt);
|
const sentAt = performance.now();
|
||||||
|
diagnostics.queueWaitMs = Math.round(sentAt - startedAt);
|
||||||
return this.request<Response>(
|
return this.request<Response>(
|
||||||
token, client, method, request, diagnostics,
|
token, client, method, request, diagnostics,
|
||||||
);
|
).finally(() => {
|
||||||
|
diagnostics.networkMs = Math.round(performance.now() - sentAt);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.logger.event('debug', 'tbank.rpc.completed', {
|
this.logger.event('debug', 'tbank.rpc.completed', {
|
||||||
operation: method,
|
operation: method,
|
||||||
|
|||||||
Reference in New Issue
Block a user