Skip to content

CAMEL-24555: Add Spring Boot config for GenAI observability - #1918

Merged
davsclaus merged 5 commits into
apache:mainfrom
atiaomar1978-hub:feature/CAMEL-24555-genai-observability-spring-boot-c587
Aug 30, 2026
Merged

CAMEL-24555: Add Spring Boot config for GenAI observability#1918
davsclaus merged 5 commits into
apache:mainfrom
atiaomar1978-hub:feature/CAMEL-24555-genai-observability-spring-boot-c587

Conversation

@atiaomar1978-hub

@atiaomar1978-hub atiaomar1978-hub commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds first-class Spring Boot configuration for GenAI observability via a dedicated camel-ai-observability-starter module, matching the Camel Main / JBang behavior introduced in Camel 4.23.

Users opt in by adding the starter dependency:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-ai-observability-starter</artifactId>
</dependency>

Spring Boot applications can then toggle GenAI observability via:

camel.aiobservability.enabled=false

Relaxed binding also accepts camel.aiObservability.enabled and camel.ai-observability.enabled.

Changes

  • camel-ai-observability-starter — dedicated starter under components-starter/ (matching camel-opentelemetry2-starter precedent)
  • AiObservabilityConfigurationProperties@ConfigurationProperties(prefix = "camel.aiobservability") with enabled (default true)
  • AiObservabilityAutoConfigurationCamelContextConfiguration writes camel.aiObservability.enabled to PropertiesComponent local properties (aligned with camel-main)
  • Removed from core — no mandatory camel-ai-observability-api dependency or auto-configuration in core/camel-spring-boot
  • BOM + catalog — registered in camel-spring-boot-bom and Spring Boot catalog (others/ai-observability.json)
  • Tests — unit + integration tests for default, disabled, kebab-case, and camelCase relaxed binding
  • Documentation — starter intro.adoc, ai-observability.json metadata; core spring-boot.adoc updated

Review feedback addressed

  • Moved auto-configuration out of core into camel-ai-observability-starter
  • Removed redundant PropertiesComponent wiring
  • Switched from override to local properties (matches camel-main)
  • Replaced marker bean with CamelContextConfiguration
  • Added BOM and catalog registration
  • Removed redundant @CamelAiObservability annotation
  • Fixed spring-boot.adoc xref convention

Testing

./mvnw test -pl components-starter/camel-ai-observability-starter -Dtest="AiObservabilityAutoConfiguration*"

All 9 tests pass.

JIRA

https://issues.apache.org/jira/browse/CAMEL-24555

AI-generated on behalf of atiaomar1978-hub

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>
@atiaomar1978-hub
atiaomar1978-hub marked this pull request as ready for review August 29, 2026 22:20
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

@davsclaus Could you please review this PR when you have a moment?

It implements CAMEL-24555 — first-class Spring Boot configuration for GenAI observability (camel.aiobservability.enabled), wiring the resolved value into the Camel PropertiesComponent so GenAiObservability.isEnabled() behaves consistently with Camel Main.

AI-generated on behalf of atiaomar1978-hub

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread core/camel-spring-boot/pom.xml Outdated
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>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

@davsclaus Thanks for the review — all feedback has been addressed in commit 9892b0c.

Summary of changes:

  1. New camel-ai-observability-starter module — GenAI observability auto-configuration moved out of core/camel-spring-boot into a dedicated starter under components-starter/, matching the camel-opentelemetry2-starter precedent. The mandatory camel-ai-observability-api dependency was removed from core.

  2. Removed redundant PropertiesComponent wiring — no longer calls setCamelContext() / setPropertiesComponent() since CamelAutoConfiguration already handles this.

  3. Aligned with camel-main — writes camel.aiObservability.enabled to PropertiesComponent local properties instead of override properties.

  4. Replaced marker bean — uses a CamelContextConfiguration bean with beforeApplicationStart() instead of an empty marker class.

Replies posted on each inline thread. Ready for another look when you have time.

AI-generated on behalf of atiaomar1978-hub

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc Outdated
Comment thread core/camel-spring-boot/src/main/docs/spring-boot.adoc Outdated
…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>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

@davsclaus Thanks for the second review — all remaining feedback has been addressed in commit d4aa5bd.

Blocking items fixed:

  1. Added camel-ai-observability-starter to tooling/camel-spring-boot-bom/pom.xml (alphabetically next to camel-ai-tool-starter)
  2. Registered the starter in the Spring Boot catalog: others.properties + others/ai-observability.json

Inline items fixed:
3. Removed redundant @CamelAiObservability annotation class (auto-config activates via AutoConfiguration.imports)
4. Removed the corresponding @CamelAiObservability mention from intro.adoc
5. Fixed spring-boot.adoc xref: next@components:others:ai-observability.adoccomponents:others:ai-observability.adoc

Tests pass: ./mvnw test -pl components-starter/camel-ai-observability-starter -Dtest="AiObservabilityAutoConfiguration*"

Ready for another look when you have time.

AI-generated on behalf of atiaomar1978-hub

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AiObservabilityConfigurationProperties bean itself binds correctly for all three property spellings, not just the underlying GenAiObservability.isEnabled() check — it does).
  • GenAiObservability / GenAiObservabilityProperties.ENABLED / camel-ai-observability-api are real APIs that exist in apache/camel at 4.23.0-SNAPSHOT, and the local-properties wiring approach matches how camel-main's BaseMainSupport does it.
  • The catalog entry, BOM/dependencies registration, and pom.xml structure (including the <!--START/END OF GENERATED CODE--> scoping) all match the precedent set by camel-opentelemetry2-starter file-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.

Comment thread components-starter/pom.xml
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>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

@davsclaus Review feedback addressed in commit b9de893.

Blocking fix: Ran update-starter-doc-page and committed the generated files:

  • docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc (new)
  • docs/spring-boot/modules/ROOT/nav.adoc (added Ai Observability entry)

All 9 AiObservabilityAutoConfiguration* tests still pass. Ready for re-review.

AI-generated on behalf of atiaomar1978-hub (Cursor Cloud Agent)

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 verify on camel-ai-observability-starter — build succeeds, all 9 tests pass.
  • Verified at the bytecode level that camel-ai-observability-api (the dependency chosen, rather than the camel-ai-observability impl module) actually contains GenAiObservability / GenAiObservabilityProperties — the dependency choice is correct.
  • Confirmed the doc xref xref:components:others:ai-observability.adoc[AI Observability] resolves to a real page in apache/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.

Comment thread core/camel-spring-boot/src/main/docs/spring-boot.adoc Outdated
…-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>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Addressed the remaining review feedback from @davsclaus in 23817cb:

  • Removed duplicate docs: Deleted the === GenAI observability section from core/camel-spring-boot/src/main/docs/spring-boot.adoc — this content is already covered by the generated starter page (starters/ai-observability.adoc).

All 9 AiObservabilityAutoConfiguration* tests still pass. Ready for re-review.

AI-generated on behalf of atiaomar1978-hub

@davsclaus
davsclaus merged commit 47ff426 into apache:main Aug 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants