Skip to content

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

Add dashboard product education (#367)

Max Deichmanndf5950917d04
diff --git a/package-lock.json b/package-lock.json
index 49c2d4bb9c..d0dda10ad0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,6 +22,7 @@
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
+ "@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
@@ -2417,6 +2418,37 @@
}
}
},
+ "node_modules/@radix-ui/react-hover-card": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.0.7.tgz",
+ "integrity": "sha512-OcUN2FU0YpmajD/qkph3XzMcK/NmSk9hGWnjV68p6QiZMgILugusgQwnLSDs3oFSJYGKf3Y49zgFedhGh04k9A==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/primitive": "1.0.1",
+ "@radix-ui/react-compose-refs": "1.0.1",
+ "@radix-ui/react-context": "1.0.1",
+ "@radix-ui/react-dismissable-layer": "1.0.5",
+ "@radix-ui/react-popper": "1.1.3",
+ "@radix-ui/react-portal": "1.0.4",
+ "@radix-ui/react-presence": "1.0.1",
+ "@radix-ui/react-primitive": "1.0.3",
+ "@radix-ui/react-use-controllable-state": "1.0.1"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-icons": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.0.tgz",
diff --git a/package.json b/package.json
index 0686a555b9..92e03031ce 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
+ "@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
diff --git a/src/components/layouts/doc-popup.tsx b/src/components/layouts/doc-popup.tsx
new file mode 100644
index 0000000000..dd8a3de3d4
--- /dev/null
+++ b/src/components/layouts/doc-popup.tsx
@@ -0,0 +1,49 @@
+import {
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from "@/src/components/ui/hover-card";
+import { HelpCircle } from "lucide-react";
+import Link from "next/link";
+
+export type DocPopupProps = {
+ description: React.ReactNode;
+ link: string;
+ size?: "sm" | "md" | "lg";
+};
+
+export default function DocPopup({ description, link, size }: DocPopupProps) {
+ let sizeClass = "w-4 h-4";
+ switch (size) {
+ case "sm": {
+ sizeClass = "w-4 h-4";
+ }
+ case "md": {
+ sizeClass = "w-6 h-6";
+ }
+ case "lg": {
+ sizeClass = "w-8 h-8";
+ }
+ }
+
+ return (
+ <HoverCard openDelay={200}>
+ <HoverCardTrigger className="mx-2 cursor-pointer">
+ <Link href={link} rel="noopener" target="_blank">
+ <div className="whitespace-nowrap text-gray-500 sm:pl-0">
+ <HelpCircle className={sizeClass} />
+ </div>
+ </Link>
+ </HoverCardTrigger>
+ <HoverCardContent>
+ {typeof description === "string" ? (
+ <div className="whitespace-break-spaces text-xs font-normal text-gray-800 sm:pl-0">
+ {description}
+ </div>
+ ) : (
+ description
+ )}
+ </HoverCardContent>
+ </HoverCard>
+ );
+}
diff --git a/src/components/ui/hover-card.tsx b/src/components/ui/hover-card.tsx
new file mode 100644
index 0000000000..b14e2c46a9
--- /dev/null
+++ b/src/components/ui/hover-card.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+import * as React from "react";
+import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
+
+import { cn } from "@/src/utils/tailwind";
+
+const HoverCard = HoverCardPrimitive.Root;
+
+const HoverCardTrigger = HoverCardPrimitive.Trigger;
+
+const HoverCardContent = React.forwardRef<
+ React.ElementRef<typeof HoverCardPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
+ <HoverCardPrimitive.Content
+ ref={ref}
+ align={align}
+ sideOffset={sideOffset}
+ className={cn(
+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ className,
+ )}
+ {...props}
+ />
+));
+HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
+
+export { HoverCard, HoverCardTrigger, HoverCardContent };
diff --git a/src/features/dashboard/components/ChartScores.tsx b/src/features/dashboard/components/ChartScores.tsx
index 74a9af3720..e92ea48153 100644
--- a/src/features/dashboard/components/ChartScores.tsx
+++ b/src/features/dashboard/components/ChartScores.tsx
@@ -9,7 +9,10 @@ import { type FilterState } from "@/src/features/filters/types";
import {
extractTimeSeriesData,
fillMissingValuesAndTransform,
+ isEmptyTimeSeries,
} from "@/src/features/dashboard/components/hooks";
+import { NoData } from "@/src/features/dashboard/components/NoData";
+import DocPopup from "@/src/components/layouts/doc-popup";
export function ChartScores(props: {
className?: string;
@@ -53,14 +56,23 @@ export function ChartScores(props: {
<DashboardCard
className={props.className}
title="Scores"
- description="Average"
+ description="Average score per name"
isLoading={scores.isLoading}
>
- <BaseTimeSeriesChart
- agg={props.agg}
- data={extractedScores ?? []}
- connectNulls
- />
+ {!isEmptyTimeSeries(extractedScores) ? (
+ <BaseTimeSeriesChart
+ agg={props.agg}
+ data={extractedScores ?? []}
+ connectNulls
+ />
+ ) : (
+ <NoData noDataText="No data">
+ <DocPopup
+ description="Scores evaluate LLM quality and can be created manually or using the SDK."
+ link="https://langfuse.com/docs/scores"
+ />
+ </NoData>
+ )}
</DashboardCard>
);
}
diff --git a/src/features/dashboard/components/LatencyChart.tsx b/src/features/dashboard/components/LatencyChart.tsx
index c6e621529c..6d5f52af41 100644
--- a/src/features/dashboard/components/LatencyChart.tsx
+++ b/src/features/dashboard/components/LatencyChart.tsx
@@ -8,11 +8,13 @@ import {
getAllModels,
extractTimeSeriesData,
fillMissingValuesAndTransform,
+ isEmptyTimeSeries,
} from "@/src/features/dashboard/components/hooks";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";
import { numberFormatter } from "@/src/utils/numbers";
+import { NoData } from "@/src/features/dashboard/components/NoData";
export const LatencyChart = ({
className,
@@ -94,12 +96,18 @@ export const LatencyChart = ({
return {
tabTitle: item.tabTitle,
content: (
- <BaseTimeSeriesChart
- agg={agg}
- data={item.data}
- connectNulls={true}
- valueFormatter={numberFormatter}
- />
+ <>
+ {!isEmptyTimeSeries(item.data) ? (
+ <BaseTimeSeriesChart
+ agg={agg}
+ data={item.data}
+ connectNulls={true}
+ valueFormatter={numberFormatter}
+ />
+ ) : (
+ <NoData noDataText="No data" />
+ )}
+ </>
),
};
})}
diff --git a/src/features/dashboard/components/MetricTable.tsx b/src/features/dashboard/components/MetricTable.tsx
index f73edc54fa..b5a34cfffb 100644
--- a/src/features/dashboard/components/MetricTable.tsx
+++ b/src/features/dashboard/components/MetricTable.tsx
@@ -5,6 +5,7 @@ import { compactNumberFormatter, usdFormatter } from "@/src/utils/numbers";
import { DashboardTable } from "@/src/features/dashboard/components/cards/DashboardTable";
import { RightAlignedCell } from "@/src/features/dashboard/components/RightAlignedCell";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
+import DocPopup from "@/src/components/layouts/doc-popup";
export const MetricTable = ({
className,
@@ -75,7 +76,12 @@ export const MetricTable = ({
<TotalMetric
metric={totalTokens ? usdFormatter(totalTokens) : "$0"}
description="Total cost"
- />
+ >
+ <DocPopup
+ description="Calculated multiplying the number of tokens with cost per token for each model."
+ link="https://langfuse.com/docs/token-usage"
+ />
+ </TotalMetric>
</DashboardTable>
</DashboardCard>
);
diff --git a/src/features/dashboard/components/ModelUsageChart.tsx b/src/features/dashboard/components/ModelUsageChart.tsx
index 3ee93b8888..039e8a6d9b 100644
--- a/src/features/dashboard/components/ModelUsageChart.tsx
+++ b/src/features/dashboard/components/ModelUsageChart.tsx
@@ -10,12 +10,14 @@ import {
getAllModels,
extractTimeSeriesData,
fillMissingValuesAndTransform,
+ isEmptyTimeSeries,
} from "@/src/features/dashboard/components/hooks";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { compactNumberFormatter, usdFormatter } from "@/src/utils/numbers";
import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";
import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
+import { NoData } from "@/src/features/dashboard/components/NoData";
export const ModelUsageChart = ({
className,
@@ -115,12 +117,16 @@ export const ModelUsageChart = ({
metric={item.totalMetric}
description={item.metricDescription}
/>
- <BaseTimeSeriesChart
- agg={agg}
- data={item.data}
- showLegend={true}
- valueFormatter={item.formatter}
- />
+ {!isEmptyTimeSeries(item.data) ? (
+ <BaseTimeSeriesChart
+ agg={agg}
+ data={item.data}
+ showLegend={true}
+ valueFormatter={item.formatter}
+ />
+ ) : (
+ <NoData noDataText="No data available" />
+ )}
</>
),
};
diff --git a/src/features/dashboard/components/NoData.tsx b/src/features/dashboard/components/NoData.tsx
index af5b0058f2..cdecb6c65d 100644
--- a/src/features/dashboard/components/NoData.tsx
+++ b/src/features/dashboard/components/NoData.tsx
@@ -1,16 +1,27 @@
+import { cn } from "@/src/utils/tailwind";
import { Flex, Text } from "@tremor/react";
interface NoDataProps {
noDataText?: string;
+ children?: React.ReactNode;
+ className?: string;
}
-export const NoData = ({ noDataText = "No data" }: NoDataProps) => {
+export const NoData = ({
+ noDataText = "No data",
+ children,
+ className,
+}: NoDataProps) => {
return (
<Flex
alignItems="center"
justifyContent="center"
- className="mt-5 min-h-[9rem] w-full rounded-tremor-default border border-dashed border-tremor-border"
+ className={cn(
+ className,
+ "min-h-[9rem] w-full flex-1 rounded-tremor-default border border-dashed border-tremor-border",
+ )}
>
<Text className="text-tremor-content">{noDataText}</Text>
+ {children}
</Flex>
);
};
diff --git a/src/features/dashboard/components/ScoresTable.tsx b/src/features/dashboard/components/ScoresTable.tsx
index c98c8e1f00..9551c08092 100644
--- a/src/features/dashboard/components/ScoresTable.tsx
+++ b/src/features/dashboard/components/ScoresTable.tsx
@@ -6,6 +6,7 @@ import { DashboardTable } from "@/src/features/dashboard/components/cards/Dashbo
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { NoData } from "@/src/features/dashboard/components/NoData";
import { RightAlignedCell } from "./RightAlignedCell";
+import DocPopup from "@/src/components/layouts/doc-popup";
export const ScoresTable = ({
className,
@@ -133,6 +134,13 @@ export const ScoresTable = ({
]) ?? []
}
collapse={{ collapsed: 5, expanded: 20 }}
+ noDataChildren={
+ <DocPopup
+ description="Scores evaluate LLM quality and can be created manually or using the SDK."
+ link="https://langfuse.com/docs/scores"
+ />
+ }
+ noDataClassName="mt-0"
>
<TotalMetric
metric={totalScores ? compactNumberFormatter(totalScores) : "0"}
diff --git a/src/features/dashboard/components/TotalMetric.tsx b/src/features/dashboard/components/TotalMetric.tsx
index d5104a3023..6bb9138bcf 100644
--- a/src/features/dashboard/components/TotalMetric.tsx
+++ b/src/features/dashboard/components/TotalMetric.tsx
@@ -6,10 +6,12 @@ export const TotalMetric = ({
className,
metric,
description,
+ children,
}: {
className?: string;
metric: ReactNode;
description?: ReactNode;
+ children?: ReactNode;
}) => {
return (
<Flex
@@ -19,6 +21,7 @@ export const TotalMetric = ({
>
<Metric>{metric}</Metric>
<Text>{description}</Text>
+ {children}
</Flex>
);
};
diff --git a/src/features/dashboard/components/TracesChart.tsx b/src/features/dashboard/components/TracesBarListChart.tsx
similarity index 58%
rename from src/features/dashboard/components/TracesChart.tsx
rename to src/features/dashboard/components/TracesBarListChart.tsx
index 00784cce1c..38dc1007fd 100644
--- a/src/features/dashboard/components/TracesChart.tsx
+++ b/src/features/dashboard/components/TracesBarListChart.tsx
@@ -1,8 +1,12 @@
import { api } from "@/src/utils/api";
import { type FilterState } from "@/src/features/filters/types";
-import BarChartCard from "@/src/features/dashboard/components/cards/BarChartCard";
import { ExpandListButton } from "@/src/features/dashboard/components/cards/ChevronButton";
import { useState } from "react";
+import DocPopup from "@/src/components/layouts/doc-popup";
+import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
+import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
+import { BarList } from "@tremor/react";
+import { NoData } from "@/src/features/dashboard/components/NoData";
export const TracesBarListChart = ({
className,
@@ -51,21 +55,37 @@ export const TracesBarListChart = ({
: transformedTraces.slice(0, maxNumberOfEntries.collapsed);
return (
- <>
- <BarChartCard
- className={className}
- header={{
- metric: "Total traces tracked",
- stat: (totalTraces.data?.[0]?.countTraceId as number) ?? 0,
- category: "Traces",
- }}
- isLoading={traces.isLoading || totalTraces.isLoading}
- chart={{
- data: adjustedData,
- header: "Trace Name",
- metric: "Count",
- }}
- >
+ <DashboardCard
+ className={className}
+ title={"Traces"}
+ description={null}
+ isLoading={traces.isLoading || totalTraces.isLoading}
+ >
+ <>
+ <TotalMetric
+ metric={(totalTraces.data?.[0]?.countTraceId as number) ?? 0}
+ description={"Total traces tracked"}
+ />
+ {adjustedData.length > 0 ? (
+ <>
+ <BarList
+ data={adjustedData}
+ valueFormatter={(number: number) =>
+ Intl.NumberFormat("us").format(number).toString()
+ }
+ className="mt-6"
+ showAnimation={true}
+ color={"indigo"}
+ />
+ </>
+ ) : (
+ <NoData noDataText="No data">
+ <DocPopup
+ description="Traces contain details about LLM applications and can be created using the SDK."
+ link="https://langfuse.com/docs/integrations/sdk#1-backend-tracing"
+ />
+ </NoData>
+ )}
<ExpandListButton
isExpanded={isExpanded}
setExpanded={setIsExpanded}
@@ -77,7 +97,7 @@ export const TracesBarListChart = ({
: "Show all"
}
/>
- </BarChartCard>
- </>
+ </>
+ </DashboardCard>
);
};
diff --git a/src/features/dashboard/components/TracesTimeSeriesChart.tsx b/src/features/dashboard/components/TracesTimeSeriesChart.tsx
index ed18f6139a..bd34009ed0 100644
--- a/src/features/dashboard/components/TracesTimeSeriesChart.tsx
+++ b/src/features/dashboard/components/TracesTimeSeriesChart.tsx
@@ -8,6 +8,9 @@ import { DashboardCard } from "@/src/features/dashboard/components/cards/Dashboa
import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
import { compactNumberFormatter } from "@/src/utils/numbers";
+import DocPopup from "@/src/components/layouts/doc-popup";
+import { isEmptyTimeSeries } from "@/src/features/dashboard/components/hooks";
+import { NoData } from "@/src/features/dashboard/components/NoData";
export const TracesTimeSeriesChart = ({
className,
@@ -58,6 +61,8 @@ export const TracesTimeSeriesChart = ({
return acc + (item.countTraceId as number);
}, 0);
+ console.log("traces", transformedTraces);
+
return (
<DashboardCard
className={className}
@@ -69,12 +74,21 @@ export const TracesTimeSeriesChart = ({
description={`Traces tracked`}
metric={total ? compactNumberFormatter(total) : "-"}
/>
- <BaseTimeSeriesChart
- className="min-h-80 lg:h-full"
- agg={agg}
- data={transformedTraces ?? []}
- connectNulls={true}
- />
+ {!isEmptyTimeSeries(transformedTraces) ? (
+ <BaseTimeSeriesChart
+ className="min-h-80 h-full self-stretch"
+ agg={agg}
+ data={transformedTraces ?? []}
+ connectNulls={true}
+ />
+ ) : (
+ <NoData noDataText="No data available">
+ <DocPopup
+ description="Traces contain details about LLM applications and can be created using the SDK."
+ link="https://langfuse.com/docs/integrations/sdk#1-backend-tracing"
+ />
+ </NoData>
+ )}
</DashboardCard>
);
};
diff --git a/src/features/dashboard/components/UserChart.tsx b/src/features/dashboard/components/UserChart.tsx
index ee485a2c0d..02037370f1 100644
--- a/src/features/dashboard/components/UserChart.tsx
+++ b/src/features/dashboard/components/UserChart.tsx
@@ -6,10 +6,16 @@ import { compactNumberFormatter, usdFormatter } from "@/src/utils/numbers";
import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";
import { BarList } from "@tremor/react";
import { isNotUndefinedOrNull } from "@/src/utils/types";
-import { type BarChartDataPoint } from "@/src/features/dashboard/components/cards/BarChartCard";
import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
import { ExpandListButton } from "@/src/features/dashboard/components/cards/ChevronButton";
import { useState } from "react";
+import DocPopup from "@/src/components/layouts/doc-popup";
+import { NoData } from "@/src/features/dashboard/components/NoData";
+
+type BarChartDataPoint = {
+ name: string;
+ value: number;
+};
export const UserChart = ({
className,
@@ -116,7 +122,7 @@ export const UserChart = ({
return (
<DashboardCard
className={className}
- title={"User consumption"}
+ title="User consumption"
isLoading={user.isLoading}
>
<TabComponent
@@ -125,17 +131,28 @@ export const UserChart = ({
tabTitle: item.tabTitle,
content: (
<>
- <TotalMetric
- metric={item.totalMetric}
- description={item.metricDescription}
- />
- <BarList
- data={item.data}
- valueFormatter={item.formatter}
- className="mt-2"
- showAnimation={true}
- color={"indigo"}
- />
+ {item.data.length > 0 ? (
+ <>
+ <TotalMetric
+ metric={item.totalMetric}
+ description={item.metricDescription}
+ />
+ <BarList
+ data={item.data}
+ valueFormatter={item.formatter}
+ className="mt-2"
+ showAnimation={true}
+ color={"indigo"}
+ />
+ </>
+ ) : (
+ <NoData noDataText="No data">
+ <DocPopup
+ description="Consumption per user is tracked by passing their ids on traces."
+ link="https://langfuse.com/docs/user-explorer"
+ />
+ </NoData>
+ )}
</>
),
};
diff --git a/src/features/dashboard/components/cards/BarChartCard.tsx b/src/features/dashboard/components/cards/BarChartCard.tsx
deleted file mode 100644
index f9d468aa10..0000000000
--- a/src/features/dashboard/components/cards/BarChartCard.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
-import { NoData } from "@/src/features/dashboard/components/NoData";
-import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
-import { compactNumberFormatter } from "@/src/utils/numbers";
-import { BarList } from "@tremor/react";
-
-export type BarChartDataPoint = {
- name: string;
- value: number;
-};
-
-interface BarChartCardProps {
- children?: React.ReactNode;
- className?: string;
- isLoading: boolean;
- header: {
- metric: string;
- stat: number;
- category: string;
- };
- chart: {
- data: BarChartDataPoint[];
- header: string;
- metric: string;
- };
-}
-
-export default function BarChartCard({
- className,
- header,
- chart,
- isLoading,
- children,
-}: BarChartCardProps) {
- const stat = header.stat ? compactNumberFormatter(header.stat) : "0";
- return (
- <DashboardCard
- className={className}
- title={header.category}
- description={null}
- isLoading={isLoading}
- >
- <>
- <TotalMetric metric={stat} description={header.metric} />
- {chart.data.length > 0 ? (
- <>
- <BarList
- data={chart.data}
- valueFormatter={(number: number) =>
- Intl.NumberFormat("us").format(number).toString()
- }
- className="mt-6"
- showAnimation={true}
- color={"indigo"}
- />
- </>
- ) : (
- <NoData noDataText="No data" />
- )}
- {children}
- </>
- </DashboardCard>
- );
-}
diff --git a/src/features/dashboard/components/cards/DashboardCard.tsx b/src/features/dashboard/components/cards/DashboardCard.tsx
index dbdfa1dfc2..0077432669 100644
--- a/src/features/dashboard/components/cards/DashboardCard.tsx
+++ b/src/features/dashboard/components/cards/DashboardCard.tsx
@@ -42,7 +42,9 @@ export const DashboardCard = ({
</div>
) : null}
</CardHeader>
- <CardContent className={cn("flex-1", cardContentClassName)}>
+ <CardContent
+ className={cn("flex flex-1 flex-col gap-4", cardContentClassName)}
+ >
{children}
</CardContent>
</Card>
diff --git a/src/features/dashboard/components/cards/DashboardTable.tsx b/src/features/dashboard/components/cards/DashboardTable.tsx
index fe08da698b..d03ff50a37 100644
--- a/src/features/dashboard/components/cards/DashboardTable.tsx
+++ b/src/features/dashboard/components/cards/DashboardTable.tsx
@@ -12,6 +12,8 @@ type DashboardTableProps = {
collapsed: number;
expanded: number;
};
+ noDataChildren?: ReactNode;
+ noDataClassName?: string;
};
export const DashboardTable = ({
@@ -19,6 +21,8 @@ export const DashboardTable = ({
rows,
children,
collapse,
+ noDataChildren,
+ noDataClassName,
}: DashboardTableProps) => {
const [isExpanded, setExpanded] = useState(false);
return (
@@ -84,7 +88,9 @@ export const DashboardTable = ({
) : null}
</div>
) : (
- <NoData noDataText="No data" />
+ <NoData className={noDataClassName} noDataText="No data">
+ {noDataChildren}
+ </NoData>
)}
</>
);
diff --git a/src/features/dashboard/components/hooks.ts b/src/features/dashboard/components/hooks.ts
index 70951eb2f9..d0d23fc4f7 100644
--- a/src/features/dashboard/components/hooks.ts
+++ b/src/features/dashboard/components/hooks.ts
@@ -104,3 +104,14 @@ export function fillMissingValuesAndTransform(
return result;
}
+
+export const isEmptyTimeSeries = (data: TimeSeriesChartDataPoint[]) => {
+ return (
+ data.length === 0 ||
+ data.every(
+ (item) =>
+ item.values.length === 0 ||
+ item.values.every((value) => value.value === 0),
+ )
+ );
+};
diff --git a/src/pages/project/[projectId]/index.tsx b/src/pages/project/[projectId]/index.tsx
index 869d674518..d756599768 100644
--- a/src/pages/project/[projectId]/index.tsx
+++ b/src/pages/project/[projectId]/index.tsx
@@ -4,7 +4,7 @@ import { type DateTimeAggregationOption } from "@/src/features/dashboard/lib/tim
import { useRouter } from "next/router";
import { LatencyChart } from "@/src/features/dashboard/components/LatencyChart";
import { ChartScores } from "@/src/features/dashboard/components/ChartScores";
-import { TracesBarListChart } from "@/src/features/dashboard/components/TracesChart";
+import { TracesBarListChart } from "@/src/features/dashboard/components/TracesBarListChart";
import { MetricTable } from "@/src/features/dashboard/components/MetricTable";
import { ScoresTable } from "@/src/features/dashboard/components/ScoresTable";
import { ModelUsageChart } from "@/src/features/dashboard/components/ModelUsageChart";
@@ -26,6 +26,7 @@ import {
withDefault,
} from "use-query-params";
import { isValidOption } from "@/src/utils/types";
+import { api } from "@/src/utils/api";
export type DashboardDateRange = {
from: Date;
@@ -37,6 +38,9 @@ export default function Start() {
const router = useRouter();
const projectId = router.query.projectId as string;
+ const projects = api.projects.all.useQuery();
+ const project = projects.data?.find((p) => p.id === projectId);
+
const currDate = new Date();
const FromParam = withDefault(NumberParam, addDays(currDate, -7).getTime());
const ToParam = withDefault(NumberParam, currDate.getTime());
@@ -88,7 +92,7 @@ export default function Start() {
return (
<div className="md:container">
<Header
- title="Dashboard"
+ title={project?.name ?? "Dashboard"}
actionButtons={
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined ? (
<Button size="sm" variant="outline" asChild>