Skip to content

Commit fe97c68

Browse files
committed
fix: address PR review comments
- Remove signal handler duplication to prevent shutdown race conditions - Fix telemetry cleanup method access path - Extract magic values to constants for better maintainability - Limit proof event logging to prevent huge logs - Refactor sequential retry to parallel for better performance - Fix queue status log consistency - Remove dead code (logLifetimeProofSummary) Addresses review comments from PR #4014
1 parent 51d3ce4 commit fe97c68

3 files changed

Lines changed: 228 additions & 122 deletions

File tree

ot-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ class OTNode {
448448
const telemetryModuleManager = this.container.resolve('telemetryModuleManager');
449449
if (telemetryModuleManager && telemetryModuleManager.getImplementation()) {
450450
this.logger.info('Cleaning up telemetry...');
451-
await telemetryModuleManager.getImplementation().module.cleanup();
451+
await telemetryModuleManager.getImplementation().cleanup();
452452
}
453453
} catch (error) {
454454
this.logger.error(`Error during telemetry cleanup: ${error.message}`);

src/constants/constants.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,3 +1105,34 @@ export const MAX_TOKEN_ID_PER_GET_PAGE = 50;
11051105
export const BLAZEGRAPH_HEALTH_INTERVAL = 60 * 1000;
11061106

11071107
export const MAX_COMMAND_LIFETIME = 15 * 60 * 1000;
1108+
1109+
// Telemetry constants
1110+
export const TELEMETRY_CONNECTION_STATUS = {
1111+
CONNECTED: 'connected',
1112+
FAILED: 'failed',
1113+
DISCONNECTED: 'disconnected',
1114+
ERROR: 'error',
1115+
RECONNECTING: 'reconnecting',
1116+
};
1117+
1118+
export const TELEMETRY_INTERVALS = {
1119+
HEALTH_CHECK: 3 * 60 * 1000, // 3 minutes
1120+
CONNECTION_HEALTH: 30 * 1000, // 30 seconds
1121+
RETRY_QUEUE: 10 * 1000, // 10 seconds
1122+
BATCH_TIMEOUT: 5000, // 5 seconds
1123+
ERROR_LOG: 60000, // 1 minute
1124+
};
1125+
1126+
export const TELEMETRY_BATCH_CONFIG = {
1127+
BATCH_SIZE: 50,
1128+
MAX_BATCH_SIZE: 200,
1129+
MAX_PERSISTENT_QUEUE_SIZE: 10000,
1130+
MAX_RECENT_EVENTS: 50,
1131+
MAX_RETRY_ATTEMPTS: 5,
1132+
BASE_RETRY_DELAY: 1000, // 1 second
1133+
MAX_TIME_WITHOUT_SUCCESS: 5 * 60 * 1000, // 5 minutes
1134+
};
1135+
1136+
export const TELEMETRY_NULL_VALUE = 'NULL';
1137+
1138+
export const TELEMETRY_MAX_LOG_OPERATION_IDS = 10;

0 commit comments

Comments
 (0)