OpenLLMetry and OpenInference instrumentation for Langfuse

Use OpenLLMetry or OpenInference to send traces from frameworks without a native Langfuse SDK into your self-hosted Langfuse over OTLP. This page covers setup, exporter configuration, attribute mapping and testing.

On this page

OpenLLMetry and OpenInference instrumentation for Langfuse: what it does and when to use it

Use OpenLLMetry or OpenInference when your framework has no native Langfuse SDK integration and you need its traces in self-hosted Langfuse. Langfuse accepts OpenTelemetry traces over OTLP at its /api/public/otel endpoint, and the two instrumentation libraries produce those traces. Langfuse documents both: Langfuse: OpenLLMetry and Langfuse: OpenInference describe the setup for each.

The work divides into three parts. The instrumentation library patches or wraps the framework so that model calls, tool calls and retrieval steps become spans with attributes such as model name, prompts and token counts. The OpenTelemetry SDK and exporter collect those spans, batch them and send them over OTLP to your Langfuse host, authenticated with a project's public and secret keys. Langfuse receives the spans, maps the attributes it recognizes onto its trace, observation and usage model, and stores them in your ClickHouse deployment. If a trace looks wrong, the fault is usually in one of these three layers, so check them in that order: instrumentation coverage first, then exporter settings, then attribute mapping in Langfuse.

Before you choose between the two libraries, confirm three things with your framework and your Langfuse version: which library has instrumentation for the exact framework and version you run, which attribute conventions that library emits, and whether your Langfuse host accepts the OTLP path you configure behind any reverse proxy or gateway. Attribute mapping is where teams lose fidelity, because a span can arrive without the fields the Langfuse UI uses for cost and session views. Plan a test trace in a non-production project and inspect it in the UI before rolling the instrumentation out to every service.

What you need before instrumenting a framework for Langfuse

Instrumenting a framework with OpenLLMetry or OpenInference sends traces through the same path as any other OpenTelemetry client, so most failures happen before a single span is created. The cards below cover what to have in place on the Langfuse side, the application side and the network between them.

Reachable self-hosted Langfuse host

Confirm that your self-hosted Langfuse answers on the host name your application hosts will use, and that the OTLP endpoint sits at /api/public/otel under that host. Check this with a request from an application host, not only from your workstation, because routing and DNS often differ between them. Ask the platform team whether the endpoint is reachable through any gateway or ingress you place in front of Langfuse.

Langfuse OpenTelemetry docs

Langfuse project keys

Create a public and secret key pair in the Langfuse project that will receive the traces, and store them in your secrets manager rather than in source code or container images. Each instrumented service should use keys scoped to the project it belongs to, so that traces from different teams stay separated. Plan how keys are rotated, since changing them means redeploying every service that holds them.

Runtime and framework versions

Check the Python or JavaScript runtime version, and the framework version your application uses, against the support statement in the documentation of the OpenLLMetry or OpenInference library you plan to use. Instrumentation libraries target specific framework releases, so a framework upgrade can silently stop producing spans. Pin the library and framework versions together and record the combination in your change process.

Supported Langfuse version line

Identify the Langfuse version your instance runs and confirm it accepts the OTLP traces your chosen library produces. Langfuse publishes its release history on GitHub, so compare your version with the notes for the release you target. Do not assume support from a version number alone; confirm the exact combination in the library documentation and Langfuse's release notes before you start.

Langfuse releases

Network routes and TLS trust

Open the route from each application host, container or serverless runtime to the Langfuse host on the HTTPS port your deployment uses. Where Langfuse runs behind an internal certificate authority, the application runtime must trust that CA chain, or the exporter will fail with certificate errors that look like timeouts. Confirm egress rules and proxy settings for workloads that run in separate network zones.

Exporter and attribute review

Decide which prompts, completions and user identifiers the instrumentation may send before you enable it in production. Traces from LLM frameworks often contain personal data, so confirm the content capture setting and any masking rule with the team that owns data protection. Note which attributes the library writes so you can later check that Langfuse maps them to the fields your reviewers need.

Choosing OpenLLMetry or OpenInference for your framework

Langfuse documents two third-party instrumentation libraries for frameworks that do not have a native Langfuse SDK integration: OpenLLMetry, maintained by Traceloop, and the OpenInference libraries. Both produce OpenTelemetry spans, and Langfuse accepts them through its OTLP endpoint. The libraries do not cover the same frameworks or model providers equally, so the first check is whether your framework and the providers you call appear in the coverage list of the library you are considering.

  • Framework list: Confirm each framework and version in the library's own documentation, since coverage changes between releases.
  • Provider calls: Check whether the model SDKs your application calls are instrumented, not only the orchestration layer above them.
  • Retrieval and tools: Check whether retriever, embedding and tool-call steps produce spans, because many decisions about RAG debugging depend on them.
  • Gaps: Note any framework with no instrumentation in either library and plan manual spans or a native integration for it.
  • Overlap: Where both libraries cover a framework, pick one per service to avoid duplicate spans.

Before you commit, run a short test in a non-production Langfuse project and inspect the resulting trace tree in the UI.

How instrumented spans reach self-hosted Langfuse

The trace starts in your application, where an instrumentation library such as OpenLLMetry or OpenInference creates spans for framework calls. The OpenTelemetry SDK batches those spans and the OTLP exporter sends them across the trust boundary to the Langfuse Web container at /api/public/otel, over TLS. Check that the exporter reaches the endpoint, that the Basic auth header carries your project keys, and that the Worker and storage tiers process the spans after Web accepts them.

Span path from an instrumented application through the trust boundary into Langfuse.

Configuring the exporter and instrumentation in sequence

This sequence takes an application from no tracing to a verified trace in your self-hosted Langfuse project, with each step confirmed before the next begins. Keys and endpoint settings come first so the instrumentation has somewhere valid to send data.

  1. Create the Langfuse project and API keys

    An administrator of your self-hosted Langfuse instance creates a project for the application, or confirms an existing one, and generates a public and secret API key pair from the project settings. Store the secret key in your secrets manager rather than in source code, and record which project the keys belong to. The step is complete when the keys are visible in the project settings and the team knows which project will receive the traces.

  2. Set the OTLP endpoint and authentication header

    The engineer sets environment variables for your Langfuse host and the OpenTelemetry exporter, pointing the OTLP endpoint at the /api/public/otel path of your instance. The authentication header is a Basic credential built from the public and secret keys, and it should be supplied through the runtime environment, not hard-coded. Confirm the exact variable names and header format against the OpenTelemetry documentation for Langfuse and the instrumentation library version you chose. The step is done when the variables resolve in the runtime that will run the application.

  3. Initialize the tracer provider and OTLP exporter

    In application startup code, the engineer creates an OpenTelemetry tracer provider, attaches a span processor, and configures an OTLP exporter that reads the endpoint and header from the environment. Batch export is the usual choice for services, so spans are sent asynchronously. Run the application once without any framework call and check that it starts without exporter errors in its logs. This step is complete when the provider is registered once per process and the logs show no connection or authentication failures.

  4. Activate the chosen instrumentation library

    The engineer calls the instrumentation library's initializer, either OpenLLMetry (Traceloop) or the OpenInference instrumentor for the framework in use, before the first call to the model or framework is made. Calling it after the framework has been imported and used can leave some calls untraced, so the order in the startup code matters. Check the library's documentation for the framework versions it supports, since coverage varies by release. The step is done when the instrumentor reports as active at startup and no framework call has yet been made without it.

  5. Run one test request through the framework

    Send a single, simple prompt through the instrumented framework, for example a short chain or one model call with a known input. Use a test project or a clearly labeled test user so the trace is easy to find. Avoid real customer data in this first request. The step is complete when the request returns a normal response to the application.

  6. Verify the trace and its spans in Langfuse

    Open the Langfuse project and locate the trace from the test request, which normally appears within a short time after the request completes. Confirm that the expected spans are present, such as the top-level workflow, the model generation and any tool or retriever steps, and that the model name, input and output appear where expected. Check that token usage is captured if the library provides it. If the trace is missing, check the endpoint, the authentication header and the exporter logs before changing instrumentation code. The sequence is complete when the trace shows the expected span hierarchy in the correct project.

  7. Confirm the sequence in each environment

    Repeat the same steps in every environment that will send traces, such as staging and production, using that environment's own project keys and host. Record which library and version were used so later upgrades can be tested against the same trace output. The step is done when each environment shows a verified trace in its designated project, and the configuration record matches what runs.

How instrumentation attributes map to Langfuse trace fields

This table compares where OpenLLMetry and OpenInference place each core value on a span and how Langfuse reads it into an observation field. Use it to check which fields arrive without changes and which ones your application must set. Confirm each mapping against the spans your installed library versions actually emit, because attribute names change between releases.

Langfuse fieldOpenLLMetryOpenInferenceNeeds custom code?
ModelModel name in gen_ai request or response attributes on the LLM spanModel name in llm.model_name on the LLM spanUsually no
InputPrompt content in gen_ai prompt attributes, depending on library version and trace content settingsInput payload in input.value on the spanUsually no, but check content capture settings
OutputCompletion content in gen_ai completion attributesOutput payload in output.value on the spanUsually no
Token usageInput and output token counts in gen_ai usage attributes, when the provider returns themPrompt and completion counts in llm.token_count attributesNo, but confirm the provider reports usage in streamed responses
User IDNo standard end-user attribute in the library; set it through your own association or Langfuse attributeSet through user.id only when your code adds itYes, your application must attach the end-user identifier
Session IDNo standard conversation attribute in the library; set it through your own association or Langfuse attributeSet through session.id only when your code adds itYes, your application must attach the conversation identifier

Where OpenLLMetry and OpenInference differ in practice

The practical difference between OpenLLMetry and OpenInference shows up in what the trace looks like inside Langfuse, not in whether traces arrive. Both libraries emit OpenTelemetry spans that Langfuse accepts at its /api/public/otel endpoint, but they name spans differently and set different attributes, so a dashboard, filter or evaluator written against one library may find nothing when the other is used. Before you build anything on top of the traces, run one representative request through each library in a test project and record the span names, the attribute keys and the observation types that Langfuse displays for it.

Prompt and completion capture is the setting most teams will need to control. Each library exposes its own switch for recording message content, and the switch is typically an environment variable or initialization argument rather than a Langfuse setting, so it must be set in every service that emits spans. Confirm the exact variable name and its default in the release of the library you pin, because defaults have changed between versions. Also confirm whether the library records token usage and model names as attributes that Langfuse maps to usage and cost, since missing usage fields will leave cost tracking blank even when the trace itself looks complete.

Content privacy settings decide what leaves your application and reaches your Langfuse instance. If content capture is off, the trace still carries timing, model and error information, which may be enough for latency work but not for debugging answers or running evaluations on outputs. If content capture is on, prompts with personal data will be stored in ClickHouse and blob storage under your retention settings, so align the choice with your data protection review and, where it is available on your license, with data masking. Treat the behavior described in each library's documentation as a starting point only, and verify it with a test prompt containing a known marker string before approving either setting for production.

Securing the telemetry path to self-hosted Langfuse

Traces from OpenLLMetry and OpenInference instrumentation leave your application, cross your network and land in a store that someone on your team can read. Each control below closes one part of that path, from the project keys the exporter holds to the people who can open the resulting traces.

Keep project keys out of code

The exporter authenticates to /api/public/otel with a Langfuse public and secret key sent as a Basic authorization header. Store both in your secrets manager and inject them as environment variables at runtime, so neither appears in source control, container images or build logs. Create a separate project and key pair for each application or environment, so a leaked key can be revoked without disrupting other services. Confirm your rotation procedure before the first production deployment.

Langfuse OpenTelemetry docs

Require TLS on the OTLP endpoint

Trace payloads carry prompts, completions, user identifiers and the authorization header itself, so the exporter should only send them over HTTPS to your Langfuse host. Point the OTLP exporter at the https address of your load balancer or ingress, and reject plain HTTP at the edge. If you use an internal certificate authority, make sure the application runtime trusts it, and do not disable certificate verification to get a working connection.

Limit which hosts reach the ingest path

The /api/public/otel path needs to be reachable only from the application networks that export traces, not from the whole corporate network or the internet. Restrict it with network policies, security groups or ingress allow lists, and keep the Langfuse web interface on a separate, narrower route. Review the list whenever a new service starts exporting traces, because each new source widens who can write data into your project.

Decide on capturing prompts and completions

Instrumentation libraries can record prompt and completion text as span attributes, and those texts often contain names, contact details or customer records. Decide per application whether content capture is on, and document the decision with the data owner. Where content is not needed for debugging, disable it in the instrumentation configuration, and set retention in Langfuse so that stored traces expire on a schedule your privacy team has approved.

Review trace access with project RBAC

Anyone with access to a Langfuse project can read the full traces for it, including captured content. Project-level RBAC roles let you limit who can view, annotate or manage traces in each project, and they require an Enterprise license key. Without that key, plan project boundaries so that sensitive applications export to projects that only the responsible team can open, and confirm the current role model with Langfuse before you rely on it.

Langfuse license key docs

Why traces from OpenLLMetry or OpenInference do not appear in Langfuse

This table lists the failures teams hit most often when OpenLLMetry or OpenInference traces fail to show up in a self-hosted Langfuse, with the likely cause and the check to run in your environment. Work through the rows in order, since the endpoint and authentication checks rule out the most common causes quickly. Most missing traces trace back to one of these six items.

SymptomLikely causeWhat to check in your environment
No traces at all, no errors in the applicationWrong endpoint pathConfirm the exporter points at your Langfuse host with the /api/public/otel path, not the bare host or the UI URL.
Export returns 401 or 403Missing or wrong authentication headerConfirm the Authorization header carries the Basic credential built from your project public and secret keys, and that the keys belong to the target project.
Only some spans appear, or the framework calls are missingInstrumentation enabled after the framework client was createdConfirm the instrumentor is initialized before the LLM or framework client is constructed, since clients created earlier may not be wrapped.
Export fails with certificate or handshake errorsTLS trust errors on a private certificateConfirm the application runtime trusts your internal certificate authority and that the exporter uses the correct CA bundle path.
Traces arrive minutes after the run or are lost on short scriptsExporter batching delays or drops spans at exitConfirm the span processor flushes before the process exits, and test with a short-lived run and an explicit flush.
Traces appear but inputs, outputs, model or usage fields are blankAttributes not mapping as expectedCompare emitted attribute names in the instrumentation library version you run against the Langfuse OpenTelemetry mapping, and confirm the library version matches your framework.

Questions teams ask before instrumenting frameworks for Langfuse

What drives the cost of instrumenting frameworks with OpenLLMetry or OpenInference?

The cost follows the amount of instrumentation work, which grows with the number of frameworks, the language mix and how much attribute customization you need. Each framework has its own instrumentation package, span shape and version pinning, so five frameworks in one Python service cost less to coordinate than the same five spread across Python, TypeScript and Java services. Testing depth is the other major driver: checking that spans appear in the right Langfuse project with correct token counts, model names and user or session attributes takes longer than the install itself. Ask any partner for a quote that lists frameworks, languages, the attributes you need mapped and the test cases they will run, since those items set the effort.

How long does setup take in our environment?

No fixed duration applies because it depends on your environment, not on the libraries alone. The main variables are how many applications emit traces, whether they already run OpenTelemetry Collectors, how your network reaches the Langfuse host, and whether security review is needed before a new egress path or credential is approved. A single service with one framework and a working test project is a short exercise, while a multi-team rollout with review gates takes longer. Ask for a timeline in the written scope that separates environment access, instrumentation, attribute mapping and verification.

What must our team provide before instrumentation starts?

Three inputs decide whether the work moves quickly. First, named framework owners for each application who can confirm versions, deployment targets and which trace attributes matter to them. Second, a test Langfuse project with API keys scoped for non-production use, so traces can be checked without mixing test data into production analytics. Third, network access from the application runtime to your Langfuse host on the OTLP endpoint at /api/public/otel, along with any proxy or allowlist rules. Confirm with your Langfuse administrator which host URL and key format your deployment uses before the first trace is sent.

Can our internal team instrument frameworks for Langfuse without a partner?

Yes, if you have engineers who own the applications and can read OpenTelemetry basics. The libraries are third-party projects, the Langfuse documentation covers both OpenLLMetry and OpenInference setup, and a single pilot framework is a reasonable first step. Where internal teams usually struggle is consistency: each team picks its own attribute names, forgets to set user or session identifiers and does not verify that prompts and completions are captured as intended. A partner is most useful when you need one attribute standard across many services, a documented test plan or a review before rollout. Either path needs a named owner who keeps the instrumentation versions current after the first release.

Do these traces require a Langfuse Enterprise license?

No. Langfuse states that all core features and APIs are available in the MIT-licensed open source version without limits, and the OTLP endpoint that receives OpenLLMetry and OpenInference traces is part of the core API. Enterprise features such as project-level RBAC roles, audit logs, server-side data masking and data retention policies need an Enterprise license key, so you only need one if you require those controls. Confirm the current license terms in the Langfuse LICENSE file and pricing page before you commit, because the enterprise directories are covered by a separate license.

What happens to our traces if the framework version changes?

Instrumentation libraries track framework releases, so a framework upgrade can rename spans, change attributes or stop an instrumentation from matching. Plan for this by pinning instrumentation package versions, adding a verification step to your release checks and reviewing trace output after each framework upgrade. Ask your partner or internal owner how they will detect a silent drop in token counts or missing prompts, because that is the failure most teams notice late. Support and retainer terms for this kind of ongoing check are set in the written scope.

Will sending prompts and completions expose personal data?

It can. Instrumentation often captures prompt and completion text, which may contain personal or confidential data. Decide before rollout which fields to capture, which attributes to suppress and who can see traces in each project. Server-side data masking and retention policies are Enterprise features in self-hosted Langfuse, so if you need them, factor the license into the quote. Your privacy and security teams should review the attribute list before any production service is connected.

How DeployOpen scopes and delivers OpenTelemetry tracing into self-hosted Langfuse

DeployOpen treats OpenLLMetry and OpenInference instrumentation as part of the platform build, not an afterthought in each application team's code. We scope which frameworks send traces, configure the OTLP exporter against your self-hosted Langfuse, and verify that the attributes your reviewers need arrive intact.

How we scope

  • We inventory the frameworks and services that need tracing and record which instrumentation library covers each one.
  • The written scope names the Langfuse host, the /api/public/otel endpoint, and the projects that will receive traces.
  • We define the attribute mapping, user and session fields, and any content capture rules before instrumentation starts.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work begins.

How we build

  • We instrument a representative application first, then extend the same exporter configuration to the remaining services.
  • Exporter settings, credentials and host addresses are kept in your secrets store, not hard-coded in application images.
  • We test trace completeness, span nesting, token fields and attribute mapping against the traces Langfuse displays.
  • We check that prompts, completions and personal data follow the masking and retention choices your team has agreed.

How we hand over

  • You receive a configuration guide covering each instrumented service, its exporter settings and the attributes it emits.
  • A runbook explains how to add a new framework, rotate exporter credentials and confirm traces are arriving.
  • We walk your engineers through the verification checks so they can repeat them after handover.
  • Documentation is written for the teams who will maintain the instrumentation, including version pinning notes for each library.

How we support

  • Ongoing support, library upgrades and continuous testing are available as a retainer, scoped to your instrumented services.
  • We recheck attribute mapping when OpenLLMetry or OpenInference releases change span names or fields.
  • Before a Langfuse upgrade, we confirm that instrumented services still send traces to the new version, using a test environment.
  • Ask for the support scope, response expectations and upgrade testing in writing before you sign a retainer.

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.