Skip to content

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

feat: process livekit semantic attributes in otel parsing (#9568)

Steffen Schmitz32e6026f2496
diff --git a/packages/shared/src/server/otel/OtelIngestionProcessor.ts b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
index 927e91d23c..eb76f2a5c3 100644
--- a/packages/shared/src/server/otel/OtelIngestionProcessor.ts
+++ b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
@@ -1027,6 +1027,14 @@ export class OtelIngestionProcessor {
return { input, output };
}
+ // LiveKit
+ input = attributes["lk.input_text"];
+ output =
+ attributes["lk.function_tool.output"] || attributes["lk.response.text"];
+ if (input || output) {
+ return { input, output };
+ }
+
// Logfire uses single `events` array for GenAI events
const eventsArray = attributes["events"];
if (typeof eventsArray === "string" || Array.isArray(eventsArray)) {
diff --git a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
index 6e2822ff50..70349c473f 100644
--- a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
+++ b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
@@ -2129,6 +2129,42 @@ describe("OTel Resource Span Mapping", () => {
entityAttributeValue: '{"foo": "bar"}',
},
],
+ [
+ "should map lk.input_text to input",
+ {
+ entity: "observation",
+ otelAttributeKey: "lk.input_text",
+ otelAttributeValue: {
+ stringValue: "What is the weather today?",
+ },
+ entityAttributeKey: "input",
+ entityAttributeValue: "What is the weather today?",
+ },
+ ],
+ [
+ "should map lk.response.text to output",
+ {
+ entity: "observation",
+ otelAttributeKey: "lk.response.text",
+ otelAttributeValue: {
+ stringValue: "The weather is sunny with a high of 75°F.",
+ },
+ entityAttributeKey: "output",
+ entityAttributeValue: "The weather is sunny with a high of 75°F.",
+ },
+ ],
+ [
+ "should map lk.function_tool.output to output",
+ {
+ entity: "observation",
+ otelAttributeKey: "lk.function_tool.output",
+ otelAttributeValue: {
+ stringValue: '{"temperature": 75, "condition": "sunny"}',
+ },
+ entityAttributeKey: "output",
+ entityAttributeValue: '{"temperature": 75, "condition": "sunny"}',
+ },
+ ],
])(
"Attributes: %s",
async (