Croway commented on PR #25989:
URL: https://github.com/apache/camel/pull/25989#issuecomment-5490304201

   The diagnostic is useful, but I think the implementation can be much smaller 
by keeping the one-time state in the objects already cached per `CamelContext`.
   
   For the missing implementation, `resolveBridge()` is already called once per 
context:
   
   ```java
   private static ImplBridge resolveBridge(CamelContext camelContext) {
       Class<?> implClass = 
camelContext.getClassResolver().resolveClass(IMPL_CLASS);
       if (implClass == null) {
           LOG.info("GenAI observability is enabled but camel-ai-observability 
is not on the classpath; spans and metrics will not be emitted");
           return UNAVAILABLE_BRIDGE;
       }
       // existing method lookup
   }
   ```
   
   For the Observation path, the cached backend can own a single flag:
   
   ```java
   private final AtomicBoolean missingTracingReported = new AtomicBoolean();
   
   if (!hasTracingContext(observation)
           && missingTracingReported.compareAndSet(false, true)) {
       LOG.info("No Micrometer tracing context was created for GenAI 
observations; configure a tracing handler and exporter");
   }
   ```
   
   I would use INFO consistently. The Spring Boot starter copies the default 
`true` into Camel's properties, so the current code cannot reliably distinguish 
explicit enablement from default enablement and will emit WARN by default.
   
   This should allow removing the diagnostics map, enum/synchronization, reset 
hooks, and reflective bridge injection in the tests.


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