🪢 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): add input/output and name on traces (#5449)
Steffen Schmitz2559a388aa40
diff --git a/web/src/features/otel/server/index.ts b/web/src/features/otel/server/index.tsindex a7d17bebe8..1567181014 100644--- a/web/src/features/otel/server/index.ts+++ b/web/src/features/otel/server/index.ts@@ -291,6 +291,7 @@ export const convertOtelSpanToIngestionEvent = (const trace = {id: Buffer.from(span.traceId?.data ?? span.traceId).toString("hex"),timestamp: convertNanoTimestampToISO(span.startTimeUnixNano),+ name: span.name,metadata: {attributes,resourceAttributes,@@ -299,6 +300,9 @@ export const convertOtelSpanToIngestionEvent = (version: resourceAttributes?.["service.version"] ?? null,userId: extractUserId(attributes),sessionId: extractSessionId(attributes),++ // Input and Output+ ...extractInputAndOutput(span?.events ?? [], attributes),};events.push({id: randomUUID(),@@ -343,11 +347,10 @@ export const convertOtelSpanToIngestionEvent = (...extractInputAndOutput(span?.events ?? [], attributes),};- // If the span has any gen_ai or llm attributes, we consider it a generation- const isGeneration = Object.keys(attributes).some(- (key) => key.startsWith("gen_ai") || key.startsWith("llm"),- );-+ // If the span has a model property, we consider it a generation.+ // Just checking for llm.* or gen_ai.* attributes leads to overreporting and wrong+ // aggregations for costs.+ const isGeneration = Boolean(observation.model);events.push({id: randomUUID(),type: isGeneration ? "generation-create" : "span-create",