agent-inspect 6.31.12 → 6.31.13
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-GBAGZVUX.mjs → chunk-ZAYVAHIH.mjs} +82 -13
- package/packages/cli/dist/chunk-ZAYVAHIH.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +286 -44
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +209 -36
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-F44EQY4S.mjs → src-KP4UIFK5.mjs} +3 -3
- package/packages/cli/dist/{src-F44EQY4S.mjs.map → src-KP4UIFK5.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +80 -11
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +27 -7
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/{chunk-OAUNS5CS.mjs → chunk-JE3TUFAQ.mjs} +3 -3
- package/packages/core/dist/{chunk-OAUNS5CS.mjs.map → chunk-JE3TUFAQ.mjs.map} +1 -1
- package/packages/core/dist/{chunk-QOC3PJO3.mjs → chunk-NJUSSJX3.mjs} +3 -3
- package/packages/core/dist/{chunk-QOC3PJO3.mjs.map → chunk-NJUSSJX3.mjs.map} +1 -1
- package/packages/core/dist/{chunk-AK5EN4U2.mjs → chunk-YU6XT5A2.mjs} +58 -9
- package/packages/core/dist/chunk-YU6XT5A2.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +205 -32
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +205 -32
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/logs.cjs +56 -7
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.mjs +2 -2
- package/packages/core/dist/persisted.cjs +56 -7
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +3 -3
- package/packages/core/dist/readers.cjs +56 -7
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/cli/dist/chunk-GBAGZVUX.mjs.map +0 -1
- package/packages/core/dist/chunk-AK5EN4U2.mjs.map +0 -1
|
@@ -3411,12 +3411,14 @@ function topKinds(run) {
|
|
|
3411
3411
|
function countErrorNodes(nodes) {
|
|
3412
3412
|
return nodes.filter((entry) => entry.node.event.status === "error").length;
|
|
3413
3413
|
}
|
|
3414
|
+
function isExecutionStepKind(kind) {
|
|
3415
|
+
return kind !== "RUN" && kind !== "OUTCOME";
|
|
3416
|
+
}
|
|
3414
3417
|
function slowestNode(nodes) {
|
|
3415
3418
|
return nodes.filter(
|
|
3416
3419
|
(entry) => entry.node.event.durationMs !== void 0 && // The RUN boundary spans the whole run, so its duration always dominates
|
|
3417
|
-
// and shadows every real step.
|
|
3418
|
-
|
|
3419
|
-
entry.node.event.kind !== "RUN"
|
|
3420
|
+
// and shadows every real step. OUTCOME is a linked result, not execution.
|
|
3421
|
+
isExecutionStepKind(entry.node.event.kind)
|
|
3420
3422
|
).sort((a, b) => {
|
|
3421
3423
|
const delta = (b.node.event.durationMs ?? 0) - (a.node.event.durationMs ?? 0);
|
|
3422
3424
|
return delta !== 0 ? delta : a.index - b.index;
|
|
@@ -3469,6 +3471,12 @@ function buildFacts(run, redactor, events) {
|
|
|
3469
3471
|
const scoped = events.filter((event) => event.runId === run.runId);
|
|
3470
3472
|
const { logicalEvents: logical } = projectLogicalEvents(scoped);
|
|
3471
3473
|
const logicalSteps = logical.filter((event) => event.kind !== "RUN");
|
|
3474
|
+
const executionSteps = logical.filter((event) => isExecutionStepKind(event.kind));
|
|
3475
|
+
const executionByKind = {
|
|
3476
|
+
LLM: executionSteps.filter((event) => event.kind === "LLM").length,
|
|
3477
|
+
TOOL: executionSteps.filter((event) => event.kind === "TOOL").length,
|
|
3478
|
+
LOGIC: executionSteps.filter((event) => event.kind === "LOGIC").length
|
|
3479
|
+
};
|
|
3472
3480
|
facts.push(
|
|
3473
3481
|
fact("run.rawEventCount", "Raw persisted event count", scoped.length, redactor),
|
|
3474
3482
|
fact(
|
|
@@ -3482,9 +3490,21 @@ function buildFacts(run, redactor, events) {
|
|
|
3482
3490
|
"Logical lifecycle event count (including RUN)",
|
|
3483
3491
|
logical.length,
|
|
3484
3492
|
redactor
|
|
3493
|
+
),
|
|
3494
|
+
fact(
|
|
3495
|
+
"run.executionStepCount",
|
|
3496
|
+
"Execution step count (excludes RUN and OUTCOME)",
|
|
3497
|
+
executionSteps.length,
|
|
3498
|
+
redactor
|
|
3499
|
+
),
|
|
3500
|
+
fact(
|
|
3501
|
+
"run.executionStepKinds",
|
|
3502
|
+
"Execution step kind counts",
|
|
3503
|
+
executionByKind,
|
|
3504
|
+
redactor
|
|
3485
3505
|
)
|
|
3486
3506
|
);
|
|
3487
|
-
const slowestLogical = [...
|
|
3507
|
+
const slowestLogical = [...executionSteps].filter((event) => typeof event.durationMs === "number").sort((a, b) => {
|
|
3488
3508
|
const delta = (b.durationMs ?? 0) - (a.durationMs ?? 0);
|
|
3489
3509
|
return delta !== 0 ? delta : a.eventId.localeCompare(b.eventId);
|
|
3490
3510
|
})[0];
|
|
@@ -12739,6 +12759,57 @@ function linkNodesVisibilityFirst(nodes) {
|
|
|
12739
12759
|
}
|
|
12740
12760
|
};
|
|
12741
12761
|
}
|
|
12762
|
+
function resolveRunTiming(sorted, status) {
|
|
12763
|
+
let startedAtMs;
|
|
12764
|
+
let endedAtMs;
|
|
12765
|
+
let explicitDurationMs;
|
|
12766
|
+
for (const event of sorted) {
|
|
12767
|
+
if (event.kind !== "RUN") continue;
|
|
12768
|
+
const attrs = event.attributes ?? {};
|
|
12769
|
+
if (typeof attrs.startedAtMs === "number" && Number.isFinite(attrs.startedAtMs)) {
|
|
12770
|
+
startedAtMs = startedAtMs === void 0 ? attrs.startedAtMs : Math.min(startedAtMs, attrs.startedAtMs);
|
|
12771
|
+
}
|
|
12772
|
+
if (typeof attrs.endedAtMs === "number" && Number.isFinite(attrs.endedAtMs)) {
|
|
12773
|
+
endedAtMs = endedAtMs === void 0 ? attrs.endedAtMs : Math.max(endedAtMs, attrs.endedAtMs);
|
|
12774
|
+
}
|
|
12775
|
+
if ((event.status === "ok" || event.status === "error") && typeof event.durationMs === "number" && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
|
|
12776
|
+
explicitDurationMs = event.durationMs;
|
|
12777
|
+
if (endedAtMs === void 0 && startedAtMs !== void 0) {
|
|
12778
|
+
endedAtMs = startedAtMs + event.durationMs;
|
|
12779
|
+
} else if (endedAtMs === void 0 && Number.isFinite(event.timestamp)) {
|
|
12780
|
+
endedAtMs = event.timestamp + event.durationMs;
|
|
12781
|
+
if (startedAtMs === void 0) {
|
|
12782
|
+
startedAtMs = event.timestamp;
|
|
12783
|
+
}
|
|
12784
|
+
}
|
|
12785
|
+
}
|
|
12786
|
+
if (startedAtMs === void 0 && event.status === "running" && Number.isFinite(event.timestamp)) {
|
|
12787
|
+
startedAtMs = event.timestamp;
|
|
12788
|
+
}
|
|
12789
|
+
}
|
|
12790
|
+
if (startedAtMs !== void 0 && endedAtMs !== void 0 && Number.isFinite(startedAtMs) && Number.isFinite(endedAtMs) && endedAtMs >= startedAtMs && status !== "running") {
|
|
12791
|
+
return {
|
|
12792
|
+
startedAt: startedAtMs,
|
|
12793
|
+
endedAt: endedAtMs,
|
|
12794
|
+
durationMs: endedAtMs - startedAtMs
|
|
12795
|
+
};
|
|
12796
|
+
}
|
|
12797
|
+
if (startedAtMs !== void 0 && explicitDurationMs !== void 0 && status !== "running") {
|
|
12798
|
+
return {
|
|
12799
|
+
startedAt: startedAtMs,
|
|
12800
|
+
endedAt: startedAtMs + explicitDurationMs,
|
|
12801
|
+
durationMs: explicitDurationMs
|
|
12802
|
+
};
|
|
12803
|
+
}
|
|
12804
|
+
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
12805
|
+
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
12806
|
+
const durationMs2 = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
12807
|
+
return {
|
|
12808
|
+
startedAt,
|
|
12809
|
+
endedAt: status === "running" ? void 0 : endedAt,
|
|
12810
|
+
durationMs: durationMs2
|
|
12811
|
+
};
|
|
12812
|
+
}
|
|
12742
12813
|
var TreeBuilder;
|
|
12743
12814
|
var init_tree_builder = __esm({
|
|
12744
12815
|
"packages/core/src/logs/tree-builder.ts"() {
|
|
@@ -12771,18 +12842,16 @@ var init_tree_builder = __esm({
|
|
|
12771
12842
|
inc(confidenceBreakdown, e.confidence);
|
|
12772
12843
|
kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
|
|
12773
12844
|
}
|
|
12774
|
-
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
12775
|
-
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
12776
|
-
const status = computeRunStatus(sorted);
|
|
12777
|
-
const durationMs2 = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
12778
12845
|
const name = sorted.find((e) => e.kind === "RUN")?.name;
|
|
12846
|
+
const status = computeRunStatus(sorted);
|
|
12847
|
+
const timing = resolveRunTiming(sorted, status);
|
|
12779
12848
|
out.push({
|
|
12780
12849
|
runId,
|
|
12781
12850
|
name,
|
|
12782
12851
|
status,
|
|
12783
|
-
startedAt,
|
|
12784
|
-
endedAt:
|
|
12785
|
-
durationMs:
|
|
12852
|
+
startedAt: timing.startedAt,
|
|
12853
|
+
endedAt: timing.endedAt,
|
|
12854
|
+
durationMs: timing.durationMs,
|
|
12786
12855
|
children: roots,
|
|
12787
12856
|
metadata: {
|
|
12788
12857
|
totalEvents: sorted.length,
|
|
@@ -16760,7 +16829,7 @@ var init_src = __esm({
|
|
|
16760
16829
|
});
|
|
16761
16830
|
|
|
16762
16831
|
// package.json
|
|
16763
|
-
var version = "6.31.
|
|
16832
|
+
var version = "6.31.13";
|
|
16764
16833
|
|
|
16765
16834
|
// packages/cli/src/list.ts
|
|
16766
16835
|
init_advanced();
|
|
@@ -19554,7 +19623,14 @@ function exportOtlpJson(tree, options) {
|
|
|
19554
19623
|
|
|
19555
19624
|
// packages/core/src/exporters/validation.ts
|
|
19556
19625
|
var EXPERIMENTAL = "Experimental compatibility export \u2014 verify against your target tooling before relying on it.";
|
|
19626
|
+
var UINT64_MAX = 18446744073709551615n;
|
|
19627
|
+
var INT64_MIN = -9223372036854775808n;
|
|
19628
|
+
var INT64_MAX = 9223372036854775807n;
|
|
19629
|
+
var MAX_ANYVALUE_DEPTH = 8;
|
|
19630
|
+
var MAX_ANYVALUE_ELEMENTS = 256;
|
|
19631
|
+
var MAX_DIAGNOSTIC_ERRORS = 64;
|
|
19557
19632
|
function pushPath(errors, path44, message) {
|
|
19633
|
+
if (errors.length >= MAX_DIAGNOSTIC_ERRORS) return;
|
|
19558
19634
|
errors.push(`${path44}: ${message}`);
|
|
19559
19635
|
}
|
|
19560
19636
|
function isRecord16(value) {
|
|
@@ -19563,7 +19639,59 @@ function isRecord16(value) {
|
|
|
19563
19639
|
function isHexId(value, byteLen) {
|
|
19564
19640
|
return typeof value === "string" && new RegExp(`^[0-9a-fA-F]{${byteLen * 2}}$`).test(value);
|
|
19565
19641
|
}
|
|
19566
|
-
function
|
|
19642
|
+
function parseDecimalIntegerString(value) {
|
|
19643
|
+
if (typeof value !== "string" || !/^-?\d+$/.test(value)) {
|
|
19644
|
+
return { ok: false, reason: "must be a decimal integer string" };
|
|
19645
|
+
}
|
|
19646
|
+
try {
|
|
19647
|
+
return { ok: true, n: BigInt(value) };
|
|
19648
|
+
} catch {
|
|
19649
|
+
return { ok: false, reason: "out of integer range" };
|
|
19650
|
+
}
|
|
19651
|
+
}
|
|
19652
|
+
function validateUint64String(errors, path44, value, label) {
|
|
19653
|
+
const parsed = parseDecimalIntegerString(value);
|
|
19654
|
+
if (!parsed.ok) {
|
|
19655
|
+
pushPath(errors, path44, `${label} ${parsed.reason}`);
|
|
19656
|
+
return;
|
|
19657
|
+
}
|
|
19658
|
+
if (parsed.n < 0n || parsed.n > UINT64_MAX) {
|
|
19659
|
+
pushPath(
|
|
19660
|
+
errors,
|
|
19661
|
+
path44,
|
|
19662
|
+
`${label} must be an unsigned 64-bit integer (0..${UINT64_MAX.toString()})`
|
|
19663
|
+
);
|
|
19664
|
+
}
|
|
19665
|
+
}
|
|
19666
|
+
function validateInt64String(errors, path44, value) {
|
|
19667
|
+
const parsed = parseDecimalIntegerString(value);
|
|
19668
|
+
if (!parsed.ok) {
|
|
19669
|
+
pushPath(errors, path44, parsed.reason);
|
|
19670
|
+
return;
|
|
19671
|
+
}
|
|
19672
|
+
if (parsed.n < INT64_MIN || parsed.n > INT64_MAX) {
|
|
19673
|
+
pushPath(
|
|
19674
|
+
errors,
|
|
19675
|
+
path44,
|
|
19676
|
+
`must be a signed 64-bit integer (${INT64_MIN.toString()}..${INT64_MAX.toString()})`
|
|
19677
|
+
);
|
|
19678
|
+
}
|
|
19679
|
+
}
|
|
19680
|
+
function validateAnyValue(errors, path44, value, depth = 0, counters = { elements: 0 }) {
|
|
19681
|
+
if (errors.length >= MAX_DIAGNOSTIC_ERRORS) return;
|
|
19682
|
+
if (depth > MAX_ANYVALUE_DEPTH) {
|
|
19683
|
+
pushPath(errors, path44, `AnyValue nesting exceeds depth ${MAX_ANYVALUE_DEPTH}`);
|
|
19684
|
+
return;
|
|
19685
|
+
}
|
|
19686
|
+
counters.elements += 1;
|
|
19687
|
+
if (counters.elements > MAX_ANYVALUE_ELEMENTS) {
|
|
19688
|
+
pushPath(
|
|
19689
|
+
errors,
|
|
19690
|
+
path44,
|
|
19691
|
+
`AnyValue element count exceeds ${MAX_ANYVALUE_ELEMENTS}`
|
|
19692
|
+
);
|
|
19693
|
+
return;
|
|
19694
|
+
}
|
|
19567
19695
|
if (!isRecord16(value)) {
|
|
19568
19696
|
pushPath(errors, path44, "must be an AnyValue object");
|
|
19569
19697
|
return;
|
|
@@ -19583,13 +19711,99 @@ function validateAnyValue(errors, path44, value) {
|
|
|
19583
19711
|
path44,
|
|
19584
19712
|
`AnyValue must set exactly one variant (found ${variants.length}: ${variants.join(",")})`
|
|
19585
19713
|
);
|
|
19714
|
+
return;
|
|
19586
19715
|
}
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19716
|
+
const arm = variants[0];
|
|
19717
|
+
switch (arm) {
|
|
19718
|
+
case "stringValue":
|
|
19719
|
+
if (typeof value.stringValue !== "string") {
|
|
19720
|
+
pushPath(errors, `${path44}.stringValue`, "must be a string");
|
|
19721
|
+
}
|
|
19722
|
+
break;
|
|
19723
|
+
case "boolValue":
|
|
19724
|
+
if (typeof value.boolValue !== "boolean") {
|
|
19725
|
+
pushPath(errors, `${path44}.boolValue`, "must be a boolean");
|
|
19726
|
+
}
|
|
19727
|
+
break;
|
|
19728
|
+
case "intValue":
|
|
19729
|
+
validateInt64String(errors, `${path44}.intValue`, value.intValue);
|
|
19730
|
+
break;
|
|
19731
|
+
case "doubleValue":
|
|
19732
|
+
if (typeof value.doubleValue !== "number" || !Number.isFinite(value.doubleValue)) {
|
|
19733
|
+
pushPath(errors, `${path44}.doubleValue`, "must be a finite number");
|
|
19734
|
+
}
|
|
19735
|
+
break;
|
|
19736
|
+
case "bytesValue":
|
|
19737
|
+
if (typeof value.bytesValue !== "string") {
|
|
19738
|
+
pushPath(errors, `${path44}.bytesValue`, "must be a base64 string");
|
|
19739
|
+
}
|
|
19740
|
+
break;
|
|
19741
|
+
case "arrayValue": {
|
|
19742
|
+
if (!isRecord16(value.arrayValue)) {
|
|
19743
|
+
pushPath(errors, `${path44}.arrayValue`, "must be an object");
|
|
19744
|
+
break;
|
|
19745
|
+
}
|
|
19746
|
+
const values = value.arrayValue.values;
|
|
19747
|
+
if (values === void 0) break;
|
|
19748
|
+
if (!Array.isArray(values)) {
|
|
19749
|
+
pushPath(errors, `${path44}.arrayValue.values`, "must be an array");
|
|
19750
|
+
break;
|
|
19751
|
+
}
|
|
19752
|
+
values.forEach((item, i) => {
|
|
19753
|
+
validateAnyValue(
|
|
19754
|
+
errors,
|
|
19755
|
+
`${path44}.arrayValue.values[${i}]`,
|
|
19756
|
+
item,
|
|
19757
|
+
depth + 1,
|
|
19758
|
+
counters
|
|
19759
|
+
);
|
|
19760
|
+
});
|
|
19761
|
+
break;
|
|
19762
|
+
}
|
|
19763
|
+
case "kvlistValue": {
|
|
19764
|
+
if (!isRecord16(value.kvlistValue)) {
|
|
19765
|
+
pushPath(errors, `${path44}.kvlistValue`, "must be an object");
|
|
19766
|
+
break;
|
|
19767
|
+
}
|
|
19768
|
+
const values = value.kvlistValue.values;
|
|
19769
|
+
if (values === void 0) break;
|
|
19770
|
+
if (!Array.isArray(values)) {
|
|
19771
|
+
pushPath(errors, `${path44}.kvlistValue.values`, "must be an array");
|
|
19772
|
+
break;
|
|
19773
|
+
}
|
|
19774
|
+
values.forEach((item, i) => {
|
|
19775
|
+
const itemPath = `${path44}.kvlistValue.values[${i}]`;
|
|
19776
|
+
if (!isRecord16(item)) {
|
|
19777
|
+
pushPath(errors, itemPath, "must be a KeyValue object");
|
|
19778
|
+
return;
|
|
19779
|
+
}
|
|
19780
|
+
if (typeof item.key !== "string") {
|
|
19781
|
+
pushPath(errors, `${itemPath}.key`, "must be a string");
|
|
19782
|
+
}
|
|
19783
|
+
validateAnyValue(errors, `${itemPath}.value`, item.value, depth + 1, counters);
|
|
19784
|
+
});
|
|
19785
|
+
break;
|
|
19590
19786
|
}
|
|
19591
19787
|
}
|
|
19592
19788
|
}
|
|
19789
|
+
function validateKeyValueList(errors, path44, attrs) {
|
|
19790
|
+
if (attrs === void 0) return;
|
|
19791
|
+
if (!Array.isArray(attrs)) {
|
|
19792
|
+
pushPath(errors, path44, "must be an array");
|
|
19793
|
+
return;
|
|
19794
|
+
}
|
|
19795
|
+
attrs.forEach((attr, ai) => {
|
|
19796
|
+
const attrPath = `${path44}[${ai}]`;
|
|
19797
|
+
if (!isRecord16(attr)) {
|
|
19798
|
+
pushPath(errors, attrPath, "must be an object");
|
|
19799
|
+
return;
|
|
19800
|
+
}
|
|
19801
|
+
if (typeof attr.key !== "string") {
|
|
19802
|
+
pushPath(errors, `${attrPath}.key`, "must be a string");
|
|
19803
|
+
}
|
|
19804
|
+
validateAnyValue(errors, `${attrPath}.value`, attr.value);
|
|
19805
|
+
});
|
|
19806
|
+
}
|
|
19593
19807
|
function validateOtlpJson(content) {
|
|
19594
19808
|
const errors = [];
|
|
19595
19809
|
const warnings = [
|
|
@@ -19618,6 +19832,13 @@ function validateOtlpJson(content) {
|
|
|
19618
19832
|
pushPath(errors, rsPath, "must be an object");
|
|
19619
19833
|
return;
|
|
19620
19834
|
}
|
|
19835
|
+
if (isRecord16(resourceSpan.resource)) {
|
|
19836
|
+
validateKeyValueList(
|
|
19837
|
+
errors,
|
|
19838
|
+
`${rsPath}.resource.attributes`,
|
|
19839
|
+
resourceSpan.resource.attributes
|
|
19840
|
+
);
|
|
19841
|
+
}
|
|
19621
19842
|
if (!Array.isArray(resourceSpan.scopeSpans)) {
|
|
19622
19843
|
pushPath(errors, `${rsPath}.scopeSpans`, "must be an array");
|
|
19623
19844
|
return;
|
|
@@ -19628,6 +19849,13 @@ function validateOtlpJson(content) {
|
|
|
19628
19849
|
pushPath(errors, ssPath, "must be an object");
|
|
19629
19850
|
return;
|
|
19630
19851
|
}
|
|
19852
|
+
if (isRecord16(scopeSpan.scope)) {
|
|
19853
|
+
validateKeyValueList(
|
|
19854
|
+
errors,
|
|
19855
|
+
`${ssPath}.scope.attributes`,
|
|
19856
|
+
scopeSpan.scope.attributes
|
|
19857
|
+
);
|
|
19858
|
+
}
|
|
19631
19859
|
if (!Array.isArray(scopeSpan.spans)) {
|
|
19632
19860
|
pushPath(errors, `${ssPath}.spans`, "must be an array");
|
|
19633
19861
|
return;
|
|
@@ -19662,44 +19890,58 @@ function validateOtlpJson(content) {
|
|
|
19662
19890
|
if (typeof span.name !== "string") {
|
|
19663
19891
|
pushPath(errors, `${spanPath}.name`, "must be a string");
|
|
19664
19892
|
}
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
pushPath(
|
|
19893
|
+
validateUint64String(
|
|
19894
|
+
errors,
|
|
19895
|
+
`${spanPath}.startTimeUnixNano`,
|
|
19896
|
+
span.startTimeUnixNano,
|
|
19897
|
+
"startTimeUnixNano"
|
|
19898
|
+
);
|
|
19899
|
+
if (span.endTimeUnixNano !== void 0) {
|
|
19900
|
+
validateUint64String(
|
|
19674
19901
|
errors,
|
|
19675
19902
|
`${spanPath}.endTimeUnixNano`,
|
|
19676
|
-
|
|
19903
|
+
span.endTimeUnixNano,
|
|
19904
|
+
"endTimeUnixNano"
|
|
19677
19905
|
);
|
|
19678
19906
|
}
|
|
19679
|
-
if (typeof span.startTimeUnixNano === "string" &&
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19907
|
+
if (typeof span.startTimeUnixNano === "string" && typeof span.endTimeUnixNano === "string") {
|
|
19908
|
+
const start = parseDecimalIntegerString(span.startTimeUnixNano);
|
|
19909
|
+
const end = parseDecimalIntegerString(span.endTimeUnixNano);
|
|
19910
|
+
if (start.ok && end.ok && end.n < start.n) {
|
|
19911
|
+
pushPath(
|
|
19912
|
+
errors,
|
|
19913
|
+
`${spanPath}.endTimeUnixNano`,
|
|
19914
|
+
"must be >= startTimeUnixNano"
|
|
19915
|
+
);
|
|
19916
|
+
}
|
|
19917
|
+
}
|
|
19918
|
+
validateKeyValueList(errors, `${spanPath}.attributes`, span.attributes);
|
|
19919
|
+
if (Array.isArray(span.events)) {
|
|
19920
|
+
span.events.forEach((event, ei) => {
|
|
19921
|
+
const eventPath = `${spanPath}.events[${ei}]`;
|
|
19922
|
+
if (!isRecord16(event)) {
|
|
19923
|
+
pushPath(errors, eventPath, "must be an object");
|
|
19924
|
+
return;
|
|
19925
|
+
}
|
|
19926
|
+
if (event.timeUnixNano !== void 0) {
|
|
19927
|
+
validateUint64String(
|
|
19683
19928
|
errors,
|
|
19684
|
-
`${
|
|
19685
|
-
|
|
19929
|
+
`${eventPath}.timeUnixNano`,
|
|
19930
|
+
event.timeUnixNano,
|
|
19931
|
+
"timeUnixNano"
|
|
19686
19932
|
);
|
|
19687
19933
|
}
|
|
19688
|
-
|
|
19689
|
-
|
|
19690
|
-
}
|
|
19934
|
+
validateKeyValueList(errors, `${eventPath}.attributes`, event.attributes);
|
|
19935
|
+
});
|
|
19691
19936
|
}
|
|
19692
|
-
if (Array.isArray(span.
|
|
19693
|
-
span.
|
|
19694
|
-
const
|
|
19695
|
-
if (!isRecord16(
|
|
19696
|
-
pushPath(errors,
|
|
19937
|
+
if (Array.isArray(span.links)) {
|
|
19938
|
+
span.links.forEach((link, li) => {
|
|
19939
|
+
const linkPath = `${spanPath}.links[${li}]`;
|
|
19940
|
+
if (!isRecord16(link)) {
|
|
19941
|
+
pushPath(errors, linkPath, "must be an object");
|
|
19697
19942
|
return;
|
|
19698
19943
|
}
|
|
19699
|
-
|
|
19700
|
-
pushPath(errors, `${attrPath}.key`, "must be a string");
|
|
19701
|
-
}
|
|
19702
|
-
validateAnyValue(errors, `${attrPath}.value`, attr.value);
|
|
19944
|
+
validateKeyValueList(errors, `${linkPath}.attributes`, link.attributes);
|
|
19703
19945
|
});
|
|
19704
19946
|
}
|
|
19705
19947
|
if (typeof span.kind === "number") {
|