Skip to content

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

feat(v4): add upgrade status tiles (#14567)

Max Deichmannfd6bc776644f
diff --git a/web/src/__tests__/server/unit/v4TransitionRouter.servertest.ts b/web/src/__tests__/server/unit/v4TransitionRouter.servertest.ts
index abc00df8e7..d4276bb1bc 100644
--- a/web/src/__tests__/server/unit/v4TransitionRouter.servertest.ts
+++ b/web/src/__tests__/server/unit/v4TransitionRouter.servertest.ts
@@ -1,5 +1,6 @@
import type { Session } from "next-auth";
import type * as SharedServer from "@langfuse/shared/src/server";
+import type { PrismaClient } from "@langfuse/shared/src/db";
import { v4TransitionRouter } from "@/src/features/v4/server/v4TransitionRouter";
import { createInnerTRPCContext } from "@/src/server/api/trpc";
import { queryClickhouse } from "@langfuse/shared/src/server";
@@ -21,6 +22,12 @@ const mockedQueryClickhouse = vi.mocked(queryClickhouse);
const projectId = "project-v4-transition";
+const createCaller = (prisma?: Partial<PrismaClient>) =>
+ v4TransitionRouter.createCaller({
+ ...createInnerTRPCContext({ session, headers: {} }),
+ ...(prisma ? { prisma: prisma as PrismaClient } : {}),
+ });
+
const session: Session = {
expires: "1",
user: {
@@ -84,9 +91,7 @@ describe("v4TransitionRouter", () => {
});
it("queries legacy public API usage with UTC buckets and route classification", async () => {
- const caller = v4TransitionRouter.createCaller(
- createInnerTRPCContext({ session, headers: {} }),
- );
+ const caller = createCaller();
const rows = await caller.timeSeriesByEntrypoint({
projectId,
@@ -117,6 +122,9 @@ describe("v4TransitionRouter", () => {
expect(clickhouseQuery?.query).toContain(
"sum(1.0 / clickhouse_queries_per_api_call) AS count",
);
+ expect(clickhouseQuery?.query).toContain(
+ "SETTINGS skip_unavailable_shards = 1",
+ );
expect(clickhouseQuery?.query).toContain("AND type = 'QueryFinish'");
expect(clickhouseQuery?.query).toContain(
"JSONExtractString(log_comment, 'tag_schema_version') = '1'",
@@ -161,4 +169,192 @@ describe("v4TransitionRouter", () => {
"match(route_path, '^GET /api/public/traces/[^/?#]+$'), 3",
);
});
+
+ it("summarizes trace-level evals and legacy integrations", async () => {
+ const mockPrisma = {
+ jobConfiguration: {
+ count: vi.fn().mockResolvedValue(3),
+ },
+ posthogIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: true,
+ exportSource: "TRACES_OBSERVATIONS",
+ }),
+ },
+ mixpanelIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: true,
+ exportSource: "EVENTS",
+ }),
+ },
+ blobStorageIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: true,
+ exportSource: "TRACES_OBSERVATIONS_EVENTS",
+ }),
+ },
+ };
+ const caller = createCaller(mockPrisma);
+
+ await expect(caller.summary({ projectId })).resolves.toEqual({
+ traceLevelEvalCount: 3,
+ legacyIntegrationCount: 2,
+ legacyIntegrations: {
+ posthog: true,
+ mixpanel: false,
+ blobStorage: true,
+ },
+ });
+
+ expect(mockPrisma.jobConfiguration.count).toHaveBeenCalledWith({
+ where: {
+ projectId,
+ jobType: "EVAL",
+ targetObject: "trace",
+ },
+ });
+ expect(mockPrisma.posthogIntegration.findUnique).toHaveBeenCalledWith({
+ where: { projectId },
+ select: { enabled: true, exportSource: true },
+ });
+ expect(mockPrisma.mixpanelIntegration.findUnique).toHaveBeenCalledWith({
+ where: { projectId },
+ select: { enabled: true, exportSource: true },
+ });
+ expect(mockPrisma.blobStorageIntegration.findUnique).toHaveBeenCalledWith({
+ where: { projectId },
+ select: { enabled: true, exportSource: true },
+ });
+ });
+
+ it("does not count disabled legacy integrations", async () => {
+ const mockPrisma = {
+ jobConfiguration: {
+ count: vi.fn().mockResolvedValue(0),
+ },
+ posthogIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: false,
+ exportSource: "TRACES_OBSERVATIONS",
+ }),
+ },
+ mixpanelIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: true,
+ exportSource: "TRACES_OBSERVATIONS_EVENTS",
+ }),
+ },
+ blobStorageIntegration: {
+ findUnique: vi.fn().mockResolvedValue({
+ enabled: false,
+ exportSource: "TRACES_OBSERVATIONS_EVENTS",
+ }),
+ },
+ };
+ const caller = createCaller(mockPrisma);
+
+ await expect(caller.summary({ projectId })).resolves.toEqual({
+ traceLevelEvalCount: 0,
+ legacyIntegrationCount: 1,
+ legacyIntegrations: {
+ posthog: false,
+ mixpanel: true,
+ blobStorage: false,
+ },
+ });
+ });
+
+ it("queries trace-level eval execution counts by time bucket and generated score name", async () => {
+ const mockPrisma = {
+ $queryRaw: vi.fn().mockResolvedValue([
+ {
+ time: "2026-06-25T12:00:00Z",
+ scoreName: "toxicity",
+ count: 4n,
+ },
+ {
+ time: "2026-06-25T12:05:00Z",
+ scoreName: "helpfulness",
+ count: 2,
+ },
+ ]),
+ };
+ const caller = createCaller(mockPrisma);
+
+ const rows = await caller.traceLevelEvalExecutionsTimeSeries({
+ projectId,
+ fromTimestamp: new Date("2026-06-25T12:00:00Z"),
+ toTimestamp: new Date("2026-06-25T13:00:00Z"),
+ granularity: "auto",
+ });
+
+ expect(rows).toHaveLength(122);
+ expect(rows.slice(0, 4)).toEqual([
+ {
+ time: "2026-06-25T12:00:00Z",
+ scoreName: "helpfulness",
+ count: 0,
+ },
+ {
+ time: "2026-06-25T12:00:00Z",
+ scoreName: "toxicity",
+ count: 4,
+ },
+ {
+ time: "2026-06-25T12:01:00Z",
+ scoreName: "helpfulness",
+ count: 0,
+ },
+ {
+ time: "2026-06-25T12:01:00Z",
+ scoreName: "toxicity",
+ count: 0,
+ },
+ ]);
+ expect(
+ rows.find(
+ (row) =>
+ row.time === "2026-06-25T12:05:00Z" &&
+ row.scoreName === "helpfulness",
+ ),
+ ).toEqual({
+ time: "2026-06-25T12:05:00Z",
+ scoreName: "helpfulness",
+ count: 2,
+ });
+ expect(rows.at(-1)).toEqual({
+ time: "2026-06-25T13:00:00Z",
+ scoreName: "toxicity",
+ count: 0,
+ });
+
+ expect(mockPrisma.$queryRaw).toHaveBeenCalledTimes(1);
+ const query = mockPrisma.$queryRaw.mock.calls[0]?.[0] as
+ | { sql?: string; text?: string; values?: unknown[] }
+ | undefined;
+ const queryText = query?.sql ?? query?.text ?? "";
+
+ expect(queryText).toContain("date_trunc(?, je.created_at)");
+ expect(queryText).toContain(
+ "INNER JOIN job_configurations jc ON jc.id = je.job_configuration_id",
+ );
+ expect(queryText).toContain("jc.score_name AS score_name");
+ expect(queryText).toContain('score_name AS "scoreName"');
+ expect(queryText).toContain("je.project_id = ?");
+ expect(queryText).toContain("jc.project_id = ?");
+ expect(queryText).toContain("jc.job_type = 'EVAL'");
+ expect(queryText).toContain("jc.target_object = ?");
+ expect(queryText).toContain("je.status != 'CANCELLED'");
+ expect(queryText).toContain("je.created_at >= ?");
+ expect(queryText).toContain("je.created_at <= ?");
+ expect(queryText).toContain("GROUP BY bucket_time, score_name");
+ expect(query?.values).toEqual([
+ "minute",
+ projectId,
+ projectId,
+ "trace",
+ new Date("2026-06-25T12:00:00Z"),
+ new Date("2026-06-25T13:00:00Z"),
+ ]);
+ });
});
diff --git a/web/src/features/v4/server/v4TransitionRouter.ts b/web/src/features/v4/server/v4TransitionRouter.ts
index 3ac4d103e4..34aeffc3dd 100644
--- a/web/src/features/v4/server/v4TransitionRouter.ts
+++ b/web/src/features/v4/server/v4TransitionRouter.ts
@@ -3,6 +3,10 @@ import {
createTRPCRouter,
protectedProjectProcedure,
} from "@/src/server/api/trpc";
+import {
+ AnalyticsIntegrationExportSource,
+ Prisma,
+} from "@langfuse/shared/src/db";
import {
convertDateToClickhouseDateTime,
queryClickhouse,
@@ -41,13 +45,261 @@ const getTimelineBucketSql = (
return `toStartOfInterval(${sql}, INTERVAL ${intervalByGranularity[granularity]}, 'UTC')`;
};
+const getPostgresTimelineBucketExpression = (
+ granularity: ResolvedTimelineGranularity,
+): Prisma.Sql => {
+ const precisionByGranularity: Record<ResolvedTimelineGranularity, string> = {
+ minute: "minute",
+ hour: "hour",
+ day: "day",
+ week: "week",
+ month: "month",
+ };
+
+ return Prisma.sql`date_trunc(${precisionByGranularity[granularity]}, je.created_at)`;
+};
+
+const startOfTimelineBucket = (
+ date: Date,
+ granularity: ResolvedTimelineGranularity,
+): Date => {
+ const bucket = new Date(date);
+
+ bucket.setUTCSeconds(0, 0);
+
+ if (granularity === "minute") return bucket;
+
+ bucket.setUTCMinutes(0, 0, 0);
+
+ if (granularity === "hour") return bucket;
+
+ bucket.setUTCHours(0, 0, 0, 0);
+
+ if (granularity === "day") return bucket;
+
+ if (granularity === "week") {
+ const daysSinceMonday = (bucket.getUTCDay() + 6) % 7;
+ bucket.setUTCDate(bucket.getUTCDate() - daysSinceMonday);
+ return bucket;
+ }
+
+ bucket.setUTCDate(1);
+ return bucket;
+};
+
+const incrementTimelineBucket = (
+ date: Date,
+ granularity: ResolvedTimelineGranularity,
+): Date => {
+ const next = new Date(date);
+
+ switch (granularity) {
+ case "minute":
+ next.setUTCMinutes(next.getUTCMinutes() + 1);
+ return next;
+ case "hour":
+ next.setUTCHours(next.getUTCHours() + 1);
+ return next;
+ case "day":
+ next.setUTCDate(next.getUTCDate() + 1);
+ return next;
+ case "week":
+ next.setUTCDate(next.getUTCDate() + 7);
+ return next;
+ case "month":
+ next.setUTCMonth(next.getUTCMonth() + 1);
+ return next;
+ }
+};
+
+const formatTimelineBucketTime = (date: Date): string =>
+ date.toISOString().replace(".000Z", "Z");
+
+const legacyIntegrationExportSources =
+ new Set<AnalyticsIntegrationExportSource>([
+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS,
+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS,
+ ]);
+
+const TRACE_EVAL_TARGET = "trace";
+
+const isLegacyIntegrationExportSource = (
+ exportSource: AnalyticsIntegrationExportSource | null | undefined,
+) => exportSource != null && legacyIntegrationExportSources.has(exportSource);
+
+const isEnabledLegacyIntegration = (
+ integration:
+ | { enabled: boolean; exportSource: AnalyticsIntegrationExportSource }
+ | null
+ | undefined,
+) =>
+ Boolean(
+ integration?.enabled &&
+ isLegacyIntegrationExportSource(integration.exportSource),
+ );
+
type LegacyApiUsageRow = {
time: string;
entrypoint: string;
count: string | number;
};
+type TraceLevelEvalExecutionTimeSeriesRow = {
+ time: string;
+ scoreName: string;
+ count: bigint | number;
+};
+
+type TraceLevelEvalExecutionTimeSeriesPoint = {
+ time: string;
+ scoreName: string;
+ count: number;
+};
+
+const fillTraceLevelEvalExecutionBuckets = ({
+ rows,
+ fromTimestamp,
+ toTimestamp,
+ granularity,
+}: {
+ rows: TraceLevelEvalExecutionTimeSeriesPoint[];
+ fromTimestamp: Date;
+ toTimestamp: Date;
+ granularity: ResolvedTimelineGranularity;
+}): TraceLevelEvalExecutionTimeSeriesPoint[] => {
+ const scoreNames = Array.from(
+ new Set(rows.map((row) => row.scoreName)),
+ ).sort();
+ if (scoreNames.length === 0) return [];
+
+ const counts = new Map(
+ rows.map(
+ (row) => [`${row.time}\u0000${row.scoreName}`, row.count] as const,
+ ),
+ );
+ const endBucket = startOfTimelineBucket(toTimestamp, granularity);
+ const filledRows: TraceLevelEvalExecutionTimeSeriesPoint[] = [];
+
+ for (
+ let bucket = startOfTimelineBucket(fromTimestamp, granularity);
+ bucket.getTime() <= endBucket.getTime();
+ bucket = incrementTimelineBucket(bucket, granularity)
+ ) {
+ const time = formatTimelineBucketTime(bucket);
+
+ for (const scoreName of scoreNames) {
+ filledRows.push({
+ time,
+ scoreName,
+ count: counts.get(`${time}\u0000${scoreName}`) ?? 0,
+ });
+ }
+ }
+
+ return filledRows;
+};
+
export const v4TransitionRouter = createTRPCRouter({
+ summary: protectedProjectProcedure
+ .input(z.object({ projectId: z.string() }))
+ .query(async ({ input, ctx }) => {
+ const [
+ traceLevelEvalCount,
+ posthogIntegration,
+ mixpanelIntegration,
+ blobStorageIntegration,
+ ] = await Promise.all([
+ ctx.prisma.jobConfiguration.count({
+ where: {
+ projectId: input.projectId,
+ jobType: "EVAL",
+ targetObject: TRACE_EVAL_TARGET,
+ },
+ }),
+ ctx.prisma.posthogIntegration.findUnique({
+ where: { projectId: input.projectId },
+ select: { enabled: true, exportSource: true },
+ }),
+ ctx.prisma.mixpanelIntegration.findUnique({
+ where: { projectId: input.projectId },
+ select: { enabled: true, exportSource: true },
+ }),
+ ctx.prisma.blobStorageIntegration.findUnique({
+ where: { projectId: input.projectId },
+ select: { enabled: true, exportSource: true },
+ }),
+ ]);
+
+ const legacyIntegrations = {
+ posthog: isEnabledLegacyIntegration(posthogIntegration),
+ mixpanel: isEnabledLegacyIntegration(mixpanelIntegration),
+ blobStorage: isEnabledLegacyIntegration(blobStorageIntegration),
+ };
+
+ return {
+ traceLevelEvalCount,
+ legacyIntegrationCount:
+ Object.values(legacyIntegrations).filter(Boolean).length,
+ legacyIntegrations,
+ };
+ }),
+
+ traceLevelEvalExecutionsTimeSeries: protectedProjectProcedure
+ .input(
+ z.object({
+ projectId: z.string(),
+ fromTimestamp: z.date(),
+ toTimestamp: z.date(),
+ granularity: timelineGranularity.default("auto"),
+ }),
+ )
+ .query(async ({ input, ctx }) => {
+ const granularity = resolveTimelineGranularity(
+ input.fromTimestamp,
+ input.toTimestamp,
+ );
+ const bucketExpression = getPostgresTimelineBucketExpression(granularity);
+
+ const rows = await ctx.prisma.$queryRaw<
+ TraceLevelEvalExecutionTimeSeriesRow[]
+ >(Prisma.sql`
+WITH selected AS (
+ SELECT
+ ${bucketExpression} AS bucket_time,
+ jc.score_name AS score_name
+ FROM job_executions je
+ INNER JOIN job_configurations jc ON jc.id = je.job_configuration_id
+ AND jc.project_id = je.project_id
+ WHERE je.project_id = ${input.projectId}
+ AND jc.project_id = ${input.projectId}
+ AND jc.job_type = 'EVAL'
+ AND jc.target_object = ${TRACE_EVAL_TARGET}
+ AND je.status != 'CANCELLED'
+ AND je.created_at >= ${input.fromTimestamp}
+ AND je.created_at <= ${input.toTimestamp}
+)
+
+SELECT
+ to_char(bucket_time, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS time,
+ score_name AS "scoreName",
+ COUNT(*)::bigint AS count
+FROM selected
+GROUP BY bucket_time, score_name
+ORDER BY bucket_time ASC, score_name ASC
+ `);
+
+ return fillTraceLevelEvalExecutionBuckets({
+ rows: rows.map((row) => ({
+ time: row.time,
+ scoreName: row.scoreName,
+ count: Number(row.count),
+ })),
+ fromTimestamp: input.fromTimestamp,
+ toTimestamp: input.toTimestamp,
+ granularity,
+ });
+ }),
+
timeSeriesByEntrypoint: protectedProjectProcedure
.input(
z.object({
@@ -139,6 +391,7 @@ WHERE legacy_route IS NOT NULL
AND clickhouse_queries_per_api_call IS NOT NULL
GROUP BY bucket_time, legacy_route
ORDER BY bucket_time ASC, legacy_route ASC
+SETTINGS skip_unavailable_shards = 1
`,
params: {
projectId: input.projectId,
diff --git a/web/src/pages/project/[projectId]/v4/index.tsx b/web/src/pages/project/[projectId]/v4/index.tsx
index 85cc365e27..70d060c0c0 100644
--- a/web/src/pages/project/[projectId]/v4/index.tsx
+++ b/web/src/pages/project/[projectId]/v4/index.tsx
@@ -1,19 +1,24 @@
import { useMemo } from "react";
+import type { ReactNode } from "react";
import { useRouter } from "next/router";
-import { ExternalLink } from "lucide-react";
+import Link from "next/link";
+import { ArrowRight, ExternalLink } from "lucide-react";
import Page from "@/src/components/layouts/page";
import { TimeRangePicker } from "@/src/components/date-picker";
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { Chart } from "@/src/features/widgets/chart-library/Chart";
+import { Button } from "@/src/components/ui/button";
import {
DASHBOARD_AGGREGATION_OPTIONS,
toAbsoluteTimeRange,
} from "@/src/utils/date-range-utils";
import { useDashboardDateRange } from "@/src/hooks/useDashboardDateRange";
import { api } from "@/src/utils/api";
+import { encodeFiltersGeneric } from "@/src/features/filters/lib/filter-query-encoding";
+import { numberFormatter } from "@/src/utils/numbers";
-const UPGRADE_DOCS = [
+const PUBLIC_API_DOCS = [
{
label: "V4 upgrade guide",
href: "https://langfuse.com/docs/v4",
@@ -28,6 +33,60 @@ const UPGRADE_DOCS = [
},
] as const;
+const INTEGRATION_LINKS = [
+ {
+ key: "posthog",
+ label: "PostHog",
+ path: "posthog",
+ },
+ {
+ key: "mixpanel",
+ label: "Mixpanel",
+ path: "mixpanel",
+ },
+ {
+ key: "blobStorage",
+ label: "Blob Storage",
+ path: "blobstorage",
+ },
+] as const;
+
+const CardError = ({ children }: { children: string }) => (
+ <div className="border-destructive/30 bg-destructive/10 text-destructive flex min-h-28 items-center rounded-md border p-4 text-sm">
+ {children}
+ </div>
+);
+
+const ProductLinkButton = ({
+ href,
+ children,
+}: {
+ href: string | { pathname: string; query: Record<string, string> };
+ children: ReactNode;
+}) => (
+ <Button asChild variant="outline" size="sm">
+ <Link href={href}>
+ {children}
+ <ArrowRight className="ml-1 h-3.5 w-3.5" />
+ </Link>
+ </Button>
+);
+
+const ExternalDocButton = ({
+ href,
+ children,
+}: {
+ href: string;
+ children: ReactNode;
+}) => (
+ <Button asChild variant="outline" size="sm">
+ <a href={href} target="_blank" rel="noopener noreferrer">
+ {children}
+ <ExternalLink className="ml-1 h-3.5 w-3.5" />
+ </a>
+ </Button>
+);
+
export default function V4Page() {
const router = useRouter();
const projectId = router.query.projectId as string | undefined;
@@ -59,6 +118,60 @@ export default function V4Page() {
},
);
+ const summary = api.v4Transition.summary.useQuery(
+ {
+ projectId: projectId ?? "",
+ },
+ {
+ enabled: Boolean(projectId),
+ },
+ );
+
+ const traceLevelEvalExecutions =
+ api.v4Transition.traceLevelEvalExecutionsTimeSeries.useQuery(
+ {
+ projectId: projectId ?? "",
+ fromTimestamp: absoluteTimeRange.from,
+ toTimestamp: absoluteTimeRange.to,
+ granularity: "auto",
+ },
+ {
+ enabled: Boolean(projectId),
+ },
+ );
+
+ const traceLevelEvalsHref = useMemo(
+ () => ({
+ pathname: `/project/${projectId}/evals`,
+ query: {
+ filter: encodeFiltersGeneric([
+ {
+ column: "target",
+ type: "stringOptions",
+ operator: "any of",
+ value: ["trace"],
+ },
+ ]),
+ },
+ }),
+ [projectId],
+ );
+
+ const legacyIntegrationLinks = useMemo(
+ () =>
+ INTEGRATION_LINKS.filter(
+ (link) =>
+ summary.data?.legacyIntegrations[link.key] === true &&
+ Boolean(projectId),
+ ).map((link) => ({
+ ...link,
+ href: `/project/${projectId}/settings/integrations/${link.path}`,
+ })),
+ [projectId, summary.data?.legacyIntegrations],
+ );
+
+ const integrationsHref = `/project/${projectId}/settings/integrations`;
+
const chartData = useMemo(
() =>
legacyApiUsage.data?.map((row) => ({
@@ -69,6 +182,16 @@ export default function V4Page() {
[legacyApiUsage.data],
);
+ const evalExecutionChartData = useMemo(
+ () =>
+ traceLevelEvalExecutions.data?.map((row) => ({
+ time_dimension: row.time,
+ dimension: row.scoreName,
+ metric: row.count,
+ })) ?? [],
+ [traceLevelEvalExecutions.data],
+ );
+
return (
<Page
withPadding
@@ -87,58 +210,143 @@ export default function V4Page() {
}}
>
<div className="mx-auto flex w-full max-w-screen-xl flex-col gap-3">
- <section className="flex flex-col gap-2">
- <h4 className="text-base font-semibold">legacy api usage</h4>
- <div className="flex flex-wrap gap-2">
- {UPGRADE_DOCS.map((doc) => (
- <a
- key={doc.href}
- href={doc.href}
- target="_blank"
- rel="noopener noreferrer"
- className="border-border hover:bg-muted inline-flex h-8 items-center gap-1 rounded-md border px-2 text-sm"
- >
- {doc.label}
- <ExternalLink className="h-3.5 w-3.5" />
- </a>
- ))}
- </div>
- <p className="text-muted-foreground text-sm">
- We do not have query-log data for GET /api/public/sessions because
- that endpoint does not execute ClickHouse queries.
- </p>
- </section>
+ <div className="grid grid-cols-1 items-stretch gap-3 lg:grid-cols-[minmax(0,2fr)_minmax(20rem,1fr)]">
+ <DashboardCard
+ title="Trace-level evals"
+ description="Trace-targeting evaluator configs and non-cancelled execution jobs by generated score name."
+ isLoading={summary.isPending || traceLevelEvalExecutions.isPending}
+ cardContentClassName="min-h-[30rem]"
+ headerClassName="pr-12"
+ headerRight={
+ <ProductLinkButton href={traceLevelEvalsHref}>
+ View evals
+ </ProductLinkButton>
+ }
+ >
+ <div className="flex flex-col gap-4">
+ {summary.error ? (
+ <CardError>Failed to load trace-level evals.</CardError>
+ ) : (
+ <div>
+ <p className="text-muted-foreground text-sm">
+ Configured trace-level evals
+ </p>
+ <div className="text-4xl font-semibold">
+ {numberFormatter(summary.data?.traceLevelEvalCount ?? 0, 0)}
+ </div>
+ </div>
+ )}
+
+ {traceLevelEvalExecutions.error ? (
+ <CardError>
+ Failed to load trace-level eval executions.
+ </CardError>
+ ) : evalExecutionChartData.length > 0 ? (
+ <div className="h-[22rem] w-full">
+ <Chart
+ chartType="BAR_TIME_SERIES"
+ data={evalExecutionChartData}
+ rowLimit={1_000}
+ chartConfig={{
+ type: "BAR_TIME_SERIES",
+ unit: "short",
+ }}
+ overrideWarning
+ />
+ </div>
+ ) : (
+ <NoDataOrLoading
+ isLoading={traceLevelEvalExecutions.isPending}
+ description="No trace-level eval executions were found for this project in the selected time range."
+ className="min-h-[22rem]"
+ />
+ )}
+ </div>
+ </DashboardCard>
+
+ <DashboardCard
+ title="Integrations"
+ description="PostHog, Mixpanel, and Blob Storage exports that need review for V4."
+ isLoading={summary.isPending}
+ >
+ {summary.error ? (
+ <CardError>Failed to load integrations.</CardError>
+ ) : (
+ <div className="flex min-h-32 flex-col gap-4">
+ <div>
+ <p className="text-muted-foreground text-sm">
+ Configured integrations to review
+ </p>
+ <div className="text-4xl font-semibold">
+ {numberFormatter(
+ summary.data?.legacyIntegrationCount ?? 0,
+ 0,
+ )}
+ </div>
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <ProductLinkButton href={integrationsHref}>
+ View integrations
+ </ProductLinkButton>
+ {legacyIntegrationLinks.length > 0
+ ? legacyIntegrationLinks.map((link) => (
+ <ProductLinkButton key={link.key} href={link.href}>
+ {link.label}
+ </ProductLinkButton>
+ ))
+ : null}
+ </div>
+ </div>
+ )}
+ </DashboardCard>
+ </div>
<DashboardCard
- title="Legacy API usage by entrypoint over time"
- description="Estimates ClickHouse-backed legacy public API calls for this project."
+ title="Public API calls to review"
+ description="ClickHouse-backed public API calls that may need changes for V4."
isLoading={legacyApiUsage.isPending}
cardContentClassName="min-h-[32rem]"
+ headerClassName="pr-12"
>
{legacyApiUsage.error ? (
<div className="border-destructive/30 bg-destructive/10 text-destructive flex min-h-36 items-center rounded-md border p-4 text-sm">
- Failed to load legacy API usage.
- </div>
- ) : chartData.length > 0 ? (
- <div className="h-[30rem] w-full">
- <Chart
- chartType="BAR_TIME_SERIES"
- data={chartData}
- rowLimit={1_000}
- chartConfig={{
- type: "BAR_TIME_SERIES",
- unit: "short",
- }}
- overrideWarning
- />
+ Failed to load public API usage.
</div>
) : (
- <NoDataOrLoading
- isLoading={legacyApiUsage.isPending}
- description="No ClickHouse-backed legacy public API usage was found for this project in the selected time range."
- href="https://langfuse.com/docs/v4"
- className="min-h-[30rem]"
- />
+ <>
+ <div className="flex flex-wrap gap-2">
+ {PUBLIC_API_DOCS.map((doc) => (
+ <ExternalDocButton key={doc.href} href={doc.href}>
+ {doc.label}
+ </ExternalDocButton>
+ ))}
+ </div>
+ <p className="text-muted-foreground text-sm">
+ We do not have query-log data for GET /api/public/sessions.
+ </p>
+
+ {chartData.length > 0 ? (
+ <div className="h-[30rem] w-full">
+ <Chart
+ chartType="BAR_TIME_SERIES"
+ data={chartData}
+ rowLimit={1_000}
+ chartConfig={{
+ type: "BAR_TIME_SERIES",
+ unit: "short",
+ }}
+ overrideWarning
+ />
+ </div>
+ ) : (
+ <NoDataOrLoading
+ isLoading={legacyApiUsage.isPending}
+ description="No ClickHouse-backed public API usage was found for this project in the selected time range."
+ className="min-h-[30rem]"
+ />
+ )}
+ </>
)}
</DashboardCard>
</div>