🪢 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
Env setup for multi-region cloud (#152)
Marc Klingen3c8bbe010b78
diff --git a/.env.cloud.example b/.env.cloud.exampleindex bce8ab6f6e..a14f811cf7 100644--- a/.env.cloud.example+++ b/.env.cloud.example@@ -1,5 +1,5 @@# Assuming deployment on Vercel with Postgres database on Supabase-NEXT_PUBLIC_HOSTNAME="cloud.langfuse.com"+NEXT_PUBLIC_LANGFUSE_CLOUD_REGION="US"# Prismadiff --git a/sentry.server.config.ts b/sentry.server.config.tsindex 4002bed1e9..b4f11bd171 100644--- a/sentry.server.config.ts+++ b/sentry.server.config.ts@@ -5,10 +5,6 @@ import { ProfilingIntegration } from "@sentry/profiling-node";if (process.env.NEXT_PUBLIC_SENTRY_DSN)Sentry.init({dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,- // environment:- // process.env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com"- // ? "cloud"- // : process.env.NODE_ENV,// Set tracesSampleRate to 1.0 to capture 100%// of transactions for performance monitoring.diff --git a/src/env.mjs b/src/env.mjsindex c589db92df..1f2e3452a8 100644--- a/src/env.mjs+++ b/src/env.mjs@@ -34,7 +34,7 @@ export const env = createEnv({*/client: {// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),- NEXT_PUBLIC_HOSTNAME: z.string().optional(),+ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION: z.enum(["US", "EU"]).optional(),NEXT_PUBLIC_DEMO_PROJECT_ID: z.string().optional(),},@@ -49,6 +49,7 @@ export const env = createEnv({NODE_ENV: process.env.NODE_ENV,NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,NEXTAUTH_URL: process.env.NEXTAUTH_URL,- NEXT_PUBLIC_HOSTNAME: process.env.NEXT_PUBLIC_HOSTNAME,+ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION:+ process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,},});diff --git a/src/middleware.ts b/src/middleware.tsindex 3dfd22a7d4..a2c12631bd 100644--- a/src/middleware.ts+++ b/src/middleware.ts@@ -6,7 +6,7 @@ import { type NextRequest } from "next/server";import { get } from "@vercel/edge-config";export async function middleware(req: NextRequest) {- if (process.env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com") {+ if (process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined) {const config = await get("blockedIps");const blockedIps = Array.isArray(config) ? config : [config];diff --git a/src/pages/auth/sign-up.tsx b/src/pages/auth/sign-up.tsxindex 66c41507fa..ec782f30ea 100644--- a/src/pages/auth/sign-up.tsx+++ b/src/pages/auth/sign-up.tsx@@ -72,7 +72,7 @@ export default function SignIn() {Create new account</h2></div>- {env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com" ? (+ {env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined ? (<div className="text-center sm:mx-auto sm:w-full sm:max-w-[480px]">No credit card required. All users have access to a demo project.</div>@@ -139,7 +139,7 @@ export default function SignIn() {) : null}</form></Form>- {env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com" ? (+ {env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined ? (<div className="-mb-4 mt-8 text-center text-xs text-gray-500">By creating an account you are agreeing to our{" "}<adiff --git a/src/pages/project/[projectId]/analytics.tsx b/src/pages/project/[projectId]/analytics.tsxindex 5f5676ac31..8fc178a369 100644--- a/src/pages/project/[projectId]/analytics.tsx+++ b/src/pages/project/[projectId]/analytics.tsx@@ -17,18 +17,16 @@ import {} from "@/src/components/ui/card";import { openChat } from "@/src/features/support-chat/chat";import { StringParam, useQueryParam, withDefault } from "use-query-params";+import { env } from "@/src/env.mjs";export default function AnalyticsPage() {const router = useRouter();const projectId = router.query.projectId as string;- const analyticsEnabled =- process.env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com";-return (<div className="md:container"><Header title="Analytics" />- {analyticsEnabled ? (+ {env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "EU" ? (<DashboardEmbed projectId={projectId} />) : (<AnalyticsDisabled />@@ -43,8 +41,9 @@ const AnalyticsDisabled = () => (<AlertTitle>Analytics alpha is only available on Langfuse Cloud</AlertTitle><AlertDescription>While we are in the alpha phase, Analytics is only available for Langfuse- Cloud users as we use Looker to power the dashboards. An open source- version is work in progress.+ Cloud{env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "US" ? " EU" : ""} users+ as we use Looker to power the dashboards. An open source version is work+ in progress.</AlertDescription></Alert>);@@ -136,7 +135,7 @@ const DashboardEmbed = (props: { projectId: string }) => {<iframewidth="100%"src={- process.env.NEXT_PUBLIC_HOSTNAME === "cloud.langfuse.com"+ env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "EU"? dashboard.dashboardProjectUrl(props.projectId): dashboard.dashboardUrl}