Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(v4): round estimated API call counts (#16104)

Max Deichmann45252d69bff7
diff --git a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
index ea379dc350..8937a50eeb 100644
--- a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
+++ b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
@@ -360,6 +360,32 @@ describe("V4MigrationDetailsContent", () => {
}
});
+ it("rounds estimated API call counts and keeps positive usage visible", () => {
+ mocks.migrationData.apiUsage = [
+ {
+ endpoint: "GET /api/public/traces",
+ count: 56.5,
+ lastSeen: "2026-07-23T10:37:00Z",
+ },
+ {
+ endpoint: "GET /api/public/observations",
+ count: 4.5,
+ lastSeen: "2026-07-22T10:37:00Z",
+ },
+ {
+ endpoint: "GET /api/public/traces/{id}",
+ count: 1 / 3,
+ lastSeen: "2026-07-21T10:37:00Z",
+ },
+ ];
+
+ render(<V4MigrationDetailsContent projectId="project-1" />);
+
+ expect(screen.getByText(/57 calls · last seen/)).toBeInTheDocument();
+ expect(screen.getByText(/5 calls · last seen/)).toBeInTheDocument();
+ expect(screen.getByText(/1 call · last seen/)).toBeInTheDocument();
+ });
+
it("collapses clean sections into one up-to-date summary", () => {
mocks.migrationData.apis = { status: "loaded", count: 0 };
mocks.migrationData.exports = { status: "loaded", count: 0 };
diff --git a/web/src/features/v4-migration/V4MigrationContent.tsx b/web/src/features/v4-migration/V4MigrationContent.tsx
index 25912b3790..e9ff3c67ca 100644
--- a/web/src/features/v4-migration/V4MigrationContent.tsx
+++ b/web/src/features/v4-migration/V4MigrationContent.tsx
@@ -906,27 +906,35 @@ export function V4MigrationApisSection({
maps each endpoint to its replacement.
</p>
<div className="flex flex-col">
- {usage.map((row) => (
- <div
- key={row.endpoint}
- className="text-muted-foreground flex flex-wrap items-baseline justify-between gap-x-2 py-0.5"
- >
- <ExternalLink
- href={DEPRECATED_API_MIGRATION_URL}
- className="text-sm"
- analytics={{ section: "apis", link: "deprecated_api_docs" }}
- >
- {row.endpoint}
- </ExternalLink>
- <span
- className="text-muted-foreground text-sm whitespace-nowrap"
- title={`Last seen at ${row.lastSeen}`}
+ {usage.map((row) => {
+ const roundedCount = Math.max(1, Math.round(row.count));
+
+ return (
+ <div
+ key={row.endpoint}
+ className="text-muted-foreground flex flex-wrap items-baseline justify-between gap-x-2 py-0.5"
>
- {numberFormatter(row.count, 0, 2)} calls · last seen{" "}
- {formatCompactRelativeTime(new Date(row.lastSeen))}
- </span>
- </div>
- ))}
+ <ExternalLink
+ href={DEPRECATED_API_MIGRATION_URL}
+ className="text-sm"
+ analytics={{
+ section: "apis",
+ link: "deprecated_api_docs",
+ }}
+ >
+ {row.endpoint}
+ </ExternalLink>
+ <span
+ className="text-muted-foreground text-sm whitespace-nowrap"
+ title={`Last seen at ${row.lastSeen}`}
+ >
+ {numberFormatter(roundedCount, 0)}{" "}
+ {roundedCount === 1 ? "call" : "calls"} · last seen{" "}
+ {formatCompactRelativeTime(new Date(row.lastSeen))}
+ </span>
+ </div>
+ );
+ })}
</div>
</>
) : (