Observability for Quarkus LangChain4j with Opik
Configure Quarkus LangChain4j OpenTelemetry export to send traces to Opik.
Quarkus LangChain4j uses Quarkus OpenTelemetry configuration in application.properties.
When this guide applies
Section titled “When this guide applies”Use this if your app is Quarkus + LangChain4j and you want OTEL traces to land in Opik.
Opik OTLP endpoint modes
Section titled “Opik OTLP endpoint modes”For full endpoint/header details, see Opik OpenTelemetry overview.
- Cloud endpoint:
https://www.comet.com/opik/api/v1/private/otel - Enterprise endpoint:
https://<comet-deployment-url>/opik/api/v1/private/otel - Self-hosted endpoint:
http://localhost:5173/api/v1/private/otel
Example (application.properties)
Section titled “Example (application.properties)”Intent: Configure Quarkus OTEL trace exporter to target Opik directly.
Applies when: You are using Quarkus-native OTEL exporter settings.
Required fields:
quarkus.otel.enabled=truequarkus.otel.traces.enabled=truequarkus.otel.exporter.otlp.traces.endpointquarkus.otel.exporter.otlp.traces.protocol=http/protobuf
Recommended fields:
quarkus.langchain4j.tracing.include-prompt=trueandquarkus.langchain4j.tracing.include-completion=true: without them, LLM spans arrive with model and token usage but no input or output (both default tofalse)quarkus.langchain4j.tracing.include-tool-arguments=trueandquarkus.langchain4j.tracing.include-tool-result=trueif your AI services call tools
Optional fields:
quarkus.otel.exporter.otlp.traces.headers(projectNamestrongly recommended)quarkus.application.name(forservice.nameattribution)
Minimal valid setup:
quarkus.otel.enabled=true
quarkus.otel.traces.enabled=true
quarkus.otel.exporter.otlp.traces.endpoint=https://www.comet.com/opik/api/v1/private/otel
quarkus.otel.exporter.otlp.traces.protocol=http/protobuf
quarkus.otel.exporter.otlp.traces.headers=Authorization=<your-api-key>,Comet-Workspace=<your-workspace>,projectName=<your-project-name>
# Send prompt and completion text, not just model and token counts
quarkus.langchain4j.tracing.include-prompt=true
quarkus.langchain4j.tracing.include-completion=trueValidation
Section titled “Validation”- Start your Quarkus app with OTEL enabled.
- Trigger a LangChain4j-backed endpoint/action.
- Confirm spans with your configured
service.nameand project headers arrive in Opik. - Open the
completion <model>span: it should show the model, token usage, the prompt as input and the model response as output. If input and output are empty, check theinclude-prompt/include-completionsettings above.