Skip to content

fix(otel): preserve Langfuse deployment metadata - #47912

Closed
libaojiang wants to merge 4 commits into
BerriAI:mainfrom
libaojiang:fix-langfuse-trace-metadata-47898
Closed

libaojiang wants to merge 4 commits into
BerriAI:mainfrom
libaojiang:fix-langfuse-trace-metadata-47898

Conversation

@libaojiang

@libaojiang libaojiang commented Oct 22, 2026 •

Copy link
Copy Markdown

OTel v2 now forwards Langfuse environment, release and version on root and generation spans. Request headers take precedence over metadata, and the tracing environment falls back to LANGFUSE_TRACING_ENVIRONMENT. Operators can selectively allow these request parameters across all models

Details

TLDR

Problem this solves:

  • Langfuse loses deployment metadata after the OTel v2 migration
  • Proxy-wide admission currently requires allowing every credential parameter

How it solves it:

  • Carry the three controls through the existing trace model
  • Emit Langfuse's environment, release and version attributes
  • Reuse selective parameter admission for general settings

User Flow

Before, an application loses its deployment labels in Langfuse

  1. An operator enables langfuse_otel and admits langfuse_environment on their model
  2. The application sends POST /v1/chat/completions with environment, release and version metadata
  3. Langfuse shows the default environment with no release or version

After, the requested deployment labels reach the exported spans

  1. An operator enables langfuse_otel and selectively admits langfuse_environment across all models
  2. The application sends the same POST /v1/chat/completions with deployment metadata
  3. The exported spans carry langfuse.environment, langfuse.release and langfuse.version

Relevant issues

Fixes #47898

The report and proposed patches come from @Praveena-617

Configuration

general_settings:
  configurable_clientside_auth_params: ["langfuse_environment"]

Headers langfuse_environment, langfuse_release and langfuse_version override metadata.langfuse_environment, metadata.trace_release and metadata.trace_version. The same metadata names work through litellm_metadata for Messages requests. Unlisted parameters remain rejected, and server-owned identity fields retain their unconditional checks

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • My PR addresses one observability parity issue and its admission gap
  • Every automated review on the latest commit has finished and its findings are addressed

Validation

The 885 OTEL, mapper and authentication tests were recorded at 4db334b

Changed Python files parse, import-order checks pass and scoped type-discipline counts do not grow. Fresh runtime tests cannot collect locally because the new main requires the compiled Rust bridge, which is unavailable in this Windows environment. Latest GitHub Actions runs require maintainer approval before execution, and fresh CI and CLA results remain pending

The merge retains main's new request-metadata mapping and adds the three deployment attributes to its destination-filter inventory. The dashboard type addition preserves main's separate input and output components. Full type regeneration and real Langfuse ingestion remain pending

Type

Bug fix

Caveats

Medium

  • Real Langfuse ingestion proof remains pending test credentials
  • Chat, Messages and Responses need live before-and-after verification

This remains a draft until actual provider calls and Langfuse observation reads can be recorded. Unit tests verify emitted attributes and parameter admission, and do not establish acceptance by a hosted Langfuse service

Dependency follow-up

Synchronized with main at 527d882, which already includes #48302. This PR has no manifest, lockfile, OSV policy or workflow changes relative to main

Removed the obsolete merge ancestry that introduced an unsigned committer. Original feature commits are retained, and the previous head is backed up on the fork

Screenshots / Proof of Fix

Real-service proof remains pending, so this PR stays a draft. Earlier unit results at 4db334b are historical evidence and do not establish runtime success at current tip 3b69236

@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 35 untouched benchmarks


Comparing libaojiang:fix-langfuse-trace-metadata-47898 (4db334b) with main (72f1ac4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (dddbaa8) during the generation of this report, so 72f1ac4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@CLAassistant

CLAassistant commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@libaojiang
libaojiang force-pushed the fix-langfuse-trace-metadata-47898 branch from 4db334b to 3b69236 Compare November 4, 2026 07:44
@github-actions

Copy link
Copy Markdown
Contributor

#47898 was fixed by #51385 on main, so this pull request is closed. Reopen it if something was missed.

@github-actions github-actions Bot closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OTel v2 LangfuseMapper drops langfuse.environment / release / version (parity regression from OTel v1)

2 participants