🪢 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(events-table): show session id and user id if available (#11678)
Nimare8d841ab433d
diff --git a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsxindex 1bedb80593..5c78324be1 100644--- a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx+++ b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx@@ -49,19 +49,12 @@ export interface ObservationDetailViewProps {observation: ObservationReturnTypeWithMetadata;projectId: string;traceId: string;- // shows trace-like properties (userId, sessionId) if true- isRoot?: boolean;- sessionId?: string | null;- userId?: string | null;}export function ObservationDetailView({observation,projectId,traceId,- isRoot = false,- sessionId,- userId,}: ObservationDetailViewProps) {// Tab and view state from URL (via SelectionContext)// For observations, "log" tab doesn't apply - map to "preview"@@ -229,9 +222,6 @@ export function ObservationDetailView({onSelectionUsed={handleSelectionUsed}isCommentDrawerOpen={isCommentDrawerOpen}onCommentDrawerOpenChange={setIsCommentDrawerOpen}- isRoot={isRoot}- sessionId={sessionId}- userId={userId}/>{/* Tabs section */}diff --git a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailViewHeader.tsx b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailViewHeader.tsxindex 5813a1b737..3932445a94 100644--- a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailViewHeader.tsx+++ b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailViewHeader.tsx@@ -67,10 +67,6 @@ export interface ObservationDetailViewHeaderProps {onSelectionUsed?: () => void;isCommentDrawerOpen?: boolean;onCommentDrawerOpenChange?: (open: boolean) => void;- // shows trace-like properties (userId, sessionId) if true- isRoot?: boolean;- sessionId?: string | null;- userId?: string | null;}export const ObservationDetailViewHeader = memo(@@ -86,9 +82,6 @@ export const ObservationDetailViewHeader = memo(onSelectionUsed,isCommentDrawerOpen,onCommentDrawerOpenChange,- isRoot = false,- sessionId,- userId,}: ObservationDetailViewHeaderProps) {// Format cost and usage valuesconst totalCost = observation.totalCost;@@ -190,16 +183,14 @@ export const ObservationDetailViewHeader = memo(<TimeToFirstTokenBadgetimeToFirstToken={observation.timeToFirstToken}/>- {/* Trace-like badges shown when this is root observation */}- {isRoot && (- <SessionBadge- sessionId={sessionId ?? null}- projectId={projectId}- />- )}- {isRoot && (- <UserIdBadge userId={userId ?? null} projectId={projectId} />- )}+ <SessionBadge+ sessionId={observation.sessionId ?? null}+ projectId={projectId}+ />+ <UserIdBadge+ userId={observation.userId ?? null}+ projectId={projectId}+ /><EnvironmentBadge environment={observation.environment} /><CostBadgetotalCost={totalCost}diff --git a/web/src/components/trace2/components/_layout/TracePanelDetail.tsx b/web/src/components/trace2/components/_layout/TracePanelDetail.tsxindex bab6f4adc2..a144b7fef3 100644--- a/web/src/components/trace2/components/_layout/TracePanelDetail.tsx+++ b/web/src/components/trace2/components/_layout/TracePanelDetail.tsx@@ -62,17 +62,11 @@ export function TracePanelDetail() {);}- // Check if this observation is one of the roots (events-based trace)- const isRoot = roots.some((r) => r.id === selectedNodeId);-return (<ObservationDetailViewobservation={observationData}projectId={trace.projectId}traceId={trace.id}- isRoot={isRoot}- sessionId={trace.sessionId}- userId={trace.userId}/>);}@@ -86,15 +80,7 @@ export function TracePanelDetail() {projectId={trace.projectId}/>);- }, [- selectedNodeId,- nodeMap,- trace,- roots,- observations,- scores,- corrections,- ]);+ }, [selectedNodeId, nodeMap, trace, observations, scores, corrections]);return (<div className="h-full w-full overflow-y-auto bg-background">{content}</div>diff --git a/web/src/server/api/routers/traces.ts b/web/src/server/api/routers/traces.tsindex 0b44bfc4f0..8b75f6c02f 100644--- a/web/src/server/api/routers/traces.ts+++ b/web/src/server/api/routers/traces.ts@@ -79,6 +79,9 @@ export type ObservationReturnTypeWithMetadata = Omit<> & {traceId: string;metadata: string | null;+ // optional, because in v4 an observation can have those properties+ userId?: string | null;+ sessionId?: string | null;};export type ObservationReturnType = Omit<