@onlineapps/infrastructure-tools 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/infrastructure-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Infrastructure orchestration utilities for OA Drive infrastructure services (health tracking, queue initialization, service discovery)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"author": "OnlineApps",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@onlineapps/mq-client-core": "^1.0.
|
|
22
|
-
"@onlineapps/service-common": "^1.0.1"
|
|
21
|
+
"@onlineapps/mq-client-core": "^1.0.36",
|
|
22
|
+
"@onlineapps/service-common": "^1.0.1",
|
|
23
|
+
"uuid": "^9.0.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"jest": "^29.7.0"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const { createLogger } = require('../utils/logger');
|
|
16
|
+
const { v4: uuidv4 } = require('uuid');
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Create infrastructure health publisher
|
|
@@ -68,27 +69,41 @@ function createHealthPublisher(options) {
|
|
|
68
69
|
|
|
69
70
|
try {
|
|
70
71
|
isPublishing = true;
|
|
72
|
+
|
|
73
|
+
// Generate correlation ID for this health check
|
|
74
|
+
const correlationId = uuidv4();
|
|
75
|
+
|
|
71
76
|
const healthData = {
|
|
72
77
|
serviceName,
|
|
73
78
|
version,
|
|
74
79
|
status: 'UP',
|
|
75
80
|
timestamp: new Date().toISOString(),
|
|
76
|
-
components: getHealthData()
|
|
81
|
+
components: getHealthData(),
|
|
82
|
+
correlationId // Correlation ID for tracking health check flow
|
|
77
83
|
};
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
// Structured logging with correlation ID
|
|
86
|
+
logger.info(`[InfrastructureHealth:${serviceName}] Publishing health check`, {
|
|
87
|
+
event: 'health_check_publish',
|
|
81
88
|
serviceName,
|
|
89
|
+
queue: queueName,
|
|
82
90
|
status: healthData.status,
|
|
83
|
-
timestamp: healthData.timestamp
|
|
91
|
+
timestamp: healthData.timestamp,
|
|
92
|
+
correlationId: healthData.correlationId,
|
|
93
|
+
version: healthData.version,
|
|
94
|
+
components: healthData.components
|
|
84
95
|
});
|
|
85
96
|
|
|
86
97
|
await publishFunction(queueName, healthData);
|
|
87
98
|
|
|
99
|
+
// Structured logging with correlation ID
|
|
88
100
|
logger.info(`[InfrastructureHealth:${serviceName}] ✓ Published health check`, {
|
|
101
|
+
event: 'health_check_published',
|
|
102
|
+
serviceName,
|
|
89
103
|
queue: queueName,
|
|
90
104
|
status: healthData.status,
|
|
91
|
-
timestamp: healthData.timestamp
|
|
105
|
+
timestamp: healthData.timestamp,
|
|
106
|
+
correlationId: healthData.correlationId
|
|
92
107
|
});
|
|
93
108
|
} catch (error) {
|
|
94
109
|
logger.error(`[InfrastructureHealth:${serviceName}] Failed to publish health check`, {
|
|
@@ -85,8 +85,11 @@ async function initInfrastructureQueues(channel, options = {}) {
|
|
|
85
85
|
for (const queueName of queuesToCreate) {
|
|
86
86
|
try {
|
|
87
87
|
// Verify it's an infrastructure queue
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const isInfra = queueConfig.isInfrastructureQueue(queueName);
|
|
89
|
+
if (!isInfra) {
|
|
90
|
+
logger.warn(`[QueueInit] Skipping ${queueName} - not an infrastructure queue (isInfrastructureQueue returned: ${isInfra})`);
|
|
91
|
+
// Debug: log the actual function code to verify it's the right version
|
|
92
|
+
logger.warn(`[QueueInit] Debug: isInfrastructureQueue function: ${queueConfig.isInfrastructureQueue.toString().substring(0, 200)}...`);
|
|
90
93
|
continue;
|
|
91
94
|
}
|
|
92
95
|
|