diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx index daff1b233d2..009839ad7f2 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx @@ -68,7 +68,7 @@ describe("LogDetailContent", () => { ); expect(screen.getByText("Source")).toBeInTheDocument(); - expect(screen.getByRole("img", { name: "Notion logo" })).toBeInTheDocument(); + expect(screen.getByLabelText("Notion logo")).toBeInTheDocument(); expect(screen.getByText("Notion")).toBeInTheDocument(); }); diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx index 7e3578f1b14..2fe7816d95f 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx @@ -39,6 +39,14 @@ import { RelaySourceBadge, getRelaySource } from "../TypeBadges"; const { Text } = Typography; +const getObjectRequestTags = (requestTags: LogEntry["request_tags"]): Record | undefined => { + if (!requestTags || Array.isArray(requestTags) || typeof requestTags !== "object") { + return undefined; + } + + return requestTags; +}; + export interface LogDetailContentProps { logEntry: LogEntry; /** When true, log details (messages/response) are still being lazy-loaded. */ @@ -56,6 +64,7 @@ export interface LogDetailContentProps { */ export function LogDetailContent({ logEntry, isLoadingDetails = false, accessToken }: LogDetailContentProps) { const metadata = logEntry.metadata || {}; + const requestTags = getObjectRequestTags(logEntry.request_tags); const hasError = metadata.status === "failure"; const errorInfo = hasError ? metadata.error_information : null; const isRelayCapture = logEntry.call_type === "litellm-relay"; @@ -112,9 +121,7 @@ export function LogDetailContent({ logEntry, isLoadingDetails = false, accessTok )} {/* Tags */} - {logEntry.request_tags && Object.keys(logEntry.request_tags).length > 0 && ( - - )} + {requestTags && Object.keys(requestTags).length > 0 && } {/* Request Details */}
@@ -242,7 +249,7 @@ function ErrorDescription({ errorInfo }: { errorInfo: any }) { ); } -function TagsSection({ tags }: { tags: Record }) { +function TagsSection({ tags }: { tags: Record }) { return (
diff --git a/ui/litellm-dashboard/src/components/view_logs/columns.test.tsx b/ui/litellm-dashboard/src/components/view_logs/columns.test.tsx index 2743eae8309..1251f54e3f3 100644 --- a/ui/litellm-dashboard/src/components/view_logs/columns.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/columns.test.tsx @@ -111,6 +111,28 @@ describe("view logs columns", () => { expect(screen.queryByText("LLM")).not.toBeInTheDocument(); }); + it("should render collector rows with relay metadata as relay logs", () => { + const legacyCollectorLog = { + ...baseLog, + request_id: "collector-01f159da", + call_type: "completion", + metadata: { + ...baseLog.metadata, + app: "codex", + source: "litellm-relay", + }, + model: "codex-ai", + request_tags: ["litellm-relay", "codex"], + }; + + render(); + + expect(screen.getByText("litellm-relay")).toBeInTheDocument(); + expect(screen.getAllByText("Codex").length).toBeGreaterThan(0); + expect(screen.getAllByRole("img", { name: "Codex logo" }).length).toBeGreaterThan(0); + expect(screen.queryByText("LLM")).not.toBeInTheDocument(); + }); + it("should fall back to row api_key when relay metadata does not include a key hash", () => { render( row.request_id} />);