🪢 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
fix: observations v2 shouldn't be joining reconstructed traces for userId (#13708)
Valery Meleshkin841f0fbfecd2
diff --git a/packages/shared/src/server/queries/public-api-filter-builder.ts b/packages/shared/src/server/queries/public-api-filter-builder.tsindex e1d04d029a..29aceb3cbb 100644--- a/packages/shared/src/server/queries/public-api-filter-builder.ts+++ b/packages/shared/src/server/queries/public-api-filter-builder.ts@@ -135,14 +135,28 @@ export function createPublicApiObservationsColumnMapping(tablePrefix: "e" | "o",parentFieldName: "parent_span_id" | "parent_observation_id",): ApiColumnMapping[] {+ // user_id is denormalized onto events_core/events_full, so the events_proto+ // path filters directly without joining the traces CTE. The legacy+ // observations table does not carry user_id, so that path still joins+ // traces.+ const userIdMapping: ApiColumnMapping =+ tableName === "events_proto"+ ? {+ id: "userId",+ clickhouseSelect: "user_id",+ filterType: "StringFilter",+ clickhouseTable: tableName,+ clickhousePrefix: tablePrefix,+ }+ : {+ id: "userId",+ clickhouseSelect: "user_id",+ filterType: "StringFilter",+ clickhouseTable: "traces",+ clickhousePrefix: "t",+ };return [- {- id: "userId",- clickhouseSelect: "user_id",- filterType: "StringFilter",- clickhouseTable: "traces",- clickhousePrefix: "t",- },+ userIdMapping,{id: "traceId",clickhouseSelect: "trace_id",