Sending OpenTelemetry LLM traces to self-hosted Langfuse

Route traces from LLM applications instrumented with OpenTelemetry to a self-hosted Langfuse through its OTLP endpoint, with authentication, a Collector in between and redaction in place first.

On this page

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.

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.

OptionWhat it doesWhen it fitsWhat to confirm
Direct export from the SDKApplication exports OTLP traces straight to the Langfuse /api/public/otel endpoint with a Basic Auth headerOne application or a small pilot where each team manages its own keysEndpoint path and header encoding for your Langfuse version
Basic Auth header from public and secret keysEncodes the project public and secret keys into the Authorization headerAny path to Langfuse, since this is the documented authentication methodKey scope per project and how keys are rotated and stored
otlphttp exporter in the CollectorCollector sends traces to Langfuse, so applications only talk to the CollectorMany applications or teams that should share one exit point and one place to change credentialsExporter endpoint, headers and TLS settings against your deployment
oauth2client extensionAdds credentials to outgoing exporter requests from the CollectorWhen the Collector must attach tokens to requests it sends onwardWhether your Langfuse setup accepts the token type you plan to use
Authenticator extension on receiversChecks credentials on incoming connections to the Collector, for example OIDCShared gateways where applications from several teams must prove identity before data is acceptedWhich authenticator types your Collector distribution includes
Redaction processorRemoves or masks sensitive attributes before exportAny LLM workload where prompts, completions or user identifiers may contain regulated or personal dataWhich attribute keys your instrumentation emits and which rules your data owners require
Batching and retry settingsGroups spans before sending and retries failed exportsHigher trace volume or unstable links to Langfuse, where you need to tune delay against loss riskQueue sizes and retry limits, which depend on your trace volume and memory budget
Collector deployment patternAgent next to each service or a central gateway receiving from many sourcesAgents suit a single application with local control; a gateway suits several teams sharing one secured entry pointSizing, 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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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 practices

Encrypt 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 docs

Questions 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.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.