🪢 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: otel span mapping for pipecat traces (#6903)
Marc Klingen17f626067117
diff --git a/web/src/features/otel/server/index.ts b/web/src/features/otel/server/index.tsindex d621279957..6b7d5a3d15 100644--- a/web/src/features/otel/server/index.ts+++ b/web/src/features/otel/server/index.ts@@ -271,6 +271,12 @@ const extractInputAndOutput = (};}+ // Pipecat uses messages attribute+ input = attributes["messages"];+ if (input) {+ return { input, output: null };+ }+return { input: null, output: null };};@@ -469,7 +475,11 @@ const extractUsageDetails = (const usageDetails = Object.keys(attributes).filter((key) =>(key.startsWith("gen_ai.usage.") && key !== "gen_ai.usage.cost") ||- key.startsWith("llm.token_count"),+ key.startsWith("llm.token_count") ||+ // pipecat logs usage metrics using llm.* attributes+ key === "llm.prompt_tokens" ||+ key === "llm.completion_tokens" ||+ key === "llm.total_tokens",);const usageDetailKeyMapping: Record<string, string> = {@@ -485,7 +495,8 @@ const extractUsageDetails = (return usageDetails.reduce((acc: any, key) => {const usageDetailKey = key.replace("gen_ai.usage.", "")- .replace("llm.token_count.", "");+ .replace("llm.token_count.", "")+ .replace("llm.", "");const mappedUsageDetailKey =usageDetailKeyMapping[usageDetailKey] ?? usageDetailKey;// Cast the respective key to a number