observa-sdk 0.0.4 → 0.0.5
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/dist/index.cjs +17 -6
- package/dist/index.js +17 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -420,7 +420,9 @@ var Observa = class {
|
|
|
420
420
|
systemFingerprint: extracted.systemFingerprint ?? null,
|
|
421
421
|
...headers !== void 0 && { headers }
|
|
422
422
|
};
|
|
423
|
-
console.log(
|
|
423
|
+
console.log(
|
|
424
|
+
`[Observa] Trace data prepared, calling sendTrace for ${traceId}, response length: ${fullResponse.length}`
|
|
425
|
+
);
|
|
424
426
|
await this.sendTrace(traceData);
|
|
425
427
|
console.log(`[Observa] sendTrace completed for ${traceId}`);
|
|
426
428
|
} catch (err) {
|
|
@@ -439,8 +441,11 @@ var Observa = class {
|
|
|
439
441
|
formatBeautifulLog(trace);
|
|
440
442
|
}
|
|
441
443
|
try {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
+
const baseUrl = this.apiUrl.replace(/\/+$/, "");
|
|
445
|
+
const url = `${baseUrl}/api/v1/traces/ingest`;
|
|
446
|
+
console.log(
|
|
447
|
+
`[Observa] Sending trace - URL: ${url}, TraceID: ${trace.traceId}, Tenant: ${trace.tenantId}, Project: ${trace.projectId}, APIKey: ${this.apiKey ? `Yes(${this.apiKey.length} chars)` : "No"}`
|
|
448
|
+
);
|
|
444
449
|
const controller = new AbortController();
|
|
445
450
|
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
446
451
|
try {
|
|
@@ -454,7 +459,9 @@ var Observa = class {
|
|
|
454
459
|
signal: controller.signal
|
|
455
460
|
});
|
|
456
461
|
clearTimeout(timeoutId);
|
|
457
|
-
console.log(
|
|
462
|
+
console.log(
|
|
463
|
+
`[Observa] Response status: ${response.status} ${response.statusText}`
|
|
464
|
+
);
|
|
458
465
|
if (!response.ok) {
|
|
459
466
|
const errorText = await response.text().catch(() => "Unknown error");
|
|
460
467
|
let errorJson;
|
|
@@ -468,7 +475,9 @@ var Observa = class {
|
|
|
468
475
|
errorJson.error || errorText
|
|
469
476
|
);
|
|
470
477
|
} else {
|
|
471
|
-
console.log(
|
|
478
|
+
console.log(
|
|
479
|
+
`\u2705 [Observa] Trace sent successfully - Trace ID: ${trace.traceId}`
|
|
480
|
+
);
|
|
472
481
|
}
|
|
473
482
|
} catch (fetchError) {
|
|
474
483
|
clearTimeout(timeoutId);
|
|
@@ -483,7 +492,9 @@ var Observa = class {
|
|
|
483
492
|
console.error("[Observa] Error message:", error.message);
|
|
484
493
|
console.error("[Observa] Error name:", error.name);
|
|
485
494
|
if (error.name === "AbortError") {
|
|
486
|
-
console.error(
|
|
495
|
+
console.error(
|
|
496
|
+
"[Observa] Request timed out - check network connectivity and API URL"
|
|
497
|
+
);
|
|
487
498
|
}
|
|
488
499
|
if (error.stack) {
|
|
489
500
|
console.error("[Observa] Error stack:", error.stack);
|
package/dist/index.js
CHANGED
|
@@ -395,7 +395,9 @@ var Observa = class {
|
|
|
395
395
|
systemFingerprint: extracted.systemFingerprint ?? null,
|
|
396
396
|
...headers !== void 0 && { headers }
|
|
397
397
|
};
|
|
398
|
-
console.log(
|
|
398
|
+
console.log(
|
|
399
|
+
`[Observa] Trace data prepared, calling sendTrace for ${traceId}, response length: ${fullResponse.length}`
|
|
400
|
+
);
|
|
399
401
|
await this.sendTrace(traceData);
|
|
400
402
|
console.log(`[Observa] sendTrace completed for ${traceId}`);
|
|
401
403
|
} catch (err) {
|
|
@@ -414,8 +416,11 @@ var Observa = class {
|
|
|
414
416
|
formatBeautifulLog(trace);
|
|
415
417
|
}
|
|
416
418
|
try {
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
+
const baseUrl = this.apiUrl.replace(/\/+$/, "");
|
|
420
|
+
const url = `${baseUrl}/api/v1/traces/ingest`;
|
|
421
|
+
console.log(
|
|
422
|
+
`[Observa] Sending trace - URL: ${url}, TraceID: ${trace.traceId}, Tenant: ${trace.tenantId}, Project: ${trace.projectId}, APIKey: ${this.apiKey ? `Yes(${this.apiKey.length} chars)` : "No"}`
|
|
423
|
+
);
|
|
419
424
|
const controller = new AbortController();
|
|
420
425
|
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
421
426
|
try {
|
|
@@ -429,7 +434,9 @@ var Observa = class {
|
|
|
429
434
|
signal: controller.signal
|
|
430
435
|
});
|
|
431
436
|
clearTimeout(timeoutId);
|
|
432
|
-
console.log(
|
|
437
|
+
console.log(
|
|
438
|
+
`[Observa] Response status: ${response.status} ${response.statusText}`
|
|
439
|
+
);
|
|
433
440
|
if (!response.ok) {
|
|
434
441
|
const errorText = await response.text().catch(() => "Unknown error");
|
|
435
442
|
let errorJson;
|
|
@@ -443,7 +450,9 @@ var Observa = class {
|
|
|
443
450
|
errorJson.error || errorText
|
|
444
451
|
);
|
|
445
452
|
} else {
|
|
446
|
-
console.log(
|
|
453
|
+
console.log(
|
|
454
|
+
`\u2705 [Observa] Trace sent successfully - Trace ID: ${trace.traceId}`
|
|
455
|
+
);
|
|
447
456
|
}
|
|
448
457
|
} catch (fetchError) {
|
|
449
458
|
clearTimeout(timeoutId);
|
|
@@ -458,7 +467,9 @@ var Observa = class {
|
|
|
458
467
|
console.error("[Observa] Error message:", error.message);
|
|
459
468
|
console.error("[Observa] Error name:", error.name);
|
|
460
469
|
if (error.name === "AbortError") {
|
|
461
|
-
console.error(
|
|
470
|
+
console.error(
|
|
471
|
+
"[Observa] Request timed out - check network connectivity and API URL"
|
|
472
|
+
);
|
|
462
473
|
}
|
|
463
474
|
if (error.stack) {
|
|
464
475
|
console.error("[Observa] Error stack:", error.stack);
|
package/package.json
CHANGED