Claus Ibsen created CAMEL-23861:
-----------------------------------

             Summary: camel-langchain4j - Add OpenTelemetry span attributes for 
AI/LLM observability
                 Key: CAMEL-23861
                 URL: https://issues.apache.org/jira/browse/CAMEL-23861
             Project: Camel
          Issue Type: Improvement
          Components: camel-langchain4j-agent, camel-langchain4j-embeddings, 
camel-langchain4j-chat, camel-langchain4j-tools
            Reporter: Claus Ibsen


The camel-langchain4j components currently have no OpenTelemetry integration 
for AI/LLM-specific observability. Token usage, model name, finish reason, and 
latency are not captured as span attributes.

Spring AI exposes this data through OpenTelemetry spans following the 
OpenTelemetry Semantic Conventions for GenAI 
(https://opentelemetry.io/docs/specs/semconv/gen-ai/), which enables tools like 
Boot UI to build AI Usage dashboards showing token consumption, costs, model 
distribution, and conversation tracking.

Camel should follow the same approach. When camel-opentelemetry (or 
camel-opentelemetry2) is active, the langchain4j producers should enrich spans 
with standard GenAI semantic convention attributes such as:

- gen_ai.system (e.g. openai, anthropic)
- gen_ai.request.model
- gen_ai.response.model
- gen_ai.usage.input_tokens
- gen_ai.usage.output_tokens
- gen_ai.response.finish_reasons

This would allow standard OpenTelemetry tooling (Jaeger, Grafana, etc.) and 
Camel TUI to visualize AI/LLM usage across routes.

See also CAMEL-23860 which adds token data as exchange headers - this ticket is 
about also propagating that data into OTel spans for observability tooling.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to