@aaac/observability 0.1.7 → 0.1.9
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.
|
@@ -1431,6 +1431,7 @@ function emitHumanInstruction(collector, options) {
|
|
|
1431
1431
|
parentSpanId: options.parentSpanId,
|
|
1432
1432
|
attributes: {
|
|
1433
1433
|
axis: "agent",
|
|
1434
|
+
session_id: options.sessionId,
|
|
1434
1435
|
"agent.session_id": options.sessionId,
|
|
1435
1436
|
"human.prompt_length": options.prompt.length,
|
|
1436
1437
|
"human.prompt_head": options.prompt.slice(0, 200),
|
|
@@ -1461,6 +1462,7 @@ function emitQualityGateResult(collector, options) {
|
|
|
1461
1462
|
parentSpanId: options.parentSpanId,
|
|
1462
1463
|
attributes: {
|
|
1463
1464
|
axis: "process",
|
|
1465
|
+
session_id: options.sessionId,
|
|
1464
1466
|
"agent.session_id": options.sessionId,
|
|
1465
1467
|
"gate.type": match.gateType,
|
|
1466
1468
|
"gate.command": options.command,
|
|
@@ -1492,6 +1494,7 @@ function emitPromotionPr(collector, options) {
|
|
|
1492
1494
|
parentSpanId: options.parentSpanId,
|
|
1493
1495
|
attributes: {
|
|
1494
1496
|
axis: "promotion",
|
|
1497
|
+
session_id: options.sessionId,
|
|
1495
1498
|
"agent.session_id": options.sessionId,
|
|
1496
1499
|
"pr.url": pr.url,
|
|
1497
1500
|
"pr.number": pr.number,
|
|
@@ -1516,23 +1519,47 @@ function createPipeline(options = {}) {
|
|
|
1516
1519
|
const otelEmitter = new OtelEmitter(otel ?? {});
|
|
1517
1520
|
const rules = enrichRules ?? createDefaultRules(artifactPatterns);
|
|
1518
1521
|
const enricher = new Enricher({ correlator, artifactPatterns }, rules);
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
}
|
|
1522
|
+
const otelBuffer = /* @__PURE__ */ new Map();
|
|
1523
|
+
function bufferForOtel(event) {
|
|
1524
|
+
const existing = otelBuffer.get(event.spanId);
|
|
1525
|
+
if (existing !== void 0) {
|
|
1526
|
+
existing.push(event);
|
|
1527
|
+
} else {
|
|
1528
|
+
otelBuffer.set(event.spanId, [event]);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
function emitBufferedSpan(spanId) {
|
|
1532
|
+
const events = otelBuffer.get(spanId);
|
|
1533
|
+
if (events === void 0 || events.length === 0) return;
|
|
1534
|
+
otelBuffer.delete(spanId);
|
|
1535
|
+
const mapped = mapEventsToSpan(events);
|
|
1536
|
+
if (mapped !== void 0) {
|
|
1537
|
+
otelEmitter.emit(mapped);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
function routeToOtel(event) {
|
|
1541
|
+
switch (event.lifecycle) {
|
|
1542
|
+
case "instant": {
|
|
1543
|
+
const mapped = mapEventsToSpan([event]);
|
|
1544
|
+
if (mapped !== void 0) {
|
|
1545
|
+
otelEmitter.emit(mapped);
|
|
1546
|
+
}
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
case "close":
|
|
1550
|
+
bufferForOtel(event);
|
|
1551
|
+
emitBufferedSpan(event.spanId);
|
|
1552
|
+
break;
|
|
1553
|
+
case "open":
|
|
1554
|
+
case "event":
|
|
1555
|
+
bufferForOtel(event);
|
|
1556
|
+
break;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
function flushPendingSpans() {
|
|
1560
|
+
for (const spanId of [...otelBuffer.keys()]) {
|
|
1561
|
+
emitBufferedSpan(spanId);
|
|
1562
|
+
}
|
|
1536
1563
|
}
|
|
1537
1564
|
const collector = new EventCollector((raw) => {
|
|
1538
1565
|
const canonical = normalizer.normalize(raw);
|
|
@@ -1541,12 +1568,14 @@ function createPipeline(options = {}) {
|
|
|
1541
1568
|
correlated = afterCorrelate(correlated);
|
|
1542
1569
|
}
|
|
1543
1570
|
const { enriched, derived } = enricher.enrich(correlated);
|
|
1544
|
-
|
|
1571
|
+
sink.write(enriched);
|
|
1572
|
+
routeToOtel(enriched);
|
|
1545
1573
|
for (const d of derived) {
|
|
1546
|
-
|
|
1574
|
+
sink.write(d);
|
|
1575
|
+
routeToOtel(d);
|
|
1547
1576
|
}
|
|
1548
1577
|
});
|
|
1549
|
-
return { collector, correlator, sink, otelEmitter, enricher };
|
|
1578
|
+
return { collector, correlator, sink, otelEmitter, enricher, flushPendingSpans };
|
|
1550
1579
|
}
|
|
1551
1580
|
|
|
1552
1581
|
export {
|
|
@@ -1592,4 +1621,4 @@ export {
|
|
|
1592
1621
|
emitPromotionPr,
|
|
1593
1622
|
createPipeline
|
|
1594
1623
|
};
|
|
1595
|
-
//# sourceMappingURL=chunk-
|
|
1624
|
+
//# sourceMappingURL=chunk-GRL7RHMS.js.map
|