diff --git a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx b/ui/litellm-dashboard/src/components/view_logs/index.test.tsx index 294dc84761b..a44a8ada43d 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.test.tsx @@ -1,4 +1,4 @@ -import { render } from "@testing-library/react"; +import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import { RequestViewer } from "./index"; import type { LogEntry } from "./columns"; @@ -43,14 +43,14 @@ const createRow = (overrides: Partial = {}): Row => describe("Request Viewer", () => { it("renders the request details heading", () => { - const { getByText } = render(); - expect(getByText("Request Details")).toBeInTheDocument(); + render(); + expect(screen.getByText("Request Details")).toBeInTheDocument(); }); it("should truncate the request id if it is longer than 64 characters", () => { const LONG_REQUEST_ID = "a".repeat(128); const TRUNCATED_REQUEST_ID = `${"a".repeat(64)}...`; - const { getByText } = render( + render( { />, ); - expect(getByText(TRUNCATED_REQUEST_ID)).toBeInTheDocument(); + expect(screen.getByText(TRUNCATED_REQUEST_ID)).toBeInTheDocument(); + }); + + it("should display LiteLLM Overhead when litellm_overhead_time_ms is present in metadata", () => { + render( + , + ); + + expect(screen.getByText("LiteLLM Overhead:")).toBeInTheDocument(); + expect(screen.getByText("150 ms")).toBeInTheDocument(); + }); + + it("should not display LiteLLM Overhead when litellm_overhead_time_ms is not present in metadata", () => { + render(); + + expect(screen.queryByText("LiteLLM Overhead:")).not.toBeInTheDocument(); }); }); diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index 04c81d832d6..f6a969a9eed 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -930,6 +930,12 @@ export function RequestViewer({ row }: { row: Row }) { Duration: {row.original.duration} s. + {row.original.metadata?.litellm_overhead_time_ms !== undefined && ( +
+ LiteLLM Overhead: + {row.original.metadata.litellm_overhead_time_ms} ms +
+ )}