Federico Mariani created CAMEL-27140:
----------------------------------------

             Summary: camel-opentelemetry2 - set chosen exchange values, such 
as a session or user id, as attributes on every span of the exchange, without 
sending them as W3C baggage
                 Key: CAMEL-27140
                 URL: https://issues.apache.org/jira/browse/CAMEL-27140
             Project: Camel
          Issue Type: Improvement
          Components: camel-opentelemetry
            Reporter: Federico Mariani


Tracing backends group traces by session and user through span attributes, for 
example the OpenTelemetry {{session.id}} and {{user.id}}, which Langfuse reads 
as the session and the user of a trace. In Camel, the only way to give the 
spans of an exchange such a value today is baggage, through the 
{{OTEL_BAGGAGE_*}} headers (CAMEL-23564). Baggage does not fit this use:
* It does not become a span attribute. That needs a baggage span processor in 
the application, which only copies the baggage to the spans started while it is 
current, so the consumer span of the route, the root of the trace, does not get 
it.
* It is propagated: every outgoing call carries it in the W3C {{baggage}} 
header. With the OpenTelemetry Java agent, the requests that a route sent to 
the LLM provider carried the session and user id.

Proposal: an option of {{camel-opentelemetry2}} that sets chosen attributes on 
every span of the exchange, the consumer span included, from exchange values (a 
header, a variable or an expression), without propagating them. For example the 
conversation id that the AI components already read 
({{CamelOpenAIConversationId}}, {{CamelSpringAiChatConversationId}}) as 
{{session.id}}. Setting them when a span ends would let a value set during the 
route still reach the consumer span.

CAMEL-27131 sets {{gen_ai.conversation.id}} on the GenAI spans at level 
{{detailed}}; this would cover the other spans of the trace and the user.

_Claude Code on behalf of Croway_




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to