🪢 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: use otel ingestion queue by default (#9397)
Steffen Schmitz0540828e2194
diff --git a/.env.dev-redis-cluster.example b/.env.dev-redis-cluster.exampleindex 374f691958..920a5e434a 100644--- a/.env.dev-redis-cluster.example+++ b/.env.dev-redis-cluster.example@@ -85,4 +85,3 @@ ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000# speeds up local development by not executing init scripts on server startupNEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT="false"-LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE="true"diff --git a/web/src/env.mjs b/web/src/env.mjsindex 24269237a1..f4fc142238 100644--- a/web/src/env.mjs+++ b/web/src/env.mjs@@ -165,10 +165,6 @@ export const env = createEnv({OTEL_SERVICE_NAME: z.string().default("web"),OTEL_TRACE_SAMPLING_RATIO: z.coerce.number().gt(0).lte(1).default(1),- LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE: z- .enum(["true", "false"])- .default("false"),- LANGFUSE_EXPERIMENT_OTEL_INGESTION_QUEUE_PROJECT_IDS: z.string().optional(),// clickhouseCLICKHOUSE_URL: z.string().url(),@@ -446,10 +442,6 @@ export const env = createEnv({OTEL_SERVICE_NAME: process.env.OTEL_SERVICE_NAME,OTEL_TRACE_SAMPLING_RATIO: process.env.OTEL_TRACE_SAMPLING_RATIO,- LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE:- process.env.LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE,- LANGFUSE_EXPERIMENT_OTEL_INGESTION_QUEUE_PROJECT_IDS:- process.env.LANGFUSE_EXPERIMENT_OTEL_INGESTION_QUEUE_PROJECT_IDS,// S3 media uploadLANGFUSE_S3_MEDIA_MAX_CONTENT_LENGTH:diff --git a/web/src/pages/api/public/otel/v1/traces/index.ts b/web/src/pages/api/public/otel/v1/traces/index.tsindex 772fe4255b..a823e98315 100644--- a/web/src/pages/api/public/otel/v1/traces/index.ts+++ b/web/src/pages/api/public/otel/v1/traces/index.ts@@ -1,15 +1,9 @@import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";import { createAuthedProjectAPIRoute } from "@/src/features/public-api/server/createAuthedProjectAPIRoute";-import {- type IngestionEventType,- logger,- processEventBatch,- OtelIngestionProcessor,-} from "@langfuse/shared/src/server";+import { logger, OtelIngestionProcessor } from "@langfuse/shared/src/server";import { z } from "zod/v4";import { $root } from "@/src/pages/api/public/otel/otlp-proto/generated/root";import { gunzip } from "node:zlib";-import { env } from "@/src/env.mjs";export const config = {api: {@@ -99,29 +93,9 @@ export default withMiddlewares({publicKey: auth.scope.publicKey,});- // At this point, we have the raw OpenTelemetry Span body. Traditionally, we separated this within the web- // container into individual traces and observations with the native Langfuse format before passing them into- // the processEventBatch function.- // To reduce the number of S3 interactions, we upload the full batch to S3 if `LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE`- // is set to `true`. The OtelIngestionProcessor logic will then move into the worker container where observations- // are handled as-is and traces are being reprocessed as they are being processed today.- const projectIdsToUseOtelBatch =- env.LANGFUSE_EXPERIMENT_OTEL_INGESTION_QUEUE_PROJECT_IDS?.split(",") ??- [];- if (- env.LANGFUSE_EXPERIMENT_USE_OTEL_INGESTION_QUEUE === "true" ||- projectIdsToUseOtelBatch.includes(auth.scope.projectId)- ) {- return processor.publishToOtelIngestionQueue(resourceSpans);- } else {- // Create and process OTEL resource spans to ingestion events- const events: IngestionEventType[] =- await processor.processToIngestionEvents(resourceSpans);-- // We set a delay of 0 for OTel, as we never expect updates.- // We also set the source to "otel" which helps us with metric tracking and skipping list calls for S3.- return processEventBatch(events, auth, { delay: 0, source: "otel" });- }+ // At this point, we have the raw OpenTelemetry Span body. We upload the full batch to S3+ // and the OtelIngestionProcessor logic will handle processing in the worker container.+ return processor.publishToOtelIngestionQueue(resourceSpans);},}),});