/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3ad311fe40cc */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ScalarMetric, ScalarMetric$inboundSchema } from "./scalarmetric.js"; import { TimeSeriesMetric, TimeSeriesMetric$inboundSchema, } from "./timeseriesmetric.js"; /** * Complete metrics for a specific workflow. * * @remarks * * This type combines all metric categories. */ export type WorkflowMetrics = { /** * Scalar metric with a single value. */ executionCount: ScalarMetric; /** * Scalar metric with a single value. */ successCount: ScalarMetric; /** * Scalar metric with a single value. */ errorCount: ScalarMetric; /** * Scalar metric with a single value. */ averageLatencyMs: ScalarMetric; /** * Time-series metric with timestamp-value pairs. */ latencyOverTime: TimeSeriesMetric; /** * Scalar metric with a single value. */ retryRate: ScalarMetric; }; /** @internal */ export const WorkflowMetrics$inboundSchema: z.ZodType< WorkflowMetrics, unknown > = z.object({ execution_count: ScalarMetric$inboundSchema, success_count: ScalarMetric$inboundSchema, error_count: ScalarMetric$inboundSchema, average_latency_ms: ScalarMetric$inboundSchema, latency_over_time: TimeSeriesMetric$inboundSchema, retry_rate: ScalarMetric$inboundSchema, }).transform((v) => { return remap$(v, { "execution_count": "executionCount", "success_count": "successCount", "error_count": "errorCount", "average_latency_ms": "averageLatencyMs", "latency_over_time": "latencyOverTime", "retry_rate": "retryRate", }); }); export function workflowMetricsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowMetrics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowMetrics' from JSON`, ); }