@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.mjs
CHANGED
|
@@ -1293,6 +1293,7 @@ import { context, trace, SpanStatusCode } from "@opentelemetry/api";
|
|
|
1293
1293
|
import {
|
|
1294
1294
|
ActiveSpan
|
|
1295
1295
|
} from "@nebulaos/core";
|
|
1296
|
+
import { SystemAttr } from "@nebulaos/types";
|
|
1296
1297
|
var OTelTracingProvider = class {
|
|
1297
1298
|
constructor(serviceName, exporter) {
|
|
1298
1299
|
this.exporter = exporter;
|
|
@@ -1328,8 +1329,8 @@ var OTelTracingProvider = class {
|
|
|
1328
1329
|
attributes: {
|
|
1329
1330
|
"nebula.span.kind": input.kind,
|
|
1330
1331
|
"nebula.span.name": input.name,
|
|
1331
|
-
...input.correlationId ? {
|
|
1332
|
-
...input.executionId ? {
|
|
1332
|
+
...input.correlationId ? { [SystemAttr.correlationId]: input.correlationId } : {},
|
|
1333
|
+
...input.executionId ? { [SystemAttr.executionId]: input.executionId } : {}
|
|
1333
1334
|
}
|
|
1334
1335
|
},
|
|
1335
1336
|
parentCtx
|
|
@@ -1384,8 +1385,8 @@ var OTelTracingProvider = class {
|
|
|
1384
1385
|
attributes: {
|
|
1385
1386
|
"nebula.span.kind": input.kind,
|
|
1386
1387
|
"nebula.span.name": input.name,
|
|
1387
|
-
...input.correlationId ? {
|
|
1388
|
-
...input.executionId ? {
|
|
1388
|
+
...input.correlationId ? { [SystemAttr.correlationId]: input.correlationId } : {},
|
|
1389
|
+
...input.executionId ? { [SystemAttr.executionId]: input.executionId } : {}
|
|
1389
1390
|
}
|
|
1390
1391
|
},
|
|
1391
1392
|
parentCtx
|
|
@@ -1460,6 +1461,7 @@ var OTelActiveSpan = class extends ActiveSpan {
|
|
|
1460
1461
|
|
|
1461
1462
|
// src/http/instrumented-http-client.ts
|
|
1462
1463
|
import { Tracing as Tracing2 } from "@nebulaos/core";
|
|
1464
|
+
import { HTTPAttr } from "@nebulaos/types";
|
|
1463
1465
|
var InstrumentedHttpClient = class {
|
|
1464
1466
|
async fetch(url, options) {
|
|
1465
1467
|
const method = options?.method || "GET";
|
|
@@ -1469,8 +1471,8 @@ var InstrumentedHttpClient = class {
|
|
|
1469
1471
|
kind: "http",
|
|
1470
1472
|
name: spanName,
|
|
1471
1473
|
data: {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
+
[HTTPAttr.method]: method,
|
|
1475
|
+
[HTTPAttr.url]: url
|
|
1474
1476
|
}
|
|
1475
1477
|
},
|
|
1476
1478
|
async (span) => {
|
|
@@ -1487,9 +1489,9 @@ var InstrumentedHttpClient = class {
|
|
|
1487
1489
|
await span.end({
|
|
1488
1490
|
status: response.ok ? "success" : "error",
|
|
1489
1491
|
data: {
|
|
1490
|
-
|
|
1492
|
+
[HTTPAttr.statusCode]: response.status,
|
|
1491
1493
|
"http.response_content_length": response.headers.get("content-length"),
|
|
1492
|
-
|
|
1494
|
+
[HTTPAttr.durationMs]: Date.now() - startTime
|
|
1493
1495
|
}
|
|
1494
1496
|
});
|
|
1495
1497
|
return {
|
|
@@ -1503,7 +1505,7 @@ var InstrumentedHttpClient = class {
|
|
|
1503
1505
|
status: "error",
|
|
1504
1506
|
data: {
|
|
1505
1507
|
"http.error": error instanceof Error ? error.message : String(error),
|
|
1506
|
-
|
|
1508
|
+
[HTTPAttr.durationMs]: Date.now() - startTime
|
|
1507
1509
|
}
|
|
1508
1510
|
});
|
|
1509
1511
|
throw error;
|