Omar Atie created CAMEL-24556:
---------------------------------

             Summary: Add LangChain4jAgentObservabilityTest for span emission
                 Key: CAMEL-24556
                 URL: https://issues.apache.org/jira/browse/CAMEL-24556
             Project: Camel
          Issue Type: New Feature
            Reporter: Omar Atie


h2. Background

During review of apache/camel PR #25337 (Phase 1), Claus Ibsen repeatedly 
requested producer-level observability tests for all instrumented components. 
Tests were added for:

* langchain4j-chat (LangChain4jChatObservabilityTest)
* langchain4j-embeddings (LangChain4jEmbeddingsObservabilityTest)
* openai (OpenAIObservabilityTest)

langchain4j-agent has observability wired in LangChain4jAgentProducer but only 
LangChain4jAgentResultHeadersTest — no dedicated span/metrics test.

h2. Problem

Missing test coverage for agent producer observability violates project rule 
that PRs include tests for new functionality. Regression risk for gen_ai.* span 
attributes and token usage on agent routes.

h2. Proposed scope

* Add LangChain4jAgentObservabilityTest mirroring existing observability tests 
(chat/embeddings/openai)
* Add test-scoped dependency on camel-ai-observability + camel-telemetry in 
camel-langchain4j-agent/pom.xml (same pattern as camel-langchain4j-chat)
* Verify span attributes: gen_ai.operation.name, gen_ai.system, 
gen_ai.request.model, token usage where available
* Use AssertJ; no Thread.sleep (MockEndpoint timed assertions or Awaitility)

h2. References

* Parent: CAMEL-23861
* apache/camel PR #25337 review comments from davsclaus
* 
components/camel-ai/camel-langchain4j-agent/src/main/java/.../LangChain4jAgentProducer.java
* Reference tests: LangChain4jChatObservabilityTest, 
LangChain4jEmbeddingsObservabilityTest

h2. Acceptance criteria

* New test class passes in CI
* Test verifies GenAiObservability.start() path emits expected telemetry when 
enabled
* Test verifies no-op or disabled behavior when 
camel.aiObservability.enabled=false
* Follows existing observability test conventions in camel-ai modules



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

Reply via email to