Skip to content

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

feat(widgets): add observation type filter (#13639)

Mark Salpeter5c366119947b
diff --git a/web/src/features/widgets/components/WidgetForm.tsx b/web/src/features/widgets/components/WidgetForm.tsx
index 8e84de0880..f0edb1d219 100644
--- a/web/src/features/widgets/components/WidgetForm.tsx
+++ b/web/src/features/widgets/components/WidgetForm.tsx
@@ -49,7 +49,11 @@ import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props
import { Button } from "@/src/components/ui/button";
import { type DashboardWidgetChartType } from "@langfuse/shared/src/db";
import { showErrorToast } from "@/src/features/notifications/showErrorToast";
-import { type FilterState } from "@langfuse/shared";
+import {
+ type FilterState,
+ ObservationLevelDomain,
+ ObservationTypeDomain,
+} from "@langfuse/shared";
import { isTimeSeriesChart } from "@/src/features/widgets/chart-library/utils";
import {
validateQuery,
@@ -160,6 +164,13 @@ const chartTypes: ChartType[] = [
},
];
+const observationLevelOptions = ObservationLevelDomain.options.map((value) => ({
+ value,
+}));
+const observationTypeOptions = ObservationTypeDomain.options.map((value) => ({
+ value,
+}));
+
/**
* Pure function that resolves the correct aggregation and chart type given the
* current selections and valid aggregation list. Returns null when no change is
@@ -677,13 +688,6 @@ export function WidgetForm({
const toolNamesOptions = generationsFilterOptions.data?.toolNames || [];
const calledToolNamesOptions =
generationsFilterOptions.data?.calledToolNames || [];
- const observationLevelOptions = [
- { value: "DEBUG" },
- { value: "DEFAULT" },
- { value: "WARNING" },
- { value: "ERROR" },
- ];
-
const filterColumns = getWidgetFilterColumns({
selectedView,
viewVersion,
@@ -694,6 +698,7 @@ export function WidgetForm({
toolNamesOptions,
calledToolNamesOptions,
observationLevelOptions,
+ observationTypeOptions,
});
const columnsWithCustomSelect = getWidgetColumnsWithCustomSelect({
selectedView,
@@ -705,6 +710,7 @@ export function WidgetForm({
toolNamesOptions,
calledToolNamesOptions,
observationLevelOptions,
+ observationTypeOptions,
});
// When chart type does not support breakdown, wipe the breakdown dimension
diff --git a/web/src/features/widgets/components/widgetFilterColumns.ts b/web/src/features/widgets/components/widgetFilterColumns.ts
index d3ba835a93..78462bd728 100644
--- a/web/src/features/widgets/components/widgetFilterColumns.ts
+++ b/web/src/features/widgets/components/widgetFilterColumns.ts
@@ -16,6 +16,7 @@ type GetWidgetFilterColumnsParams = {
toolNamesOptions: SingleValueOption[];
calledToolNamesOptions: SingleValueOption[];
observationLevelOptions: SingleValueOption[];
+ observationTypeOptions: SingleValueOption[];
};
type WidgetFilterColumnSpec = {
@@ -33,6 +34,7 @@ const getWidgetFilterColumnSpecs = ({
toolNamesOptions,
calledToolNamesOptions,
observationLevelOptions,
+ observationTypeOptions,
}: GetWidgetFilterColumnsParams): WidgetFilterColumnSpec[] => {
const filterColumns: WidgetFilterColumnSpec[] = [
{
@@ -195,6 +197,15 @@ const getWidgetFilterColumnSpecs = ({
internal: "internalValue",
},
},
+ {
+ column: {
+ name: "Type",
+ id: "type",
+ type: "stringOptions",
+ options: observationTypeOptions,
+ internal: "internalValue",
+ },
+ },
);
}