Sending OpenTelemetry LLM traces to self-hosted Langfuse: what it does and when to use it
Sending OpenTelemetry LLM traces to self-hosted Langfuse means instrumenting your LLM application with OpenTelemetry and exporting those traces to a Langfuse instance that your team runs in its own infrastructure, so prompts, model calls and tool steps are stored and viewed under your control. OpenTelemetry is the transport: it generates and exports the telemetry. Langfuse is the storage and user interface, where traces are queried, reviewed and used for prompt management and evaluations. OpenTelemetry is not an observability backend on its own, so a store like Langfuse is still required. Langfuse accepts OTLP traces on its /api/public/otel endpoint for self-hosted deployments from v3.22.0, and it authenticates requests with Basic Auth.
This route fits teams that need LLM traces in a backend they operate, for example because prompts or user inputs are subject to data residency, contractual or internal review rules, or because they want to avoid tying instrumentation to one hosted AI observability vendor. Because the application exports standard OTLP, the same instrumentation can later point at another OTLP-capable backend. Confirm first that your Langfuse version is v3.22.0 or later and that your application's OpenTelemetry SDK and language instrumentation can emit the trace attributes you need.
An OpenTelemetry Collector between the application and Langfuse is optional, but it is useful for three jobs: holding the Langfuse Basic Auth credentials outside application code, adding or transforming attributes in one place, and removing sensitive content before it leaves your network. The Collector's redaction processor is the control to plan for, because LLM spans often carry full prompts, completions and retrieved documents. Decide what must be removed or masked before the first production trace is exported.
How LLM trace data moves from application to self-hosted Langfuse
Traces start in the LLM application, where the OpenTelemetry SDK creates spans and exports them over OTLP. They can go directly to Langfuse or pass through a Collector, where redaction and credentials are applied before export. Inside the Langfuse network, Langfuse Web accepts the request at its OTLP endpoint, Langfuse Worker processes events asynchronously, and the data lands in PostgreSQL, ClickHouse and blob storage. Check that the trust boundary is crossed only by authenticated, redacted data.
Trace path from the LLM application through the Collector into self-hosted Langfuse.
Direct export or a Collector in between: which path fits
With direct export, each application holds the Langfuse public and secret keys and sends Basic Auth headers to the /api/public/otel endpoint itself. Every service that runs an LLM workload needs those credentials in its configuration, so rotating a key means redeploying each application. With a Collector in between, the applications can send to the Collector without Langfuse credentials, and only the Collector's exporter configuration holds them. The Collector can also authenticate incoming connections on its receivers, for example with OIDC through an authenticator extension, and the oauth2client extension can add credentials to outgoing exporter requests.
- Direct export secrets: keys sit in every application's environment, secret stores and deployment manifests.
- Collector exporter secrets: Langfuse keys sit in one reviewed configuration, ideally loaded from a secrets manager.
- Inbound authentication: receivers can require identity from calling services, which direct export does not provide.
- Rotation effort: a single Collector change replaces redeploying every application.
- Storage of the configuration: the Collector config itself must be stored with access controls and encryption.
Before choosing, confirm with your security team where your secrets manager sits and who may read the Collector configuration.
Redaction is the main reason to consider a Collector. With direct export, the SDK or instrumentation library decides what leaves the application, so prompts, completions, tool arguments and user identifiers are sent to Langfuse unless the code filters them first. With a Collector, the redaction processor can remove or hash sensitive attributes before data reaches Langfuse, and this step applies to every service that sends through it. OpenTelemetry's security guidance recommends using the redaction processor for this purpose. A Collector does not remove the need to design redaction in the application, because data is still sent from the application to the Collector in full.
- Application-side filtering: remove prompt and response content in code before spans are created.
- Collector-side filtering: the redaction processor strips attributes that match configured rules.
- Defense in depth: use both, so one missed attribute in one service is still caught centrally.
- Transport exposure: data travels in full to the Collector, so encrypt that hop and keep the Collector inside your network.
- Verification: test redaction with sample traffic that contains realistic but fake personal data.
Before going live, confirm which span attributes your LLM instrumentation records by default.
Direct export scales by repetition: each new service needs its own SDK configuration, credentials and exporter settings. That is manageable for one or two applications owned by one team. A Collector deployed as a gateway gives many services one shared path, so sampling rules, redaction and exporter settings are changed once. The agent pattern places a Collector next to each workload and forwards to a gateway, which suits larger or multi-cluster estates. The trade-off is that a shared pipeline becomes a shared dependency, so its capacity and failure behavior affect every application that sends through it.
- Direct export footprint: each service carries its own exporter settings and credentials.
- Gateway pattern: one central Collector receives from many services and exports to Langfuse.
- Agent pattern: a local Collector per host or node handles buffering and forwards upstream.
- Blast radius: a gateway outage affects all senders, so plan capacity and restarts with that in mind.
- Ownership: agree who may change shared pipeline settings and how application teams request changes.
Identify how many LLM applications will send traces in the first phase and how many are planned, since that count usually decides the pattern.
A Collector adds a component to patch, monitor and secure. Collector releases ship as contrib distributions with signed artifacts, SHA256 checksums and SBOM files, and the Collector builder lets you compile a distribution containing only the components you need, which reduces the attack surface. Each release must be tested against your configuration, and some components have mixed stability levels documented in their README files, so upgrades can change behavior. Server components bind to localhost by default since v0.110.0, but you still need to set listening addresses and TLS deliberately for any receiver that other services reach.
- Patch cycle: track releases, verify checksums and signatures, and test configuration before rollout.
- Minimal builds: use the Collector builder so only the receivers, processors and exporters you use are present.
- Self-monitoring: watch the Collector's own health, queue sizes and dropped data, so silent loss is visible.
- Network exposure: restrict receiver ports to the services that send data.
- Recovery: keep the configuration in version control so a failed node can be rebuilt quickly.
Ask your platform team who will own Collector upgrades and alerting, since direct export avoids this entire operating load.
Direct export suits a small number of applications, a team that owns both application and telemetry code, and a low risk profile for the content of traces. A Collector suits organizations where several teams send LLM telemetry, where redaction and credential handling must be reviewed centrally, or where the same pipeline will later carry other signals to other back ends. Because the Collector is vendor-agnostic, it also keeps the option to add or change a back end without touching every application. Most teams that start with direct export can move to a Collector later by changing the exporter endpoint in each application.
- Start direct: for one application in a controlled test environment, when content risk is low.
- Start with a Collector: when several teams, shared redaction rules or central credential control are required.
- Plan for change: changing the endpoint later is a smaller task than redesigning redaction after launch.
- Future signals: a Collector can later carry metrics and logs alongside traces.
- Review gate: have security and the application owner sign off on which attributes leave the network.
Before committing, write down which attributes your LLM spans carry, who may read them in Langfuse and who approves the redaction rules.
Configuration options for the Langfuse OTLP path and when each fits
This table compares the main configuration choices for sending LLM traces from applications to a self-hosted Langfuse OTLP endpoint, including the direct SDK path and a Collector in between. Read each row against your number of teams and your redaction and credential requirements, then confirm exact endpoint paths and header formats against the Langfuse documentation for your version.
| Option | What it does | When it fits | What to confirm |
|---|---|---|---|
| Direct export from the SDK | Application exports OTLP traces straight to the Langfuse /api/public/otel endpoint with a Basic Auth header | One application or a small pilot where each team manages its own keys | Endpoint path and header encoding for your Langfuse version |
| Basic Auth header from public and secret keys | Encodes the project public and secret keys into the Authorization header | Any path to Langfuse, since this is the documented authentication method | Key scope per project and how keys are rotated and stored |
| otlphttp exporter in the Collector | Collector sends traces to Langfuse, so applications only talk to the Collector | Many applications or teams that should share one exit point and one place to change credentials | Exporter endpoint, headers and TLS settings against your deployment |
| oauth2client extension | Adds credentials to outgoing exporter requests from the Collector | When the Collector must attach tokens to requests it sends onward | Whether your Langfuse setup accepts the token type you plan to use |
| Authenticator extension on receivers | Checks credentials on incoming connections to the Collector, for example OIDC | Shared gateways where applications from several teams must prove identity before data is accepted | Which authenticator types your Collector distribution includes |
| Redaction processor | Removes or masks sensitive attributes before export | Any LLM workload where prompts, completions or user identifiers may contain regulated or personal data | Which attribute keys your instrumentation emits and which rules your data owners require |
| Batching and retry settings | Groups spans before sending and retries failed exports | Higher trace volume or unstable links to Langfuse, where you need to tune delay against loss risk | Queue sizes and retry limits, which depend on your trace volume and memory budget |
| Collector deployment pattern | Agent next to each service or a central gateway receiving from many sources | Agents suit a single application with local control; a gateway suits several teams sharing one secured entry point | Sizing, scaling and high availability for the gateway in your environment |
Setup sequence for routing LLM traces to Langfuse
This sequence takes an LLM application from no telemetry path to a verified trace in a self-hosted Langfuse project, with redaction tested before the pattern spreads to other services. Each step closes with a check so the team knows the previous step is sound before moving on.
Confirm the Langfuse version and endpoint
Confirm that the self-hosted Langfuse instance runs v3.22.0 or later, since that is the release from which self-hosted deployments accept OTLP traces on the /api/public/otel endpoint. The platform team checks the running version in the deployment and confirms the endpoint is reachable from the application network and, if used, from the Collector host. Record the base URL and the version in the implementation notes. Done means a reachable endpoint and a recorded version that meets the minimum. If the instance is older, plan the upgrade first, because the upgrade path is a separate piece of work.
Create project keys for the trace destination
A project owner in Langfuse creates a project for this workload and generates a public and secret key pair in the project settings. Use one project per application or environment so that access and data separation stay clear. Store the keys in your secrets manager, not in source code or container images. Confirm the Basic Auth credential is built from the public key as the username and the secret key as the password, following the Langfuse OpenTelemetry documentation. Done means the keys exist in the secrets store with a named owner and the project is visible to the team that will review traces.
Configure the OTLP exporter or Collector
Point the exporter at the Langfuse OTLP endpoint and send the Basic Auth header built from the project keys. For a direct setup, the SDK's OTLP exporter carries the header. For a Collector in between, add an OTLP HTTP exporter in the Collector configuration and inject the credential from an environment variable or a secret reference, not as a literal value in the file. Restrict the Collector's receiver to localhost or to known sources, since recent Collector releases bind server components to localhost by default. Done means the configuration validates and the Collector starts, with no credential visible in the rendered configuration or logs.
Instrument one LLM call with a known span name
Add OpenTelemetry instrumentation to a single LLM call in one service, and give the span a distinctive, test-only name such as llm-trace-smoke-test so it is easy to find. Run the call in a non-production environment with synthetic input, not customer data. Use the SDK for the application's language, since trace APIs and SDKs are stable in most languages. Done means one request produces a span that the exporter sends without errors. Check the application and Collector logs for export failures before going further.
Verify the trace appears in the project
Open the Langfuse project and find the trace by the test span name and the time of the call. Confirm that the trace shows the expected hierarchy, model name and token fields if your instrumentation emits them, and that the project receiving it is the one the keys belong to. If the trace is missing, check the endpoint URL, the Basic Auth header format, the key pair, and whether the Collector's exporter reports errors. Done means the test trace is visible in the correct project, and the team records the exact steps that produced it so they can be repeated.
Add redaction rules and inspect stored attributes
Before any production prompt is sent, define which attributes must not reach Langfuse. Prompt text, completions, retrieved documents, user identifiers and tool arguments are the usual candidates, and the list should come from the data owner and the privacy or compliance team. Apply removal in the application's instrumentation or, when a Collector is in the path, with the redaction processor. Then send a test prompt containing a unique marker string and open the stored trace. Done means the marker does not appear in any stored attribute, and the redaction configuration is reviewed and saved with the implementation record.
Retest after every redaction change
Rerun the same test call with the marker string after each change to instrumentation or Collector processing, and confirm the trace still arrives with the expected structure. Redaction rules can drop fields the team later needs, so also confirm that non-sensitive metadata such as span name, latency and model identifier remain present. Record each test result with the date, the configuration version and the person who ran it. Done means the retest passes on the current configuration and the results are stored where the security review can find them.
Roll out to other services in stages
Apply the tested configuration to the next service, repeating the key, exporter, redaction and verification steps for each one rather than copying a configuration without checks. Keep a list of services, owners, projects and the version of the redaction rules each one uses. Review the Langfuse project access list as the number of teams grows, since per-project roles are part of the Enterprise license feature set. Done means each service has a documented owner, a passing marker test and a named project, and the team can explain where its traces go.
What to redact before the first trace leaves the application
Decide what may leave the application before any exporter is configured, because LLM spans carry more sensitive material than most request traces. A typical LLM span can hold the full prompt, the model completion, retrieved documents from a knowledge base, user identifiers, session identifiers and the arguments passed to tools. Review every attribute the instrumentation library or your own code adds against your data classification, and mark each one as send, hash, truncate or drop. Pay particular attention to retrieved document text and tool arguments, since these often contain customer records or credentials that the application never intended to log. Confirm which fields your instrumentation library emits by default, because prompt and completion capture settings differ between libraries and versions.
Make prompt and completion capture an explicit decision rather than a default that developers inherit. Set it off in production unless a named owner has approved capture for a defined use, and document who approved it and why. Where capture is approved, apply redaction before the data leaves the Collector. The Collector's redaction processor can remove attributes that match an allowed list or blocked patterns, and its attributes processor can delete, hash or update individual keys such as user identifiers. Test each rule with sample spans from a non-production environment and confirm that the Langfuse trace view still shows what your team needs for debugging. Keep the Collector configuration under version control and restrict who can change it, as the OpenTelemetry security guidance recommends. Langfuse server-side data masking is an Enterprise feature that requires a license key, so treat masking at the source or in the Collector as your baseline and confirm with your Langfuse license holder what the open source version offers before relying on any other control.
Security and operational considerations for LLM trace pipelines
Traces from LLM applications often carry prompts, completions, user identifiers and tool arguments, so the pipeline between the application and Langfuse needs the same controls as any system holding sensitive data. The cards below cover the Collector configuration, the network path, the Langfuse credentials and the Langfuse deployment itself, which together decide what data leaves the application and who can read it.
Store Collector configuration and keys securely
The Collector configuration holds the Langfuse Basic Auth credentials, usually as a base64 value built from the public and secret keys. Keep that value out of files committed to source control and inject it from a secrets store or Kubernetes secret instead, and restrict who can read the Collector's configuration volume. Ask who can view the Collector's environment variables in your platform, because those are often visible to anyone with pod or host read access.
Collector security practicesEncrypt traffic to Langfuse
Send traces from the Collector to the Langfuse OTLP endpoint over HTTPS, and terminate TLS at the Langfuse ingress with certificates your organization manages. Because the Basic Auth credentials travel with every export, plain HTTP inside a shared network is not an acceptable path for production. Confirm that the exporter's TLS settings verify the server certificate and that any internal certificate authority is trusted by the Collector image.
Authenticate Collector receivers
Application SDKs send OTLP to the Collector's receivers, and an unauthenticated receiver lets any workload on the network inject traces into your Langfuse projects. Apply an authenticator extension, such as OIDC for the receiver, so only known services can send data. Test the setup by sending a request without credentials and confirming that it is rejected before go-live.
Use least-privilege Langfuse project keys
Langfuse authenticates OTLP requests with a public and secret key pair tied to one project. Create a separate project for each application or environment, so a leaked key exposes only that project's traces. Plan a rotation procedure that updates the Collector secret and restarts the pipeline, and record which team owns each key.
Build the Collector with only needed components
The contrib distribution includes many receivers, processors and exporters that a Langfuse pipeline never uses. Build a custom Collector with the Collector Builder so the binary includes only the OTLP receiver, the processors you run, the redaction processor and the OTLP HTTP exporter. Fewer components mean fewer dependencies to patch and a smaller set of ports and features to review.
Rely on the localhost default bind
Since Collector v0.110.0, server components bind to localhost by default instead of all interfaces. Keep that default for any receiver that only serves a local application, and bind to a specific interface or front the receiver with a gateway only when a remote application must reach it. When you upgrade an older Collector, check that the new default does not break existing sidecar or DaemonSet traffic, and confirm the bind address with a test from a separate host.
Monitor Langfuse containers and retention
A self-hosted Langfuse runs Web, Worker, PostgreSQL, ClickHouse, Redis or Valkey and blob storage, and a failure in any one stops traces from appearing. Monitor container health, worker queue backlog, ClickHouse disk use and blob storage errors, and alert on them. Set data retention deliberately, because trace content such as prompts persists for as long as the retention policy allows, and confirm whether your license tier includes retention policy controls before you rely on them.
Langfuse license key docsQuestions teams ask before routing LLM traces to self-hosted Langfuse
What drives the cost and effort of sending LLM traces to self-hosted Langfuse?
Scope drives most of the effort: how many applications are instrumented, how many LLM calls each one makes, and how many redaction rules must run before data leaves your network. The Langfuse side adds infrastructure you run: Langfuse Web, Langfuse Worker, PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible blob storage. ClickHouse and PostgreSQL sizing depends on trace volume and retention, and the upgrade path to v4 adds ClickHouse disk headroom for any historic backfill. Ask any quote to separate one-time work (instrumentation, Collector configuration, redaction design, initial deployment) from recurring work (hosting, backups, upgrades, support retainers).
Can our team set up Langfuse tracing without an outside partner?
Yes, if your team already runs containers, PostgreSQL and object storage, and has engineers who can instrument LLM applications with OpenTelemetry. The harder parts are usually not the first trace. They are the Collector configuration that authenticates and redacts data, the sizing of ClickHouse, and a tested backup and upgrade routine. Many teams keep ownership of the application instrumentation and bring in a partner for the platform build, the redaction design and the hardening review. A short internal pilot on a non-production instance will show which of these gaps your team has.
What does our organization need to provide for the work?
Plan for four inputs before work starts. First, a named owner for data classification who can decide which prompt, completion and metadata fields may leave the application. Second, network paths from the applications and the Collector to the Langfuse endpoint, plus the Collector host or gateway location inside your infrastructure. Third, credentials: Langfuse project keys for Basic Auth, stored in your secrets system rather than in code. Fourth, cloud or data center accounts for the PostgreSQL, ClickHouse, Redis or Valkey and blob storage services. Engineering access to the application repositories and a test environment for trial traces will shorten the build.
How long does a Langfuse tracing project take?
Duration depends on scope: the number of LLM applications, whether the Collector is new or already running, how much redaction logic must be designed, and whether the platform deployment is included. A single application sending traces to a test instance is a much smaller job than a multi-team gateway with production ClickHouse sizing and documented backups. Langfuse documents Docker Compose on a single VM for testing without high availability, and Kubernetes with Helm or Terraform for production. Ask for a written timeline that lists each phase and the decisions that must be made by your team before each one begins.
Is the open-source version of Langfuse enough for regulated workloads?
For many teams, yes. Langfuse states that all core features and APIs are available in the MIT-licensed open source version without limits, and self-hosted deployments use the same codebase as Langfuse Cloud. Files under the ee/, web/src/ee/ and worker/src/ee/ directories fall under a separate enterprise license. Features that need an Enterprise license key include project-level RBAC roles, data retention policies, audit logs, server-side data masking, SCIM provisioning and the instance management API. If your review requires any of these controls, confirm the license terms with Langfuse and plan compensating controls in the Collector, such as redaction before export, for anything the open-source version does not cover.
What should we redact from LLM traces before they reach Langfuse?
Redact before export, not after storage. Prompts and completions often contain customer names, account numbers, health details, credentials pasted by users, and internal documents retrieved by retrieval-augmented generation. Start with a list agreed by your data owner:
- Prompt and completion bodies, unless the classification allows them
- Authorization headers, API keys and tokens in tool call arguments
- User identifiers and email addresses in span attributes
- Retrieved document text and file paths
Then apply the Collector redaction processor to remove these attributes, and test with synthetic prompts that contain fake sensitive values. OpenTelemetry's security guidance recommends this step and encrypted, authenticated Collector configuration.
What changes when we upgrade a self-hosted Langfuse from v3 to v4?
Updates within a major version are non-disruptive and run database migrations at startup, but v3 to v4 is a major upgrade with its own guide. It requires ClickHouse 25.12 or later (26.4 recommended), PostgreSQL 15 or later and Redis 7.0 or later. The data model moves to an observations-first ClickHouse structure, so check dashboards, exports and any integrations that read the old model. If you backfill historic data, plan about 3x ClickHouse disk headroom, as the upgrade guide advises. Test the upgrade on a restored copy of production data, confirm backups first, and schedule the change with the teams that depend on the API.
Does DeployOpen certify our Langfuse deployment for compliance?
No. DeployOpen plans, implements, hardens, backs up, upgrades, documents and supports self-hosted open-source platforms inside your own infrastructure, and it prepares the systems, controls and evidence that a compliance assessment needs. Independent auditors and certification bodies issue audit reports, attestations and certifications. For a Langfuse deployment, the evidence typically covers access control, redaction configuration, backup records and change history. Confirm with your auditor which of these they will sample before the build is scoped.
How DeployOpen scopes and delivers Langfuse trace routing
DeployOpen approaches OpenTelemetry LLM trace routing to self-hosted Langfuse as a written, fixed-scope piece of work inside your own infrastructure. We agree which applications, trace attributes, redaction rules and Collector paths are in scope before any configuration changes.
How we scope
- We inventory the LLM applications, SDKs and trace attributes that will send data to Langfuse.
- We agree in writing which prompt, completion and user fields must be redacted before traces leave your network.
- We confirm where Langfuse will run, which Collector pattern fits, and who owns the Basic Auth credentials.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
How we build
- We configure the OTLP exporter path, through a Collector or directly, and document each hop and its settings.
- We add the redaction processor rules and test them against sample traces that contain representative sensitive content.
- We place Collector configuration in secure storage, build only the components the pipeline needs, and bind endpoints deliberately.
- We verify that traces appear in Langfuse with the expected structure, metadata and token usage fields.
How we hand over
- You receive the Collector configuration, application instrumentation changes and a record of the redaction rules applied.
- We document how credentials are rotated, where secrets live, and how to add a new application to the pipeline.
- We walk your platform and security teams through the test results, including what was redacted and what was not.
- Runbooks cover checking for dropped traces and confirming the Langfuse OTLP endpoint is reachable after changes.
How we support
- Ongoing support, Langfuse upgrades and continuous testing are available as retainers.
- Upgrades to Langfuse follow its documented migration guides, and we plan them against your change process.
- We can retest redaction and routing rules when new LLM applications or trace fields are added.
- Where your auditors or customers ask for evidence, we prepare the configuration and test records. Auditors and certification bodies issue any formal opinion.

