atiaomar1978-hub opened a new pull request, #26105:
URL: https://github.com/apache/camel/pull/26105

   ## Summary
   
   Changes `GenAiUsage` token fields from `Integer` to `Long` so OpenAI and 
other providers that report `long` token counts are recorded without lossy 
`(int)` casts or `Math.toIntExact` failures.
   
   Follow-up to CAMEL-23861 / review on PR #25337.
   
   ## Changes
   
   - **`GenAiUsage`**: `inputTokens` and `outputTokens` are now `Long`; primary 
factory accepts `Long`; convenience overload keeps `Integer` for 
LangChain4j/Spring AI call sites
   - **`OpenAIProducer`**: passes `usage.promptTokens()` / 
`usage.completionTokens()` directly (removed `toTokenCount` helper)
   - **`OpenAIEmbeddingsProducer`**: sets prompt/total token headers as `long` 
(no `(int)` cast)
   - **`GenAiMicrometerSupport`**: records token counters with 
`increment(double)` for large values
   - **Tests**: `GenAiUsageTest` plus large-token, null/zero, and span coverage
   - **Upgrade guide**: note that `GenAiUsage` uses `Long` token fields
   
   ## Testing
   
   ```bash
   ./mvnw -pl 
components/camel-ai/camel-ai-observability-api,components/camel-ai/camel-ai-observability
 -am test \
     -Dtest=GenAiUsageTest,GenAiObservabilityTest,GenAiObservabilitySpanTest
   ```
   
   ## Review notes (Bugbot + Grok)
   
   - Fixed embeddings producer header truncation flagged by Bugbot
   - Added null/zero Micrometer counter guard test per Grok review
   
   _AI-generated PR description on behalf of atiaomar1978-hub_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to