Skip to content

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

chore: fix dev server speed (#3388)

Max Deichmann3f70828df6f9
diff --git a/.env.dev.example b/.env.dev.example
index 10f0dab1ed..aa60d4db90 100644
--- a/.env.dev.example
+++ b/.env.dev.example
@@ -51,3 +51,6 @@ REDIS_AUTH="myredissecret"
LANGFUSE_WORKER_PASSWORD=mybasicauthsecret
# openssl rand -hex 32 used only here
ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
+
+# speeds up local development by not executing init scripts on server startup
+NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT="false"
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 4abc86907b..e4362b2ed2 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -97,7 +97,7 @@ jobs:
- name: Load default env
run: |
cp .env.dev.example .env
- grep -v -e '^REDIS_HOST=' .env.dev.example > .env
+ grep -v -e '^REDIS_HOST=' -e '^NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=' .env.dev.example > .env
- name: Run + migrate
run: |
diff --git a/web/src/instrumentation.ts b/web/src/instrumentation.ts
index d08e424d25..c15b74d37c 100644
--- a/web/src/instrumentation.ts
+++ b/web/src/instrumentation.ts
@@ -1,7 +1,14 @@
// See: https://vercel.com/docs/observability/otel-overview
export async function register() {
- if (process.env.NEXT_RUNTIME === "nodejs") {
+ // This variable is set in the .env file or environment variables
+ // Value is true if NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT is "true" or undefined
+ const isInitLoadingEnabled =
+ process.env.NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT !== undefined
+ ? process.env.NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT === "true"
+ : true;
+
+ if (process.env.NEXT_RUNTIME === "nodejs" && isInitLoadingEnabled) {
await import("./datadog.server.config");
await import("./initialize");
}