gnodet opened a new pull request, #24425:
URL: https://github.com/apache/camel/pull/24425

   ## Summary
   
   Fixes the intermittent failure of 
`ManagedMessageHistoryAutoConfigIT.testMessageHistory` in 
`camel-opentelemetry-metrics`, reported across various CI architectures.
   
   **Root cause:** The test used 
`await().atMost(1000ms).until(handler::hasLogs)` which only waited for *any* 
log to appear (which could be a non-Camel OTel internal metric), then 
immediately asserted on all metrics. On slow CI architectures (ppc64le, s390x), 
the Camel-specific metrics may not have been exported yet within 1 second. 
Additionally, early metric exports during message processing could contain 
incomplete data, causing the per-entry assertions to fail.
   
   **Fix:**
   - Replace the two-step approach (wait for any log → assert immediately) with 
`await().atMost(20s).untilAsserted(...)` that retries the full set of metric 
assertions until the OTel periodic reader exports Camel metrics
   - Assert on the **last** exported Camel MetricData (which contains the 
complete accumulated histogram data), rather than asserting on every exported 
entry
   - Make `MemoryLogHandler` thread-safe with `CopyOnWriteArrayList` since 
`publish()` is called from the OTel exporter thread while 
`getLogs()`/`hasLogs()` are called from the test thread
   
   ## Test plan
   
   - [x] `ManagedMessageHistoryAutoConfigIT` passes consistently (verified 3 
consecutive runs locally)
   - [x] All 89 unit tests + integration tests pass in the module
   - [ ] CI passes on all architectures
   
   _Claude Code on behalf of @davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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