🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(analytics): capture failed tRPC operation (#18427)
Nikita Kabardinbd19c212aa6e
diff --git a/web/src/utils/trpcErrorClassification.clienttest.ts b/web/src/utils/trpcErrorClassification.clienttest.tsindex 09fbf63046..632d0aad61 100644--- a/web/src/utils/trpcErrorClassification.clienttest.ts+++ b/web/src/utils/trpcErrorClassification.clienttest.ts@@ -32,6 +32,7 @@ describe("classifyTrpcToastError", () => {expect(classifyTrpcToastError(trpcError(code, httpStatus))).toEqual({errorOrigin,errorCategory,+ operation: "test.procedure",trpcCode: code,httpStatus,});@@ -46,6 +47,7 @@ describe("classifyTrpcToastError", () => {).toEqual({errorOrigin: "backend",errorCategory: "user_input",+ operation: path,trpcCode: "BAD_REQUEST",httpStatus: 400,});diff --git a/web/src/utils/trpcErrorClassification.ts b/web/src/utils/trpcErrorClassification.tsindex 125654919e..7a7c15affb 100644--- a/web/src/utils/trpcErrorClassification.ts+++ b/web/src/utils/trpcErrorClassification.ts@@ -45,11 +45,13 @@ const withTransportMetadata = (error: TRPCClientError<any>,classification: Pick<ToastErrorAnalytics, "errorOrigin" | "errorCategory">,): ToastErrorAnalytics => {+ const operation = getPath(error);const trpcCode = getCode(error);const httpStatus = getHttpStatus(error);return {...classification,+ ...(operation ? { operation } : {}),...(trpcCode ? { trpcCode } : {}),...(httpStatus !== undefined ? { httpStatus } : {}),};diff --git a/web/src/utils/trpcErrorToast.clienttest.ts b/web/src/utils/trpcErrorToast.clienttest.tsindex d72c8c22b1..6e72058644 100644--- a/web/src/utils/trpcErrorToast.clienttest.ts+++ b/web/src/utils/trpcErrorToast.clienttest.ts@@ -151,6 +151,7 @@ describe("trpcErrorToast", () => {{errorOrigin: "backend",errorCategory: "user_input",+ operation: "prompts.create",trpcCode: "BAD_REQUEST",httpStatus: 400,},@@ -177,6 +178,7 @@ describe("trpcErrorToast", () => {{errorOrigin: "frontend",errorCategory: "internal",+ operation: "prompts.create",trpcCode: "BAD_REQUEST",httpStatus: 400,},@@ -204,6 +206,7 @@ describe("trpcErrorToast", () => {{errorOrigin: "backend",errorCategory: "internal",+ operation: "prompts.create",trpcCode: "INTERNAL_SERVER_ERROR",httpStatus: 500,},@@ -238,6 +241,7 @@ describe("trpcErrorToast", () => {{errorOrigin: errorCategory === "transient" ? "network" : "backend",errorCategory,+ operation: "prompts.create",trpcCode: code,httpStatus,},