taist 0.2.11 → 0.2.12
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/lib/trace-collector.js +3 -3
- package/lib/trace-reporter.js +13 -3
- package/package.json +1 -1
package/lib/trace-collector.js
CHANGED
|
@@ -79,7 +79,7 @@ export class TraceCollector extends EventEmitter {
|
|
|
79
79
|
buffer += data;
|
|
80
80
|
|
|
81
81
|
if (lifecycleDebug) {
|
|
82
|
-
console.log(
|
|
82
|
+
console.log(`[LIFECYCLE collector] [${Date.now()}] RAW DATA received, length:`, data.length, 'buffer now:', buffer.length);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Process complete NDJSON lines
|
|
@@ -163,7 +163,7 @@ export class TraceCollector extends EventEmitter {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
if (lifecycleDebug) {
|
|
166
|
-
console.log(
|
|
166
|
+
console.log(`[LIFECYCLE collector] [${Date.now()}] RECEIVED:`, trace.name, 'depth:', trace.depth, 'correlationId:', trace.correlationId);
|
|
167
167
|
} else if (debug) {
|
|
168
168
|
console.log('[collector] RECEIVED:', trace.name, 'depth:', trace.depth, 'correlationId:', trace.correlationId);
|
|
169
169
|
}
|
|
@@ -205,7 +205,7 @@ export class TraceCollector extends EventEmitter {
|
|
|
205
205
|
const lifecycleDebug = process.env.TAIST_TRACE_LIFECYCLE === 'true';
|
|
206
206
|
|
|
207
207
|
if (lifecycleDebug) {
|
|
208
|
-
console.log(
|
|
208
|
+
console.log(`[LIFECYCLE collector] [${Date.now()}] stop() called, connections:`, this.connections.size);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// Send shutdown signal to all connected workers
|
package/lib/trace-reporter.js
CHANGED
|
@@ -317,10 +317,16 @@ export class TraceReporter extends EventEmitter {
|
|
|
317
317
|
const traces = this.buffer.splice(0, this.buffer.length);
|
|
318
318
|
|
|
319
319
|
if (lifecycleDebug) {
|
|
320
|
-
|
|
320
|
+
const now = Date.now();
|
|
321
|
+
console.log(`[LIFECYCLE reporter] [${now}] SENDING`, traces.length, 'traces to collector');
|
|
321
322
|
for (const t of traces) {
|
|
322
323
|
console.log('[LIFECYCLE reporter] -', t.name, 'depth:', t.depth);
|
|
323
324
|
}
|
|
325
|
+
// Log socket state to diagnose connection issues
|
|
326
|
+
console.log(`[LIFECYCLE reporter] [${now}] Socket state: destroyed=`, this.socket.destroyed,
|
|
327
|
+
'writableEnded=', this.socket.writableEnded,
|
|
328
|
+
'readableEnded=', this.socket.readableEnded,
|
|
329
|
+
'pending=', this.socket.pending);
|
|
324
330
|
}
|
|
325
331
|
|
|
326
332
|
const message = JSON.stringify({
|
|
@@ -330,17 +336,21 @@ export class TraceReporter extends EventEmitter {
|
|
|
330
336
|
});
|
|
331
337
|
|
|
332
338
|
return new Promise((resolve, reject) => {
|
|
333
|
-
this.socket.write(message + "\n", (err) => {
|
|
339
|
+
const writeResult = this.socket.write(message + "\n", (err) => {
|
|
334
340
|
if (err) {
|
|
335
|
-
if (lifecycleDebug) console.log('[LIFECYCLE reporter]
|
|
341
|
+
if (lifecycleDebug) console.log('[LIFECYCLE reporter] WRITE CALLBACK error:', err.message);
|
|
336
342
|
// Put traces back in buffer on failure
|
|
337
343
|
this.buffer.unshift(...traces);
|
|
338
344
|
reject(err);
|
|
339
345
|
} else {
|
|
346
|
+
if (lifecycleDebug) console.log('[LIFECYCLE reporter] WRITE CALLBACK success for', traces.length, 'traces');
|
|
340
347
|
this.emit("flushed", { count: traces.length });
|
|
341
348
|
resolve();
|
|
342
349
|
}
|
|
343
350
|
});
|
|
351
|
+
if (lifecycleDebug) {
|
|
352
|
+
console.log('[LIFECYCLE reporter] socket.write() returned:', writeResult, '(true=flushed to kernel, false=buffered)');
|
|
353
|
+
}
|
|
344
354
|
});
|
|
345
355
|
}
|
|
346
356
|
|