From affd0194b2e546ee36061232d3cf9ae198d0a57c Mon Sep 17 00:00:00 2001 From: Ravi Kumar L Date: Sun, 21 Jun 2026 21:54:53 +0200 Subject: [PATCH] docs: clarify langfuse compose destination scope --- .env.example | 2 ++ otel/langfuse-fanout/README.md | 14 ++++++++++---- otel/langfuse-fanout/otelcol.yaml | 5 ++--- packages/api/src/langfuse/config.ts | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index cd904eef80..3fc5a7fe00 100644 --- a/.env.example +++ b/.env.example @@ -139,6 +139,8 @@ NODE_MAX_OLD_SPACE_SIZE=6144 # https://hipaa.cloud.langfuse.com (HIPAA). # LANGFUSE_FANOUT_CENTRAL_BASE_URL=https://cloud.langfuse.com # LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER=Basic +# Compose's included collector config supports the four listed destination keys. +# Add custom keys only when the collector routing table/exporters are updated too. # LANGFUSE_FANOUT_TENANT_DESTINATIONS=eu=https://cloud.langfuse.com,us=https://us.cloud.langfuse.com,jp=https://jp.cloud.langfuse.com,hipaa=https://hipaa.cloud.langfuse.com # LANGFUSE_FANOUT_TENANT_EU_BASE_URL=https://cloud.langfuse.com # LANGFUSE_FANOUT_TENANT_US_BASE_URL=https://us.cloud.langfuse.com diff --git a/otel/langfuse-fanout/README.md b/otel/langfuse-fanout/README.md index 337cde207c..c301700cb2 100644 --- a/otel/langfuse-fanout/README.md +++ b/otel/langfuse-fanout/README.md @@ -47,6 +47,10 @@ defined in this collector config. tenant base URL is configured at LibreChat/collector startup. Runtime tenant config selects from those known destinations; it does not inject arbitrary export URLs into the collector. +- The provided Compose collector config is a four-region Langfuse Cloud preset + (`eu`, `us`, `jp`, `hipaa`). For self-hosted or additional destination keys, + use Helm values or update/generate the collector routing table and exporters + in lockstep with `LANGFUSE_FANOUT_TENANT_DESTINATIONS`. ## Docker Compose @@ -55,6 +59,8 @@ Set the central Langfuse destination in `.env`: ```dotenv LANGFUSE_FANOUT_CENTRAL_BASE_URL=https://cloud.langfuse.com LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER=Basic +# Compose's included collector config supports these four destination keys. +# Do not add a custom key unless the collector routing table also has a matching pipeline/exporter. LANGFUSE_FANOUT_TENANT_DESTINATIONS=eu=https://cloud.langfuse.com,us=https://us.cloud.langfuse.com,jp=https://jp.cloud.langfuse.com,hipaa=https://hipaa.cloud.langfuse.com LANGFUSE_FANOUT_TENANT_EU_BASE_URL=https://cloud.langfuse.com LANGFUSE_FANOUT_TENANT_US_BASE_URL=https://us.cloud.langfuse.com @@ -128,9 +134,9 @@ the LibreChat app ConfigMap when they are not already supplied in - The collector only handles traces. Feedback scores go directly to Langfuse's REST API from the LibreChat API process. - `LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER` must be a full Basic auth header. -- Tenant destinations default to the four Langfuse Cloud regions. Add or override - `langfuseFanout.tenant.destinations` in Helm, or set - `LANGFUSE_FANOUT_TENANT_DESTINATIONS` plus matching collector base URL env vars - in compose, for self-hosted or custom destinations. +- Tenant destinations default to the four Langfuse Cloud regions. Add or + override `langfuseFanout.tenant.destinations` in Helm for self-hosted or + custom destinations. Compose's included collector config is static; if you add + custom destination keys there, update or regenerate `otelcol.yaml` as well. - `LANGFUSE_FANOUT_COLLECTOR_URL` is the local collector URL used by LibreChat, not a Langfuse Cloud base URL. diff --git a/otel/langfuse-fanout/otelcol.yaml b/otel/langfuse-fanout/otelcol.yaml index ffd5f2ba9f..bcae8a574f 100644 --- a/otel/langfuse-fanout/otelcol.yaml +++ b/otel/langfuse-fanout/otelcol.yaml @@ -79,8 +79,7 @@ exporters: headers: Authorization: '${env:LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER}' x-langfuse-ingestion-version: '4' - otlphttp/tenant: - # Backward-compatible alias for the EU/default Langfuse destination. + otlphttp/tenant_eu: endpoint: '${env:LANGFUSE_FANOUT_TENANT_EU_BASE_URL}/api/public/otel' auth: authenticator: headers_setter/tenant_passthrough @@ -119,7 +118,7 @@ service: traces/tenant_eu: receivers: [routing/langfuse_tenant_destination] processors: [attributes/drop_librechat_routing, batch/by_auth_eu] - exporters: [otlphttp/tenant] + exporters: [otlphttp/tenant_eu] traces/tenant_us: receivers: [routing/langfuse_tenant_destination] processors: [attributes/drop_librechat_routing, batch/by_auth_us] diff --git a/packages/api/src/langfuse/config.ts b/packages/api/src/langfuse/config.ts index 30dff6f96b..e220c69ec4 100644 --- a/packages/api/src/langfuse/config.ts +++ b/packages/api/src/langfuse/config.ts @@ -77,7 +77,8 @@ export function buildLangfuseConfig({ const tenantExportEnabled = hasTenantCredentials && fanoutEnabled && isTenantExportEnabled() && Boolean(tenantDestination); - if (hasTenantCredentials && (!fanoutEnabled || tenantExportEnabled)) { + const directTenantExportEnabled = hasTenantCredentials && !fanoutEnabled; + if (directTenantExportEnabled || tenantExportEnabled) { langfuse.publicKey = publicKey; langfuse.secretKey = secretKey; }