🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore: hide eval preview if user has not ingested with otel in the past 7 days (#13343)
marliessophiec9c841508e9e
diff --git a/packages/shared/src/server/repositories/events.ts b/packages/shared/src/server/repositories/events.tsindex 792217a1e6..95f71aad29 100644--- a/packages/shared/src/server/repositories/events.ts+++ b/packages/shared/src/server/repositories/events.ts@@ -3284,7 +3284,11 @@ export async function getLatestSdkVersionInfoFromEvents(params: {]);const builder = new EventsQueryBuilder({ projectId })- .selectRaw("e.scope_name", "e.scope_version", "e.telemetry_sdk_language")+ .selectRaw(+ "e.scope_name AS scope_name",+ "e.scope_version AS scope_version",+ "e.telemetry_sdk_language AS telemetry_sdk_language",+ ).selectMetadataExpanded([]) // Full metadata values from events_full.applyFilters(filter)// OR condition: v4 has scope_name column, v3 has scope in metadatadiff --git a/web/src/features/evals/components/inner-evaluator-form.tsx b/web/src/features/evals/components/inner-evaluator-form.tsxindex a511cd2d9b..6a57941eb3 100644--- a/web/src/features/evals/components/inner-evaluator-form.tsx+++ b/web/src/features/evals/components/inner-evaluator-form.tsx@@ -204,9 +204,13 @@ const ObservationsPreview = memo(({projectId,filterState,+ isNewCompatible,+ compatibilityCheckWasPerformed,}: {projectId: string;filterState: z.infer<typeof singleFilter>[];+ isNewCompatible: boolean;+ compatibilityCheckWasPerformed: boolean;}) => {const { isBetaEnabled } = useV4Beta();@@ -219,6 +223,10 @@ const ObservationsPreview = memo(} as TableDateRange;}, []);+ // Show upgrade message only when SDK check was performed and user is not on OTEL SDK+ const showSdkUpgradeMessage =+ compatibilityCheckWasPerformed && !isNewCompatible;+return (<><div className="flex flex-col items-start gap-1">@@ -228,7 +236,32 @@ const ObservationsPreview = memo(</div><div className="mb-4 flex max-h-[30dvh] w-full flex-col overflow-hidden border-r border-b border-l"><Suspense fallback={<Skeleton className="h-[30dvh] w-full" />}>- {isBetaEnabled ? (+ {showSdkUpgradeMessage ? (+ <div className="flex h-[30dvh] flex-col items-center justify-center gap-2 border-t p-4 text-center">+ <AlertTriangle className="text-dark-yellow h-8 w-8" />+ <div className="flex flex-col gap-1">+ <span className="text-foreground font-medium">+ Please verify your SDK version+ </span>+ <span className="text-muted-foreground max-w-md text-sm">+ We did not find any data ingested with langfuse+ OTEL-compatible SDKs in the last 7 days. Observation-level+ evaluators require JS SDK v4+ or Python SDK v3+. You can+ still configure this evaluator now—it will start running+ once you upgrade.{" "}+ <a+ href="https://langfuse.com/docs/observability/sdk/upgrade-path"+ target="_blank"+ rel="noopener noreferrer"+ className="text-dark-blue font-medium hover:opacity-80"+ >+ Learn more+ </a>+ .+ </span>+ </div>+ </div>+ ) : isBetaEnabled ? (<EventsTableprojectId={projectId}hideControls@@ -1071,6 +1104,10 @@ export const InnerEvaluatorForm = (props: {<ObservationsPreviewprojectId={props.projectId}filterState={form.watch("filter") ?? []}+ isNewCompatible={props.evalCapabilities.isNewCompatible}+ compatibilityCheckWasPerformed={+ props.evalCapabilities.compatibilityCheckWasPerformed+ }/>)}</>@@ -1140,6 +1177,10 @@ export const InnerEvaluatorForm = (props: {shouldWrapVariables={props.shouldWrapVariables}hideAdvancedSettings={props.hideAdvancedSettings}oldConfigId={props.oldConfigId}+ isNewCompatible={props.evalCapabilities.isNewCompatible}+ compatibilityCheckWasPerformed={+ props.evalCapabilities.compatibilityCheckWasPerformed+ }/></div>);diff --git a/web/src/features/evals/components/variable-mapping-card.tsx b/web/src/features/evals/components/variable-mapping-card.tsxindex 9b13931584..595b141230 100644--- a/web/src/features/evals/components/variable-mapping-card.tsx+++ b/web/src/features/evals/components/variable-mapping-card.tsx@@ -62,6 +62,8 @@ export const VariableMappingCard = ({disabled = false,shouldWrapVariables = false,hideAdvancedSettings = false,+ isNewCompatible = true,+ compatibilityCheckWasPerformed = false,}: {projectId: string;availableVariables:@@ -73,6 +75,8 @@ export const VariableMappingCard = ({disabled?: boolean;shouldWrapVariables?: boolean;hideAdvancedSettings?: boolean;+ isNewCompatible?: boolean;+ compatibilityCheckWasPerformed?: boolean;}) => {const [showPreview, setShowPreview] = useState(false);const [selectedPreviewIds, setSelectedPreviewIds] = useState<{@@ -101,11 +105,17 @@ export const VariableMappingCard = ({isPeekView ? (selectedPreviewIds ?? {}) : undefined,);+ const nonOtelCompatible = compatibilityCheckWasPerformed && !isNewCompatible;+useEffect(() => {- if (isTraceOrEventTarget(form.getValues("target")) && !disabled) {+ const target = form.getValues("target");+ // Disable preview for event targets only when SDK check was performed and user is not on OTEL SDK+ const shouldDisableForNonOtel = isEventTarget(target) && nonOtelCompatible;++ if (isTraceOrEventTarget(target) && !disabled && !shouldDisableForNonOtel) {setShowPreview(true);} else {- // For dataset and experiment targets, disable preview+ // For dataset and experiment targets, or event targets without OTEL SDKsetShowPreview(false);}@@ -113,7 +123,7 @@ export const VariableMappingCard = ({setSelectedPreviewIds(undefined);}// eslint-disable-next-line react-hooks/exhaustive-deps- }, [form.watch("target"), disabled, isPeekView]);+ }, [form.watch("target"), disabled, isPeekView, nonOtelCompatible]);useEffect(() => {if (isPeekView) {@@ -121,9 +131,15 @@ export const VariableMappingCard = ({}}, [isPeekView, peekId]);+ // Hide preview controls for event targets only when SDK check was performed and user is not on OTEL SDK+ const shouldShowPreviewControls =+ isTraceOrEventTarget(form.watch("target")) &&+ !disabled &&+ !(isEventTarget(form.watch("target")) && nonOtelCompatible);+const mappingControlButtons = (<div className="flex items-center gap-2">- {isTraceOrEventTarget(form.watch("target")) && !disabled && (+ {shouldShowPreviewControls && (<><span className="text-muted-foreground text-xs">Preview</span><Switchdiff --git a/web/src/features/evals/hooks/useEvalCapabilities.ts b/web/src/features/evals/hooks/useEvalCapabilities.tsindex 384da26333..cffd9a1c54 100644--- a/web/src/features/evals/hooks/useEvalCapabilities.ts+++ b/web/src/features/evals/hooks/useEvalCapabilities.ts@@ -1,19 +1,17 @@import { useSession } from "next-auth/react";import { api } from "@/src/utils/api";import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";+import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";+export interface EvalCapabilities {isNewCompatible: boolean;+ compatibilityCheckWasPerformed: boolean;allowLegacy: boolean;allowPropagationFilters: boolean;isLoading: boolean;hasLegacyEvals: boolean;}-const mockOtelStatus = {- isOtel: false,- isPropagating: false,-};-/*** Hook to determine which eval configuration features are available* @param projectId - The project ID to check@@ -22,9 +20,18 @@ const mockOtelStatus = {export function useEvalCapabilities(projectId: string): EvalCapabilities {const { data: session, status: sessionStatus } = useSession();const isSessionLoading = sessionStatus === "loading";+ const { isBetaEnabled } = useV4Beta();++ // Query SDK version info from events table (only when v4 beta is enabled)+ const sdkVersionInfo = api.events.getSdkVersionInfo.useQuery(+ { projectId },+ { enabled: isBetaEnabled },+ );- // Query OTEL SDK status- const { isOtel, isPropagating } = mockOtelStatus;+ // Determine OTEL status from SDK version info+ const isOtel = sdkVersionInfo.data?.isOtel ?? false;+ // TODO: Implement propagation check+ const isPropagating = false;// Get eval counts including legacy eval countconst evalCounts = api.evals.counts.useQuery({ projectId });@@ -39,11 +46,14 @@ export function useEvalCapabilities(projectId: string): EvalCapabilities {return {isNewCompatible: isOtel,+ // True when v4 beta is enabled (SDK check query was run)+ compatibilityCheckWasPerformed: isBetaEnabled,// Allow legacy if: not cloud OR user has legacy evals OR user can toggle v4 (existing user)allowLegacy: !isLangfuseCloud || hasLegacyEvals || canToggleV4,// Allow propagation filters only when using OTEL and spans are propagatingallowPropagationFilters: isOtel && isPropagating,- isLoading: evalCounts.isLoading || isSessionLoading,+ isLoading:+ evalCounts.isLoading || isSessionLoading || sdkVersionInfo.isLoading,hasLegacyEvals,};}