autotel-devtools 5.1.0 → 6.0.0
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/README.md +2 -2
- package/dist/cli.cjs +41 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +41 -7
- package/dist/cli.js.map +1 -1
- package/dist/{error-aggregator-BkO0l8ak.d.ts → error-aggregator-CAk_pt3Z.d.ts} +1 -1
- package/dist/{error-aggregator-CtZmjm-k.d.cts → error-aggregator-CbLiuot4.d.cts} +1 -1
- package/dist/{exporter-qIQPDw29.d.cts → exporter-DjLkU621.d.cts} +17 -0
- package/dist/{exporter-qIQPDw29.d.ts → exporter-DjLkU621.d.ts} +17 -0
- package/dist/genai/index.d.cts +9 -0
- package/dist/genai/index.d.ts +9 -0
- package/dist/index.cjs +32 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/dist/server/exporter.cjs +12 -1
- package/dist/server/exporter.cjs.map +1 -1
- package/dist/server/exporter.d.cts +1 -1
- package/dist/server/exporter.d.ts +1 -1
- package/dist/server/exporter.js +12 -1
- package/dist/server/exporter.js.map +1 -1
- package/dist/server/index.cjs +32 -3
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +32 -3
- package/dist/server/index.js.map +1 -1
- package/dist/widget.global.js +13 -2
- package/package.json +12 -14
- package/skills/autotel-devtools/SKILL.md +1 -1
package/dist/server/index.js
CHANGED
|
@@ -368,10 +368,12 @@ var DevtoolsServer = class {
|
|
|
368
368
|
limits;
|
|
369
369
|
verbose;
|
|
370
370
|
_port;
|
|
371
|
+
onData;
|
|
371
372
|
constructor(options = {}) {
|
|
372
373
|
this.limits = resolveTelemetryLimits(options);
|
|
373
374
|
this.verbose = options.verbose ?? false;
|
|
374
375
|
this._port = options.port ?? 4318;
|
|
376
|
+
this.onData = options.onData;
|
|
375
377
|
this.httpServer = options.server ?? createServer();
|
|
376
378
|
this.wss = new WebSocketServer({ server: this.httpServer, path: options.path ?? "/ws" });
|
|
377
379
|
this.wss.on("connection", (ws) => {
|
|
@@ -465,6 +467,12 @@ var DevtoolsServer = class {
|
|
|
465
467
|
client.send(msg);
|
|
466
468
|
}
|
|
467
469
|
}
|
|
470
|
+
if (this.onData) {
|
|
471
|
+
try {
|
|
472
|
+
this.onData(data);
|
|
473
|
+
} catch {
|
|
474
|
+
}
|
|
475
|
+
}
|
|
468
476
|
}
|
|
469
477
|
log(message) {
|
|
470
478
|
if (this.verbose) console.log(`[autotel-devtools] ${message}`);
|
|
@@ -582,6 +590,11 @@ var DevtoolsSpanExporter = class {
|
|
|
582
590
|
timestamp: event.time[0] * 1e3 + event.time[1] / 1e6,
|
|
583
591
|
attributes: event.attributes ? Object.fromEntries(Object.entries(event.attributes)) : void 0
|
|
584
592
|
}));
|
|
593
|
+
const links = span.links.map((link) => ({
|
|
594
|
+
traceId: link.context.traceId,
|
|
595
|
+
spanId: link.context.spanId,
|
|
596
|
+
attributes: link.attributes ? Object.fromEntries(Object.entries(link.attributes)) : void 0
|
|
597
|
+
}));
|
|
585
598
|
return {
|
|
586
599
|
traceId: spanContext.traceId,
|
|
587
600
|
spanId: spanContext.spanId,
|
|
@@ -596,9 +609,15 @@ var DevtoolsSpanExporter = class {
|
|
|
596
609
|
code: status,
|
|
597
610
|
message: span.status.message
|
|
598
611
|
},
|
|
599
|
-
events: events.length > 0 ? events : void 0
|
|
612
|
+
events: events.length > 0 ? events : void 0,
|
|
613
|
+
links: links.length > 0 ? links : void 0,
|
|
614
|
+
scope: this.convertScope(span)
|
|
600
615
|
};
|
|
601
616
|
}
|
|
617
|
+
convertScope(span) {
|
|
618
|
+
const s = span.instrumentationScope ?? span.instrumentationLibrary;
|
|
619
|
+
return s?.name ? { name: s.name, version: s.version || void 0 } : void 0;
|
|
620
|
+
}
|
|
602
621
|
/**
|
|
603
622
|
* Convert OpenTelemetry SpanKind to string
|
|
604
623
|
*/
|
|
@@ -967,7 +986,10 @@ function flattenAttributes(attrs) {
|
|
|
967
986
|
}
|
|
968
987
|
function nanoToMs(nano) {
|
|
969
988
|
if (!nano) return 0;
|
|
970
|
-
|
|
989
|
+
const ns = BigInt(nano);
|
|
990
|
+
const ms = ns / 1000000n;
|
|
991
|
+
const remNs = ns % 1000000n;
|
|
992
|
+
return Number(ms) + Number(remNs) / 1e6;
|
|
971
993
|
}
|
|
972
994
|
var SPAN_KIND_MAP = {
|
|
973
995
|
0: "INTERNAL",
|
|
@@ -1005,6 +1027,7 @@ function parseOtlpTraces(payload) {
|
|
|
1005
1027
|
const service = String(resourceAttrs["service.name"] || "unknown");
|
|
1006
1028
|
const scopeSpans = rs.scopeSpans || [];
|
|
1007
1029
|
for (const ss of scopeSpans) {
|
|
1030
|
+
const scope = ss.scope?.name ? { name: ss.scope.name, version: ss.scope.version || void 0 } : void 0;
|
|
1008
1031
|
for (const span of ss.spans || []) {
|
|
1009
1032
|
const traceId = normalizeHexId(span.traceId);
|
|
1010
1033
|
if (!traceId) continue;
|
|
@@ -1029,7 +1052,13 @@ function parseOtlpTraces(payload) {
|
|
|
1029
1052
|
name: e.name || "",
|
|
1030
1053
|
timestamp: nanoToMs(e.timeUnixNano),
|
|
1031
1054
|
attributes: flattenAttributes(e.attributes)
|
|
1032
|
-
}))
|
|
1055
|
+
})),
|
|
1056
|
+
links: (span.links || []).map((l) => ({
|
|
1057
|
+
traceId: normalizeHexId(l.traceId),
|
|
1058
|
+
spanId: normalizeHexId(l.spanId),
|
|
1059
|
+
attributes: flattenAttributes(l.attributes)
|
|
1060
|
+
})),
|
|
1061
|
+
scope
|
|
1033
1062
|
};
|
|
1034
1063
|
const existing = traceMap.get(traceId);
|
|
1035
1064
|
if (existing) {
|