OpenTelemetry Integration
When the quarkus-opentelemetry extension is present in your project, the Langfuse extension automatically exports OpenTelemetry span data to Langfuse. No additional configuration is needed — the extension uses your existing quarkus.ai-telemetry.langfuse.public-key and quarkus.ai-telemetry.langfuse.secret-key for authentication.
Trace Sampling
Quarkus 4 samples 10% of traces by default. Sampling happens before any exporter runs, so an application that does not configure a sampler sends only a tenth of its LLM traces to Langfuse. To capture every trace:
quarkus.otel.traces.sampler=always_on
This is a standard Quarkus OpenTelemetry setting and applies to all exporters, not just Langfuse. If you keep the default ratio-based sampler, expect the traces in Langfuse to be a sample rather than a complete record.
Export Target
The quarkus.ai-telemetry.langfuse.otel.export-target property (build time) controls how spans are exported:
-
ALL(default) — The extension registers a dedicated Langfuse span processor that runs alongside any other OpenTelemetry exporters you have configured. Spans are exported to both Langfuse and your standard OTLP backend (Jaeger, Zipkin, or any other collector). In this mode, only AI-related spans are sent to Langfuse by default (see AI Span Filtering below), and the GenAI semantic convention message attributes are automatically mapped to the Langfuse trace input and output. -
LANGFUSE_ONLY— The standard OpenTelemetry OTLP exporter is configured to send directly to Langfuse. No separate span processor is registered and no additional OTLP backend receives spans. All spans are exported to Langfuse without filtering. This is equivalent to the manual configuration described in the Quarkus LangChain4j docs, but handled automatically by the extension.
quarkus.ai-telemetry.langfuse.otel.export-target=LANGFUSE_ONLY
HTTPS / TLS
When quarkus.ai-telemetry.langfuse.base-url (or trace-ingestion-url) uses https:// and export-target=ALL (the default), the dedicated Langfuse OTel exporter automatically connects over TLS with ALPN enabled.
By default, the exporter uses the Quarkus TLS registry and honours the TLS configuration specified in quarkus.ai-telemetry.langfuse.otel.tls-configuration-name. This setting defaults to ${quarkus.otel.exporter.otlp.traces.tls-configuration-name:} (the OTel traces exporter’s TLS configuration), falling back to the default quarkus.tls.* configuration if neither is explicitly set.
For example, to configure a custom CA certificate or mTLS for the Langfuse exporter:
quarkus.ai-telemetry.langfuse.base-url=https://langfuse.internal.corp
quarkus.ai-telemetry.langfuse.otel.tls-configuration-name=langfuse-tls
quarkus.tls.langfuse-tls.trust-store.pem.certs=/path/to/langfuse-ca.crt
When using export-target=LANGFUSE_ONLY, the standard Quarkus OpenTelemetry exporter is used instead, and TLS is configured using the standard quarkus.otel.exporter.otlp.* TLS configuration properties.
|
Proxy Support
When export-target=ALL, the dedicated Langfuse exporter can connect through an HTTP/HTTPS proxy via quarkus.ai-telemetry.langfuse.otel.proxy-options.*:
quarkus.ai-telemetry.langfuse.otel.proxy-options.enabled=true
quarkus.ai-telemetry.langfuse.otel.proxy-options.host=proxy.internal.corp
quarkus.ai-telemetry.langfuse.otel.proxy-options.port=8080
If proxy-options.enabled=true and host is omitted, the exporter automatically falls back to the standard JDK system properties (https.proxyHost/https.proxyPort for HTTPS, or http.proxyHost/http.proxyPort for HTTP).
Export Failure Logging
When span exports to Langfuse fail (for instance due to TLS handshake errors, network issues, or HTTP error responses), the dedicated exporter logs a concise warning at WARN level indicating the target URL and root cause (or HTTP status). The full exception stack trace is logged at DEBUG level to keep logs readable during outages.
AI Span Filtering
When export-target=ALL (the default), only AI-related spans and their ancestor spans are exported to Langfuse. A span is considered AI-related if it carries any gen_ai. OpenTelemetry Semantic Convention attributes (such as gen_ai.system, gen_ai.request.model, gen_ai.response.finish_reasons, etc.). A span is also considered AI-related if it carries any langfuse.observation. attribute (such as langfuse.observation.type=chain), which lets instrumentation request a Langfuse observation type without adding a made-up gen_ai.* attribute. Ancestor spans — the parent chain leading up to an AI span — are included to preserve trace structure.
This filtering prevents infrastructure noise (HTTP server spans, database queries, framework internals) from cluttering your Langfuse dashboard while still giving you full context around AI operations.
Additionally, the GenAI semantic convention message attributes are automatically mapped to the Langfuse trace input and output fields, so you get immediate visibility into what was sent to and received from the LLM:
-
langfuse.trace.inputcomes fromgen_ai.input.messages, withgen_ai.system_instructionsprepended as asystemmessage for providers that send the system prompt separately from the chat history. -
langfuse.trace.outputcomes fromgen_ai.output.messages.
Both are resolved independently, so a span carrying only one of them still gets it mapped. When the message attributes are recorded as structured OpenTelemetry values (as Quarkus LangChain4j does), they are rendered as JSON, because Langfuse does not decode structured attribute payloads.
The deprecated gen_ai.prompt and gen_ai.completion attributes are used as a fallback, so older Quarkus LangChain4j versions keep working.
To export all spans instead of only AI-related ones:
quarkus.ai-telemetry.langfuse.otel.span-filter=ALL
Quarkus LangChain4j Integration
When both quarkus-opentelemetry and quarkus-langchain4j are on the classpath, the extension automatically enables LangChain4j prompt tracing by setting the following properties to true:
-
quarkus.langchain4j.tracing.include-prompt -
quarkus.langchain4j.tracing.include-completion -
quarkus.langchain4j.tracing.include-tool-arguments -
quarkus.langchain4j.tracing.include-tool-result
This means prompt content, LLM responses, tool arguments, and tool results are all included in the OpenTelemetry spans emitted by LangChain4j — and therefore visible in Langfuse traces — without any manual configuration.
These defaults are set at a low priority, so you can override any of them in application.properties or via environment variables if needed.
Example
With a simple AI Service
import jakarta.enterprise.context.ApplicationScoped;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import io.quarkiverse.langchain4j.RegisterAiService;
@RegisterAiService
@ApplicationScoped
public interface ChatService {
@SystemMessage("You are a helpful assistant.")
String chat(@UserMessage String prompt);
}
It will automatically send traces to Langfuse:
Zero-Config with DevServices
When DevServices is running, the OpenTelemetry integration works out of the box with no configuration at all. The Langfuse base URL, public key, and secret key are all provided automatically by DevServices, and the span processor uses those values to connect to the local Langfuse instance.
Disabling the Integration
To disable the automatic OpenTelemetry integration (for example, if you want to manage your own OTel exporters or send spans to a different backend):
quarkus.ai-telemetry.langfuse.otel.enabled=false
When quarkus-opentelemetry is not on the classpath, the integration is automatically skipped regardless of this setting.
|
For the full list of OpenTelemetry configuration properties, see the Configuration Reference.