@nebulaos/client 0.1.4 → 0.1.6
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.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1345,6 +1345,7 @@ function setupOTelTracing(config) {
|
|
|
1345
1345
|
// src/tracing/otel-provider.ts
|
|
1346
1346
|
var import_api = require("@opentelemetry/api");
|
|
1347
1347
|
var import_core2 = require("@nebulaos/core");
|
|
1348
|
+
var import_types = require("@nebulaos/types");
|
|
1348
1349
|
var OTelTracingProvider = class {
|
|
1349
1350
|
constructor(serviceName, exporter) {
|
|
1350
1351
|
this.exporter = exporter;
|
|
@@ -1380,8 +1381,8 @@ var OTelTracingProvider = class {
|
|
|
1380
1381
|
attributes: {
|
|
1381
1382
|
"nebula.span.kind": input.kind,
|
|
1382
1383
|
"nebula.span.name": input.name,
|
|
1383
|
-
...input.correlationId ? {
|
|
1384
|
-
...input.executionId ? {
|
|
1384
|
+
...input.correlationId ? { [import_types.SystemAttr.correlationId]: input.correlationId } : {},
|
|
1385
|
+
...input.executionId ? { [import_types.SystemAttr.executionId]: input.executionId } : {}
|
|
1385
1386
|
}
|
|
1386
1387
|
},
|
|
1387
1388
|
parentCtx
|
|
@@ -1436,8 +1437,8 @@ var OTelTracingProvider = class {
|
|
|
1436
1437
|
attributes: {
|
|
1437
1438
|
"nebula.span.kind": input.kind,
|
|
1438
1439
|
"nebula.span.name": input.name,
|
|
1439
|
-
...input.correlationId ? {
|
|
1440
|
-
...input.executionId ? {
|
|
1440
|
+
...input.correlationId ? { [import_types.SystemAttr.correlationId]: input.correlationId } : {},
|
|
1441
|
+
...input.executionId ? { [import_types.SystemAttr.executionId]: input.executionId } : {}
|
|
1441
1442
|
}
|
|
1442
1443
|
},
|
|
1443
1444
|
parentCtx
|
|
@@ -1512,6 +1513,7 @@ var OTelActiveSpan = class extends import_core2.ActiveSpan {
|
|
|
1512
1513
|
|
|
1513
1514
|
// src/http/instrumented-http-client.ts
|
|
1514
1515
|
var import_core3 = require("@nebulaos/core");
|
|
1516
|
+
var import_types2 = require("@nebulaos/types");
|
|
1515
1517
|
var InstrumentedHttpClient = class {
|
|
1516
1518
|
async fetch(url, options) {
|
|
1517
1519
|
const method = options?.method || "GET";
|
|
@@ -1521,8 +1523,8 @@ var InstrumentedHttpClient = class {
|
|
|
1521
1523
|
kind: "http",
|
|
1522
1524
|
name: spanName,
|
|
1523
1525
|
data: {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
+
[import_types2.HTTPAttr.method]: method,
|
|
1527
|
+
[import_types2.HTTPAttr.url]: url
|
|
1526
1528
|
}
|
|
1527
1529
|
},
|
|
1528
1530
|
async (span) => {
|
|
@@ -1539,9 +1541,9 @@ var InstrumentedHttpClient = class {
|
|
|
1539
1541
|
await span.end({
|
|
1540
1542
|
status: response.ok ? "success" : "error",
|
|
1541
1543
|
data: {
|
|
1542
|
-
|
|
1544
|
+
[import_types2.HTTPAttr.statusCode]: response.status,
|
|
1543
1545
|
"http.response_content_length": response.headers.get("content-length"),
|
|
1544
|
-
|
|
1546
|
+
[import_types2.HTTPAttr.durationMs]: Date.now() - startTime
|
|
1545
1547
|
}
|
|
1546
1548
|
});
|
|
1547
1549
|
return {
|
|
@@ -1555,7 +1557,7 @@ var InstrumentedHttpClient = class {
|
|
|
1555
1557
|
status: "error",
|
|
1556
1558
|
data: {
|
|
1557
1559
|
"http.error": error instanceof Error ? error.message : String(error),
|
|
1558
|
-
|
|
1560
|
+
[import_types2.HTTPAttr.durationMs]: Date.now() - startTime
|
|
1559
1561
|
}
|
|
1560
1562
|
});
|
|
1561
1563
|
throw error;
|