Repository navigation
feat(ui): agent traces tab on logs with timeline and otel setup guide - #43891
Conversation
|
|
|
| if (traces.notEnabledDetail !== null) return <TracingSetupCard detail={traces.notEnabledDetail} />; | ||
| // Onboarding only on the first, default view; an empty range the user picked keeps its controls. | ||
| const isEmpty = !traces.isLoading && !traces.error && traces.traces.length === 0; | ||
| if (isEmpty && !rangeChanged) return <TracingSetupCard detail={null} />; |
There was a problem hiding this comment.
Empty view hides time controls When tracing is enabled but the default 24-hour query finds no runs, this return shows the setup card instead of the runs view. The card has no time-range control, so users cannot select Last 7 days or Last 30 days to find older runs. Keep the range controls available when the default range is empty.
| const isFullBleed = FULL_BLEED_SEGMENTS.has(routeSegment); | ||
| // A manual toggle holds only for the route it was made on; full-bleed routes default to collapsed. | ||
| const [sidebarOverride, setSidebarOverride] = useState<{ segment: string; collapsed: boolean } | null>(null); | ||
| const sidebarCollapsed = sidebarOverride?.segment === routeSegment ? sidebarOverride.collapsed : isFullBleed; |
There was a problem hiding this comment.
Sidebar preference resets across routes The override now applies only to the route segment where the user toggled the sidebar. If they collapse it on
/ui/api-keys and navigate to /ui/models, it expands again, although their choice previously persisted across dashboard routes. The repository requires a user-controlled flag for backwards-incompatible behavior changes; that requirement must be satisfied before merging.
Rule Used: What: avoid backwards-incompatible changes without user-controlled flags Why: This breaks current behaviour for users using existing functionality Example of BAD: this PR (#22164) introduced run_post_custom... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| queryFn: ({ pageParam }) => { | ||
| const nowMs = Date.now(); | ||
| return agentTraceListCall({ | ||
| accessToken, | ||
| startMs: traceWindowStartMs(startTime, endTime, isCustomDate, nowMs), | ||
| endMs: isCustomDate ? moment(endTime).valueOf() : nowMs, | ||
| cursor: pageParam as string | null, |
There was a problem hiding this comment.
Pages use different time windows Each page fetch calculates a fresh rolling time window, even when it uses a cursor from an earlier page. After “Load more,” live refreshes can combine pages fetched with different bounds. This can make the runs list and timeline inconsistent; use one time window for a pagination cycle or restart pagination when it advances.
| )} | ||
| {drawerOpen && logQuery.isSuccess && logQuery.data === null && ( | ||
| <p className="mt-2 font-mono text-[11px] text-muted-foreground">No request log found for this call.</p> | ||
| )} | ||
| <LogDetailsDrawer | ||
| open={drawerOpen && Boolean(logQuery.data)} | ||
| onClose={() => setDrawerOpen(false)} |
There was a problem hiding this comment.
Request lookup errors are silent If the request-log lookup fails—for example, because the user cannot access that request—the drawer does not open. This component shows a message when a successful lookup finds nothing, but shows no message for an error, leaving “Open request log” apparently unresponsive. Show the lookup error alongside the not-found message.
TLDR
UI only, straight to main. Needs the agent tracing backend (#43819 then #43864) to have data. Without it the tab shows the "Tracing is not enabled" guide, so it's safe to merge in any order
Problem this solves:
How it solves it:
Intentional product change: opening Logs collapses the left nav to icons for a full screen view. The toggle still expands it
User Flow
Before: a developer sending agent traces to LiteLLM has nowhere clean to see them
After: the developer finds every agent run under Logs
Pre-Submission checklist
Screenshots / Proof of Fix
Real stack, no mocks: LangChain / Deep Agents agents export OTEL to a local proxy (
POST /v1/traces), spans land in ClickHouse, the UI dev server reads them back. The runs below are real agent runs through LiteLLMBefore (3930c5b, main)
After (HEAD of litellm_agent-traces-ui)
Logs page
Runs table and timeline
Run view
Setup guide (no traces yet)
Tests
npx vitest run src/components/view_logs "src/app/(dashboard)/layout.test.tsx"-> 596 passed, eslint 0 new errors, tsc cleanType
🆕 New Feature
Caveats (if any)
Medium
Low