veryfront 0.1.909 → 0.1.911

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.909",
3
+ "version": "0.1.911",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/src/eval/runner.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,cAAc,EAMd,cAAc,EACf,MAAM,YAAY,CAAC;AAmQpB,6DAA6D;AAC7D,wBAAsB,OAAO,CAC3B,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,cAAc,4CAwBxB"}
@@ -1,6 +1,7 @@
1
1
  import * as dntShim from "../../_dnt.shims.js";
2
2
  import { createEvalCheckContext } from "./expect.js";
3
3
  import { createEvalReport } from "./report.js";
4
+ import { metrics as runtimeMetrics } from "../metrics/index.js";
4
5
  import { createEvalReportExporterRegistry, EvalReportExporterRegistryName, } from "../extensions/eval/index.js";
5
6
  import { trace } from "../observability/tracing/api-shim.js";
6
7
  import { tryResolve } from "../extensions/contracts.js";
@@ -32,6 +33,70 @@ function isBlockingFailure(record) {
32
33
  return [...(record.metrics ?? []), ...(record.checks ?? [])].some((result) => !result.skipped && result.pass === false &&
33
34
  (result.severity === "gate" || result.severity === "budget"));
34
35
  }
36
+ function recordPassed(record) {
37
+ if (!record.completed || record.error)
38
+ return false;
39
+ return !isBlockingFailure(record);
40
+ }
41
+ function emitEvalRuntimeMetrics(report) {
42
+ const baseAttributes = {
43
+ eval_id: report.definitionId,
44
+ target_kind: report.targetKind,
45
+ };
46
+ for (const metric of report.summary.metrics) {
47
+ const common = {
48
+ ...baseAttributes,
49
+ metric: metric.name,
50
+ family: metric.family,
51
+ severity: metric.severity,
52
+ };
53
+ if (metric.passed > 0) {
54
+ runtimeMetrics.counter("vf_eval_result_total", metric.passed, {
55
+ ...common,
56
+ outcome: "pass",
57
+ });
58
+ }
59
+ if (metric.failed > 0) {
60
+ runtimeMetrics.counter("vf_eval_result_total", metric.failed, {
61
+ ...common,
62
+ outcome: "fail",
63
+ });
64
+ }
65
+ if (metric.skipped > 0) {
66
+ runtimeMetrics.counter("vf_eval_result_total", metric.skipped, {
67
+ ...common,
68
+ outcome: "skipped",
69
+ });
70
+ }
71
+ }
72
+ if (report.summary.metrics.length === 0) {
73
+ if (report.summary.passed > 0) {
74
+ runtimeMetrics.counter("vf_eval_result_total", report.summary.passed, {
75
+ ...baseAttributes,
76
+ metric: "record",
77
+ family: "record",
78
+ severity: "gate",
79
+ outcome: "pass",
80
+ });
81
+ }
82
+ if (report.summary.failed > 0) {
83
+ runtimeMetrics.counter("vf_eval_result_total", report.summary.failed, {
84
+ ...baseAttributes,
85
+ metric: "record",
86
+ family: "record",
87
+ severity: "gate",
88
+ outcome: "fail",
89
+ });
90
+ }
91
+ }
92
+ for (const record of report.records) {
93
+ runtimeMetrics.histogram("vf_eval_duration_ms", record.durationMs, {
94
+ ...baseAttributes,
95
+ metric: "duration",
96
+ outcome: recordPassed(record) ? "pass" : "fail",
97
+ });
98
+ }
99
+ }
35
100
  function createMissingRegistryResults(exporterIds) {
36
101
  return exporterIds.map((exporterId) => ({
37
102
  exporterId,
@@ -174,6 +239,7 @@ export async function runEval(definition, options) {
174
239
  startedAt,
175
240
  endedAt,
176
241
  });
242
+ emitEvalRuntimeMetrics(report);
177
243
  const exports = await exportEvalReport(report, options.export);
178
244
  return exports === undefined ? report : { ...report, exports };
179
245
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/metrics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,yBAAyB,CAAC;AAYjC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAsFD,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,SAAI,EACT,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CASN;AAED,eAAO,MAAM,OAAO;;;;uBAIC,IAAI;CAKxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/metrics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,yBAAyB,CAAC;AAYjC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA0FD,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,SAAI,EACT,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CASN;AAED,eAAO,MAAM,OAAO;;;;uBAIC,IAAI;CAKxB,CAAC"}
@@ -33,10 +33,14 @@ function normalizeAttributes(attributes) {
33
33
  normalized.project_id = context.projectId;
34
34
  if (context?.projectSlug)
35
35
  normalized.project_slug = context.projectSlug;
36
- if (context?.environmentName)
37
- normalized.environment = context.environmentName;
38
- if (context && !context.productionMode)
39
- normalized.branch = context.branch ?? "main";
36
+ if (context) {
37
+ const environmentName = context.environmentName ??
38
+ (!context.productionMode ? "preview" : undefined);
39
+ if (environmentName)
40
+ normalized.environment = environmentName;
41
+ if (!context.productionMode)
42
+ normalized.branch = context.branch ?? "main";
43
+ }
40
44
  return normalized;
41
45
  }
42
46
  function attributesKey(attributes) {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.909";
2
+ export declare const VERSION = "0.1.911";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.909";
4
+ export const VERSION = "0.1.911";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.909",
3
+ "version": "0.1.911",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",