jamesnetherton opened a new pull request, #30329: URL: https://github.com/apache/camel/pull/30329
[CAMEL-27155](https://issues.apache.org/jira/browse/CAMEL-27155) `GenAiObservability` loaded `GenAiObservabilityImpl` by reflection and kept one bridge per `CamelContext` in a static map. `GenAiObservabilityImpl` did the same for the Micrometer metrics and Observation backends. So a stopped context stayed reachable through those static maps. Changes: - New `GenAiObservationFactory` interface in `camel-ai-observability-api`. `camel-ai-observability` provides it as the `ai-observation-factory` service (`@JdkService`). A factory bound in the registry takes precedence. - The factory is stored as a context plugin, so it is released with its context. `GenAiObservabilityImpl` is one instance per context and resolves its Micrometer backends once, on first use. The static maps are gone. - The Micrometer backends are constructed directly once their registry class is found, with no reflective constructor lookup. - Observability still never fails the LLM call: - If the implementation cannot be loaded or linked, or `start` throws a `LinkageError` (such as a Micrometer version mismatch), the call gets a no-op observation. The failure is logged once. - If a Micrometer backend cannot be linked, only that backend is disabled. Tracing and the other backend keep working. Tests cover a factory bound in the registry, a factory that throws while starting, an implementation that fails to load, and a metrics backend that fails to link. _Claude Code on behalf of jamesnetherton_ 🤖 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]
