🪢 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(cloud): add environment labeling (#1058)
Marc Klingen3cbd252980b7
diff --git a/src/components/LangfuseLogo.tsx b/src/components/LangfuseLogo.tsxindex 1a47998784..7697a132c6 100644--- a/src/components/LangfuseLogo.tsx+++ b/src/components/LangfuseLogo.tsx@@ -1,5 +1,7 @@import { VERSION } from "@/src/constants/VERSION";+import { env } from "@/src/env.mjs";import { cn } from "@/src/utils/tailwind";+import { AlertTriangle } from "lucide-react";export const LangfuseIcon = ({size = 32,@@ -22,31 +24,54 @@ export const LangfuseLogo = ({className,size = "sm",version = false,+ showEnvLabel = false,}: {size?: "sm" | "xl";className?: string;version?: boolean;+ showEnvLabel?: boolean;}) => (- <div className={cn("flex items-center", className)}>- <LangfuseIcon size={size === "sm" ? 16 : 20} />- <span- className={cn(- "font-mono font-semibold",- size === "sm" ? "ml-2 text-sm" : "ml-3 text-xl",- )}- >- Langfuse- </span>- {version && (- <a- href="https://github.com/langfuse/langfuse/releases"- target="_blank"- rel="noopener"- title="View releases on GitHub"- className="ml-2 text-xs text-gray-400"+ <div className={cn("flex gap-4 xl:flex-col xl:items-start", className)}>+ {/* Environment Labeling for Langfuse Maintainers */}+ {showEnvLabel && env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION && (+ <div+ className={cn(+ "flex items-center gap-2 self-stretch rounded-md px-3 py-1 ring-1 xl:-mx-2",+ env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "STAGING"+ ? "bg-blue-100 text-blue-500 ring-blue-500"+ : "bg-red-100 text-red-500 ring-red-500",+ )}>- {VERSION}- </a>+ <AlertTriangle size={16} />+ <span className="whitespace-nowrap">+ {["EU", "US"].includes(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION)+ ? `PRODUCTION-${env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION}`+ : env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION}+ </span>+ </div>)}+ {/* Langfuse Logo */}+ <div className="flex items-center">+ <LangfuseIcon size={size === "sm" ? 16 : 20} />+ <span+ className={cn(+ "font-mono font-semibold",+ size === "sm" ? "ml-2 text-sm" : "ml-3 text-xl",+ )}+ >+ Langfuse+ </span>+ {version && (+ <a+ href="https://github.com/langfuse/langfuse/releases"+ target="_blank"+ rel="noopener"+ title="View releases on GitHub"+ className="ml-2 text-xs text-gray-400"+ >+ {VERSION}+ </a>+ )}+ </div></div>);diff --git a/src/components/layouts/layout.tsx b/src/components/layouts/layout.tsxindex 833f6a8b8d..3939049662 100644--- a/src/components/layouts/layout.tsx+++ b/src/components/layouts/layout.tsx@@ -220,7 +220,13 @@ export default function Layout(props: PropsWithChildren) {</Transition.Child>{/* Sidebar component, swap this element with another sidebar if you like */}<div className="flex grow flex-col gap-y-5 overflow-y-auto bg-white px-6 py-4">- <LangfuseLogo version size="xl" />+ <LangfuseLogo+ version+ size="xl"+ showEnvLabel={session.data?.user?.email?.endsWith(+ "@langfuse.com",+ )}+ /><nav className="flex flex-1 flex-col"><ul role="list" className="flex flex-1 flex-col gap-y-7"><MainNavigation nav={navigation} />@@ -286,7 +292,14 @@ export default function Layout(props: PropsWithChildren) {<div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-72 xl:flex-col">{/* Sidebar component, swap this element with another sidebar if you like */}<div className="flex h-screen grow flex-col gap-y-5 border-r border-gray-200 bg-white pt-7">- <LangfuseLogo version size="xl" className="mb-2 px-6" />+ <LangfuseLogo+ version+ size="xl"+ className="mb-2 px-6"+ showEnvLabel={session.data?.user?.email?.endsWith(+ "@langfuse.com",+ )}+ /><nav className="flex h-full flex-1 flex-col overflow-y-auto px-6 pb-3"><ul role="list" className="flex h-full flex-col gap-y-4"><MainNavigation nav={navigation} />@@ -408,7 +421,11 @@ export default function Layout(props: PropsWithChildren) {<span className="sr-only">Open sidebar</span><Bars3Icon className="h-6 w-6" aria-hidden="true" /></button>- <LangfuseLogo version className="flex-1" />+ <LangfuseLogo+ version+ className="flex-1"+ showEnvLabel={session.data?.user?.email?.endsWith("@langfuse.com")}+ /><Menu as="div" className="relative"><Menu.Button className="flex items-center gap-x-4 text-sm font-semibold leading-6 text-gray-900"><span className="sr-only">Open user menu</span>