veryfront 0.1.885 → 0.1.886
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/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.886",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -50,6 +50,7 @@ export default {
|
|
|
50
50
|
"./extensions/ext-parser-babel",
|
|
51
51
|
"./extensions/ext-sandbox-shell-tools",
|
|
52
52
|
"./extensions/ext-observability-opentelemetry",
|
|
53
|
+
"./extensions/ext-eval-report-http",
|
|
53
54
|
"./extensions/ext-content-mdx",
|
|
54
55
|
"./extensions/ext-schema-zod"
|
|
55
56
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/src/eval/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/src/eval/runner.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAEV,cAAc,EAMd,cAAc,EACf,MAAM,YAAY,CAAC;AA+LpB,6DAA6D;AAC7D,wBAAsB,OAAO,CAC3B,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,cAAc,4CAuBxB"}
|
package/esm/src/eval/runner.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as dntShim from "../../_dnt.shims.js";
|
|
|
2
2
|
import { createEvalCheckContext } from "./expect.js";
|
|
3
3
|
import { createEvalReport } from "./report.js";
|
|
4
4
|
import { createEvalReportExporterRegistry, EvalReportExporterRegistryName, } from "../extensions/eval/index.js";
|
|
5
|
+
import { trace } from "../observability/tracing/api-shim.js";
|
|
5
6
|
import { tryResolve } from "../extensions/contracts.js";
|
|
6
7
|
function createRunId(now) {
|
|
7
8
|
return `evalrun_${now.toISOString().replace(/[-:.]/g, "").replace("T", "_").replace("Z", "")}`;
|
|
@@ -49,13 +50,39 @@ function resolveExporterRegistry(config) {
|
|
|
49
50
|
return config.registry ??
|
|
50
51
|
tryResolve(EvalReportExporterRegistryName);
|
|
51
52
|
}
|
|
53
|
+
function isEmptyTraceId(value) {
|
|
54
|
+
return value === undefined || /^0+$/.test(value);
|
|
55
|
+
}
|
|
56
|
+
function getActiveEvalExportTraceContext() {
|
|
57
|
+
const spanContext = trace.getActiveSpan()?.spanContext();
|
|
58
|
+
if (!spanContext)
|
|
59
|
+
return undefined;
|
|
60
|
+
if (isEmptyTraceId(spanContext.traceId) || isEmptyTraceId(spanContext.spanId)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
traceId: spanContext.traceId,
|
|
65
|
+
spanId: spanContext.spanId,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function withActiveTraceContext(context) {
|
|
69
|
+
if (context?.trace)
|
|
70
|
+
return context;
|
|
71
|
+
const activeTrace = getActiveEvalExportTraceContext();
|
|
72
|
+
if (!activeTrace)
|
|
73
|
+
return context;
|
|
74
|
+
return {
|
|
75
|
+
...(context ?? {}),
|
|
76
|
+
trace: activeTrace,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
52
79
|
async function exportWithSelectedExporter(registry, report, config, exporterId) {
|
|
53
80
|
const exporter = registry.get(exporterId);
|
|
54
81
|
if (!exporter)
|
|
55
82
|
return createMissingExporterResult(exporterId);
|
|
56
83
|
const selectedRegistry = createEvalReportExporterRegistry();
|
|
57
84
|
selectedRegistry.register(exporter);
|
|
58
|
-
const [result] = await selectedRegistry.export(report, config.context);
|
|
85
|
+
const [result] = await selectedRegistry.export(report, withActiveTraceContext(config.context));
|
|
59
86
|
return result ?? {
|
|
60
87
|
exporterId,
|
|
61
88
|
ok: false,
|
|
@@ -70,7 +97,7 @@ async function exportEvalReport(report, config) {
|
|
|
70
97
|
if (!registry)
|
|
71
98
|
return createMissingRegistryResults(exporterIds);
|
|
72
99
|
if (exporterIds.length === 0) {
|
|
73
|
-
return registry.export(report, config.context);
|
|
100
|
+
return registry.export(report, withActiveTraceContext(config.context));
|
|
74
101
|
}
|
|
75
102
|
const results = [];
|
|
76
103
|
for (const exporterId of exporterIds) {
|