Skip to content

Commit c7f3287

Browse files
authored
chore: cherry pick PR#3422 feat(logging): enhanced logging upon receiving responses from the Mirror Node server (#3422) to release/0.64 (#3426)
chore(logging): enhanced logging upon receiving responses from the Mirror Node server (#3422) Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
1 parent 6bd832c commit c7f3287

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/relay/src/lib/clients/mirrorNodeClient.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,13 @@ export class MirrorNodeClient {
369369

370370
const ms = Date.now() - start;
371371
if (this.logger.isLevelEnabled('debug')) {
372-
this.logger.debug(`${requestDetails.formattedRequestId} [${method}] ${path} ${response.status} ${ms} ms`);
372+
this.logger.debug(
373+
`${
374+
requestDetails.formattedRequestId
375+
} Successfully received response from mirror node server: method=${method}, path=${path}, status=${
376+
response.status
377+
}, duration:${ms}ms, data:${JSON.stringify(response.data)}`,
378+
);
373379
}
374380
this.mirrorResponseHistogram.labels(pathLabel, response.status?.toString()).observe(ms);
375381
return response.data;
@@ -428,7 +434,9 @@ export class MirrorNodeClient {
428434

429435
if (error.response && acceptedErrorResponses?.includes(effectiveStatusCode)) {
430436
if (this.logger.isLevelEnabled('debug')) {
431-
this.logger.debug(`${requestIdPrefix} [${method}] ${path} ${effectiveStatusCode} status`);
437+
this.logger.debug(
438+
`${requestIdPrefix} An accepted error occurred while communicating with the mirror node server: method=${method}, path=${path}, status=${effectiveStatusCode}`,
439+
);
432440
}
433441
return null;
434442
}
@@ -445,7 +453,7 @@ export class MirrorNodeClient {
445453
} else {
446454
this.logger.error(
447455
new Error(error.message),
448-
`${requestIdPrefix} [${method}] ${path} ${effectiveStatusCode} status`,
456+
`${requestIdPrefix} Error encountered while communicating with the mirror node server: method=${method}, path=${path}, status=${effectiveStatusCode}`,
449457
);
450458
}
451459

@@ -1036,6 +1044,7 @@ export class MirrorNodeClient {
10361044
if (address === ethers.ZeroAddress) return [];
10371045

10381046
const queryParams = this.prepareLogsParams(contractLogsResultsParams, limitOrderParams);
1047+
10391048
const apiEndpoint = MirrorNodeClient.GET_CONTRACT_RESULT_LOGS_BY_ADDRESS_ENDPOINT.replace(
10401049
MirrorNodeClient.ADDRESS_PLACEHOLDER,
10411050
address,

0 commit comments

Comments
 (0)