[
https://issues.apache.org/jira/browse/CAMEL-23861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-23861:
--------------------------------
Description:
The camel-langchain4j components currently have no observability integration
for AI/LLM-specific metrics and tracing. Token usage, model name, finish
reason, and latency are not captured.
Spring AI exposes this data through the Micrometer Observation API (which
produces both metrics and traces) following the OpenTelemetry Semantic
Conventions for GenAI (https://opentelemetry.io/docs/specs/semconv/gen-ai/).
This enables dashboards showing token consumption, costs, model distribution,
and conversation tracking.
Camel should follow the same approach. When camel-micrometer or
camel-opentelemetry2 is active, the langchain4j producers should capture:
*OpenTelemetry span attributes (GenAI semantic conventions):*
- 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
*Micrometer metrics:*
- Token counters (input/output/total) with model tag
- Request counters per model/operation
- Latency timers/histograms
- Error counters
This would allow standard observability tooling (Grafana, Jaeger, Prometheus,
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 propagating that data into the observability layer for monitoring and
dashboards.
was:
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.
Summary: camel-langchain4j - Add OpenTelemetry and Micrometer
observability for AI/LLM usage (was: camel-langchain4j - Add OpenTelemetry
span attributes for AI/LLM observability)
> camel-langchain4j - Add OpenTelemetry and Micrometer observability for AI/LLM
> usage
> -----------------------------------------------------------------------------------
>
> Key: CAMEL-23861
> URL: https://issues.apache.org/jira/browse/CAMEL-23861
> Project: Camel
> Issue Type: Improvement
> Components: camel-langchain4j-agent, camel-langchain4j-chat,
> camel-langchain4j-embeddings, camel-langchain4j-tools
> Reporter: Claus Ibsen
> Priority: Major
> Labels: ai, observability
>
> The camel-langchain4j components currently have no observability integration
> for AI/LLM-specific metrics and tracing. Token usage, model name, finish
> reason, and latency are not captured.
> Spring AI exposes this data through the Micrometer Observation API (which
> produces both metrics and traces) following the OpenTelemetry Semantic
> Conventions for GenAI (https://opentelemetry.io/docs/specs/semconv/gen-ai/).
> This enables dashboards showing token consumption, costs, model distribution,
> and conversation tracking.
> Camel should follow the same approach. When camel-micrometer or
> camel-opentelemetry2 is active, the langchain4j producers should capture:
> *OpenTelemetry span attributes (GenAI semantic conventions):*
> - 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
> *Micrometer metrics:*
> - Token counters (input/output/total) with model tag
> - Request counters per model/operation
> - Latency timers/histograms
> - Error counters
> This would allow standard observability tooling (Grafana, Jaeger, Prometheus,
> 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 propagating that data into the observability layer for monitoring
> and dashboards.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)