Skip to content

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

feat(evals): support default filter active status (#11929)

marliessophiea8bc224f47b4
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index b4c3b3df8d..863f54e2fd 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -168,6 +168,15 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
newFilterOptions,
projectId,
false,
+ false,
+ [
+ {
+ column: "status",
+ type: "stringOptions",
+ operator: "any of",
+ value: ["ACTIVE"],
+ },
+ ],
);
const evaluators = api.evals.allConfigs.useQuery({
diff --git a/web/src/features/evals/components/inner-evaluator-form.tsx b/web/src/features/evals/components/inner-evaluator-form.tsx
index 771dae0ec7..2080b8f2ea 100644
--- a/web/src/features/evals/components/inner-evaluator-form.tsx
+++ b/web/src/features/evals/components/inner-evaluator-form.tsx
@@ -110,10 +110,10 @@ const addPropagationWarnings = (
severity: "warning" as const,
content: (
<>
- This filter requires JS SDK &ge; 4.4.0 or Python SDK &ge; 3.9.0
+ This filter requires JS SDK &ge; 4.0.0 or Python SDK &ge; 3.0.0
with attribute propagation enabled. Please{" "}
<a
- href="https://langfuse.com/integrations/native/opentelemetry"
+ href="https://langfuse.com/integrations/native/opentelemetry#propagating-attributes"
target="_blank"
rel="noopener noreferrer"
className="text-dark-blue hover:opacity-80"
diff --git a/web/src/features/filters/hooks/useSidebarFilterState.tsx b/web/src/features/filters/hooks/useSidebarFilterState.tsx
index 2b15ffd076..bfe8970ff1 100644
--- a/web/src/features/filters/hooks/useSidebarFilterState.tsx
+++ b/web/src/features/filters/hooks/useSidebarFilterState.tsx
@@ -250,6 +250,11 @@ export function useSidebarFilterState(
* the parent page's URL with filters that don't apply to the parent context.
*/
disableUrlPersistence?: boolean,
+ /**
+ * Default filters to apply on initial load (when no URL filters are present).
+ * These are applied once per project and stored in localStorage to prevent re-application.
+ */
+ defaultFilters?: FilterState,
) {
const FILTER_EXPANDED_STORAGE_KEY = `${config.tableName}-filters-expanded`;
const DEFAULT_EXPANDED_FILTERS = config.defaultExpanded ?? [];
@@ -299,43 +304,63 @@ export function useSidebarFilterState(
false,
);
- // init default env filters on first load to deselect envs prefixed with "langfuse-"
+ // Apply default filters when no URL filters are present
useEffect(() => {
// Skip auto-applying defaults for embedded tables
if (disableUrlPersistence) return;
- if (filterState.length > 0 || defaultsApplied) return;
- // only if there is an environment facet
- const environmentFacet = config.facets.find(
- (f) => f.column === "environment" && f.type === "categorical",
- );
- if (!environmentFacet) return;
+ // If there are already filters in the URL, don't override them
+ if (filterState.length > 0) return;
- const environmentOptions = options["environment"];
- if (!Array.isArray(environmentOptions) || environmentOptions.length === 0)
- return;
+ let filtersToApply: FilterState = [];
- const environments = environmentOptions.map((opt) =>
- typeof opt === "string" ? opt : opt.value,
- );
+ // Apply custom default filters if provided (always apply when no URL filters)
+ if (defaultFilters && defaultFilters.length > 0) {
+ filtersToApply = defaultFilters;
+ } else {
+ // Fallback to environment filter behavior (one-time with localStorage)
+ if (defaultsApplied) return;
- const langfuseEnvironments = environments.filter((env) =>
- env.startsWith("langfuse-"),
- );
+ // only if there is an environment facet
+ const environmentFacet = config.facets.find(
+ (f) => f.column === "environment" && f.type === "categorical",
+ );
+ if (environmentFacet) {
+ const environmentOptions = options["environment"];
+ if (
+ Array.isArray(environmentOptions) &&
+ environmentOptions.length > 0
+ ) {
+ const environments = environmentOptions.map((opt) =>
+ typeof opt === "string" ? opt : opt.value,
+ );
- // exclude langfuse- environments if there are any
- if (langfuseEnvironments.length > 0) {
- const defaultFilter: FilterState = [
- {
- column: "environment",
- type: "stringOptions",
- operator: "none of",
- value: langfuseEnvironments,
- },
- ];
+ const langfuseEnvironments = environments.filter((env) =>
+ env.startsWith("langfuse-"),
+ );
+
+ // exclude langfuse- environments if there are any
+ if (langfuseEnvironments.length > 0) {
+ filtersToApply = [
+ {
+ column: "environment",
+ type: "stringOptions",
+ operator: "none of",
+ value: langfuseEnvironments,
+ },
+ ];
+ }
+ }
+ }
+ }
- setFilterState(defaultFilter);
- setDefaultsApplied(true);
+ // Apply filters if any were determined
+ if (filtersToApply.length > 0) {
+ setFilterState(filtersToApply);
+ // Only mark as applied for legacy environment filter behavior
+ if (!defaultFilters || defaultFilters.length === 0) {
+ setDefaultsApplied(true);
+ }
}
}, [
filterState.length,
@@ -345,6 +370,7 @@ export function useSidebarFilterState(
disableUrlPersistence,
setFilterState,
setDefaultsApplied,
+ defaultFilters,
]);
const clearAll = () => {