Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: handle multiple number types in otel parser (#5323)

Steffen Schmitz2abc9fed7a1d
diff --git a/web/src/features/otel/server/index.ts b/web/src/features/otel/server/index.ts
index 54cc67ca42..795f3fa04f 100644
--- a/web/src/features/otel/server/index.ts
+++ b/web/src/features/otel/server/index.ts
@@ -2,10 +2,17 @@ import { type IngestionEventType } from "@langfuse/shared/src/server";
import { randomUUID } from "crypto";
import { ObservationLevel } from "@prisma/client";
-const convertNanoTimestampToISO = (timestamp: {
- high: number;
- low: number;
-}) => {
+const convertNanoTimestampToISO = (
+ timestamp:
+ | number
+ | {
+ high: number;
+ low: number;
+ },
+) => {
+ if (typeof timestamp === "number") {
+ return new Date(timestamp / 1e6).toISOString();
+ }
return new Date(
(timestamp.high * Math.pow(2, 32) + timestamp.low) / 1e6,
).toISOString();
@@ -27,6 +34,9 @@ const convertValueToPlainJavascript = (value: Record<string, any>): any => {
if (value.intValue && value.intValue.high === 0) {
return value.intValue.low;
}
+ if (value.intValue && typeof value.intValue === "number") {
+ return value.intValue;
+ }
if (
value.intValue &&
value.intValue.high === -1 &&