CAMEL-24555: Add Spring Boot config for GenAI observability - #1918
Conversation
Expose camel.aiobservability.enabled as first-class Spring Boot configuration and wire it to the Camel PropertiesComponent so GenAiObservability.isEnabled() works consistently with Camel Main. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@davsclaus Could you please review this PR when you have a moment? It implements CAMEL-24555 — first-class Spring Boot configuration for GenAI observability ( AI-generated on behalf of atiaomar1978-hub |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for the contribution — the GenAI observability toggle itself is implemented cleanly and well-tested (4 integration scenarios covering default/disabled/kebab-case/camelCase relaxed binding, plus a focused unit test, all using AssertJ). A few things need to change before merge:
Blocking: this belongs in a new camel-ai-observability-starter, not in core/camel-spring-boot. Adding camel-ai-observability-api as a mandatory dependency of core/camel-spring-boot/pom.xml puts this jar and its auto-configuration on the classpath of every Spring Boot Camel application, regardless of whether they use any AI component. That doesn't match how comparable optional/Preview observability integrations are packaged in this repo — camel-opentelemetry, camel-opentelemetry2, and camel-telemetry-dev all ship their own dedicated starter under components-starter/, and the base abstraction module (camel-telemetry) has no starter of its own at all — it's pulled in transitively only by whichever concrete starter a user opts into. camel-health is the only feature currently bundled directly into core the way this PR does it, but health applies to every Camel app; GenAI observability only matters to the subset using AI components. Please split this into a camel-ai-observability-starter module so users opt in by adding the dependency, matching the camel-opentelemetry-starter precedent.
A few smaller things once the above is addressed — see inline comments.
This review does not replace CodeRabbit/Sourcery or SonarCloud static analysis.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Extract GenAI observability auto-configuration from core/camel-spring-boot into a dedicated camel-ai-observability-starter module so users opt in by adding the dependency (matching camel-opentelemetry2-starter precedent). - Remove mandatory camel-ai-observability-api dependency from core - Use CamelContextConfiguration instead of marker bean - Write camel.aiObservability.enabled to local properties (align with camel-main) - Remove redundant PropertiesComponent wiring - Move tests and configuration metadata to the new starter Co-authored-by: Cursor <cursoragent@cursor.com>
|
@davsclaus Thanks for the review — all feedback has been addressed in commit 9892b0c. Summary of changes:
Replies posted on each inline thread. Ready for another look when you have time. AI-generated on behalf of atiaomar1978-hub |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for the follow-up round — the toggle mechanism itself is solid now. I decompiled the actual camel-ai-observability-api classes and confirmed GenAiObservability.isEnabled() reads PropertiesComponent.resolveProperty("camel.aiObservability.enabled"), and this PR writes exactly that key into local properties from beforeApplicationStart(), which correctly mirrors camel-main's BaseMainSupport.setAiObservabilityProperties. Tests are thorough (default/disabled/kebab-case/camelCase + a unit test), no Thread.sleep, module layout matches the camel-opentelemetry2-starter precedent structurally.
Two things need to be added before merge, based on how the last comparable "other" starter was introduced (camel-diagram-starter, commit dc201ec), which touched these same files:
Blocking: missing tooling/camel-spring-boot-bom/pom.xml entry. The new starter was added to tooling/camel-spring-boot-dependencies/pom.xml but not to tooling/camel-spring-boot-bom/pom.xml. Users who import camel-spring-boot-bom (rather than the dependencies BOM) won't get a managed version for camel-ai-observability-starter. Please add the same <dependency> block there, in alphabetical position next to camel-ai-tool-starter.
Blocking: missing Spring Boot catalog registration. No entry was added to catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others.properties, and there's no corresponding others/ai-observability.json descriptor (compare others/opentelemetry2.json, which has kind, name, title, description, firstVersion, label, supportLevel, groupId, artifactId, version). Without these the new starter won't be discoverable via the Camel Spring Boot catalog, unlike every other starter in the repo.
A couple of smaller items inline.
This review is a rules/conventions check per this repo's contribution guidelines — it does not replace CodeRabbit, Sourcery, or SonarCloud static analysis.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
…arter - Register camel-ai-observability-starter in camel-spring-boot-bom - Add others/ai-observability.json catalog descriptor and others.properties entry - Remove redundant @CamelAiObservability annotation (auto-config via imports) - Fix spring-boot.adoc xref to match existing components convention Co-authored-by: Cursor <cursoragent@cursor.com>
|
@davsclaus Thanks for the second review — all remaining feedback has been addressed in commit d4aa5bd. Blocking items fixed:
Inline items fixed: Tests pass: Ready for another look when you have time. AI-generated on behalf of atiaomar1978-hub |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for iterating on this through several rounds of review feedback — the end result matches the established camel-opentelemetry2-starter / CamelSecurityPolicyAutoConfiguration conventions closely, and the @AutoConfiguration/@ConditionalOnBean(CamelAutoConfiguration.class) wiring is the right pattern for this kind of cross-cutting toggle.
I checked out the branch locally and verified:
- The module builds cleanly and all 9 tests pass, including the kebab-case and camelCase relaxed-binding tests (I also added a temporary assertion to confirm the
AiObservabilityConfigurationPropertiesbean itself binds correctly for all three property spellings, not just the underlyingGenAiObservability.isEnabled()check — it does). GenAiObservability/GenAiObservabilityProperties.ENABLED/camel-ai-observability-apiare real APIs that exist inapache/camelat 4.23.0-SNAPSHOT, and the local-properties wiring approach matches howcamel-main'sBaseMainSupportdoes it.- The catalog entry, BOM/dependencies registration, and pom.xml structure (including the
<!--START/END OF GENERATED CODE-->scoping) all match the precedent set bycamel-opentelemetry2-starterfile-for-file.
One blocking gap: this repo generates a per-starter documentation page via the update-starter-doc-page goal bound in components-starter/pom.xml. Running a build of the new module locally regenerates two files that aren't included in this PR:
docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc(new file, entirely missing)docs/spring-boot/modules/ROOT/nav.adoc(missing the** xref:starters/ai-observability.adoc[Ai Observability]entry)
Per this project's contribution guidelines, generated files must be regenerated and committed, and CI checks for uncommitted diffs after a build — so this will very likely fail CI as-is. Could you run a full build (e.g. mvn -pl components-starter/camel-ai-observability-starter -am install -DskipTests from the repo root) and commit the resulting doc/nav changes?
Minor/non-blocking: the linked JIRA (CAMEL-24555) is assigned to you but still shows status "Open" rather than "In Progress" — worth flipping once you're actively working the PR.
This review does not replace CodeRabbit, Sourcery, SonarCloud, or other static-analysis tooling — it's a check against this repo's own contribution conventions and build/doc requirements.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Commit generated docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc and the corresponding nav.adoc entry from update-starter-doc-page. Addresses review feedback on apache#1918. Co-authored-by: Cursor Agent <noreply@cursor.com>
|
@davsclaus Review feedback addressed in commit Blocking fix: Ran
All 9 AI-generated on behalf of atiaomar1978-hub (Cursor Cloud Agent) |
davsclaus
left a comment
There was a problem hiding this comment.
Review Summary
I reviewed this PR against the project's contribution rules and standards, checked git history/precedent for the affected files, and verified the change empirically:
- Checked out the branch locally and ran
mvn verifyoncamel-ai-observability-starter— build succeeds, all 9 tests pass. - Verified at the bytecode level that
camel-ai-observability-api(the dependency chosen, rather than thecamel-ai-observabilityimpl module) actually containsGenAiObservability/GenAiObservabilityProperties— the dependency choice is correct. - Confirmed the doc xref
xref:components:others:ai-observability.adoc[AI Observability]resolves to a real page inapache/camel. - Compared the BOM / dependencies / catalog / component-starter POM module-list insertions — all correctly alphabetically ordered, matching existing conventions (e.g.
camel-opentelemetry2-starter).
No blocking issues found. One minor, non-blocking observation left as an inline comment below (a pre-existing doc-generator title-casing quirk, not something this PR introduced).
Nice iterative response to prior review feedback across the four commits (core→starter extraction, CamelContextConfiguration over marker bean, BOM/catalog registration, xref fix).
Note: this is a rules-and-conventions review — it doesn't replace SonarCloud, CodeRabbit, or a full security review.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
…-boot.adoc The starter has its own generated doc page (starters/ai-observability.adoc); drop the redundant section from the core Spring Boot guide per review. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the remaining review feedback from @davsclaus in 23817cb:
All 9 AI-generated on behalf of atiaomar1978-hub |
Summary
Adds first-class Spring Boot configuration for GenAI observability via a dedicated
camel-ai-observability-startermodule, matching the Camel Main / JBang behavior introduced in Camel 4.23.Users opt in by adding the starter dependency:
Spring Boot applications can then toggle GenAI observability via:
camel.aiobservability.enabled=falseRelaxed binding also accepts
camel.aiObservability.enabledandcamel.ai-observability.enabled.Changes
camel-ai-observability-starter— dedicated starter undercomponents-starter/(matchingcamel-opentelemetry2-starterprecedent)AiObservabilityConfigurationProperties—@ConfigurationProperties(prefix = "camel.aiobservability")withenabled(defaulttrue)AiObservabilityAutoConfiguration—CamelContextConfigurationwritescamel.aiObservability.enabledto PropertiesComponent local properties (aligned with camel-main)camel-ai-observability-apidependency or auto-configuration incore/camel-spring-bootcamel-spring-boot-bomand Spring Boot catalog (others/ai-observability.json)intro.adoc,ai-observability.jsonmetadata; corespring-boot.adocupdatedReview feedback addressed
camel-ai-observability-starterCamelContextConfiguration@CamelAiObservabilityannotationspring-boot.adocxref conventionTesting
All 9 tests pass.
JIRA
https://issues.apache.org/jira/browse/CAMEL-24555
AI-generated on behalf of atiaomar1978-hub