-
Notifications
You must be signed in to change notification settings - Fork 203
CAMEL-24555: Add Spring Boot config for GenAI observability #1918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davsclaus
merged 5 commits into
apache:main
from
atiaomar1978-hub:feature/CAMEL-24555-genai-observability-spring-boot-c587
Aug 30, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
533dced
CAMEL-24555: Add Spring Boot config for GenAI observability
cursoragent 9892b0c
CAMEL-24555: Move GenAI observability to camel-ai-observability-starter
cursoragent d4aa5bd
CAMEL-24555: Add BOM and catalog registration for ai-observability st…
cursoragent b9de893
CAMEL-24555: Regenerate starter doc page and nav entry
cursoragent 23817cb
CAMEL-24555: Remove duplicate GenAI observability section from spring…
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...vider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| ai-observability | ||
| aws-xray | ||
| cli-connector | ||
| cli-debug | ||
|
|
||
15 changes: 15 additions & 0 deletions
15
...gboot/src/main/resources/org/apache/camel/springboot/catalog/others/ai-observability.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "other": { | ||
| "kind": "other", | ||
| "name": "ai-observability", | ||
| "title": "AI Observability", | ||
| "description": "Spring Boot auto-configuration for Camel GenAI observability", | ||
| "deprecated": false, | ||
| "firstVersion": "4.23.0", | ||
| "label": "monitoring,ai", | ||
| "supportLevel": "Preview", | ||
| "groupId": "org.apache.camel.springboot", | ||
| "artifactId": "camel-ai-observability-starter", | ||
| "version": "4.23.0-SNAPSHOT" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed with | ||
| this work for additional information regarding copyright ownership. | ||
| The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
|
|
||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.apache.camel.springboot</groupId> | ||
| <artifactId>components-starter</artifactId> | ||
| <version>4.23.0-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>camel-ai-observability-starter</artifactId> | ||
| <packaging>jar</packaging> | ||
| <name>Camel SB Starters :: AI Observability</name> | ||
| <description>Spring-Boot Starter for Camel GenAI Observability</description> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter</artifactId> | ||
| <version>${spring-boot-version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.camel</groupId> | ||
| <artifactId>camel-ai-observability-api</artifactId> | ||
| <version>${camel-version}</version> | ||
| </dependency> | ||
| <!-- Testing dependencies --> | ||
| <dependency> | ||
| <groupId>org.apache.camel</groupId> | ||
| <artifactId>camel-test-spring-junit6</artifactId> | ||
| <version>${camel-version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-test</artifactId> | ||
| <version>${spring-boot-version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <!--START OF GENERATED CODE--> | ||
| <dependency> | ||
| <groupId>org.apache.camel.springboot</groupId> | ||
| <artifactId>camel-core-starter</artifactId> | ||
| </dependency> | ||
| <!--END OF GENERATED CODE--> | ||
| </dependencies> | ||
| </project> |
13 changes: 13 additions & 0 deletions
13
components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Spring Boot auto-configuration for Camel GenAI observability. | ||
|
|
||
| Add this starter to opt in to GenAI observability configuration for Camel AI producers. Camel 4.23+ AI producers emit OpenTelemetry spans and Micrometer metrics when `camel-ai-observability` and a tracing or metrics backend are on the classpath. | ||
|
|
||
| Configure the global toggle in `application.properties`: | ||
|
|
||
| [source,properties] | ||
| ---- | ||
| # Disable GenAI observability for all AI producers (default is true) | ||
| camel.aiobservability.enabled=false | ||
| ---- | ||
|
|
||
| Relaxed binding also accepts `camel.aiObservability.enabled` and `camel.ai-observability.enabled`. The property is written to the Camel `PropertiesComponent` local properties as `camel.aiObservability.enabled`, matching Camel Main and JBang. |
22 changes: 22 additions & 0 deletions
22
components-starter/camel-ai-observability-starter/src/main/docs/ai-observability.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "groups": [ | ||
| { | ||
| "name": "camel.aiobservability", | ||
| "type": "org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties", | ||
| "sourceType": "org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties" | ||
| } | ||
| ], | ||
| "properties": [ | ||
| { | ||
| "name": "camel.aiobservability.enabled", | ||
| "type": "java.lang.Boolean", | ||
| "description": "Enables GenAI observability for Camel AI producers (OpenTelemetry spans and Micrometer metrics when backends are present).", | ||
| "sourceType": "org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties", | ||
| "defaultValue": true | ||
| } | ||
| ], | ||
| "hints": [], | ||
| "ignored": { | ||
| "properties": [] | ||
| } | ||
| } |
74 changes: 74 additions & 0 deletions
74
...main/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.camel.ai.observability.starter; | ||
|
|
||
| import java.util.Properties; | ||
|
|
||
| import org.apache.camel.CamelContext; | ||
| import org.apache.camel.component.ai.observability.GenAiObservabilityProperties; | ||
| import org.apache.camel.component.properties.PropertiesComponent; | ||
| import org.apache.camel.spring.boot.CamelAutoConfiguration; | ||
| import org.apache.camel.spring.boot.CamelContextConfiguration; | ||
| import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| import org.springframework.boot.context.properties.bind.Bindable; | ||
| import org.springframework.boot.context.properties.bind.Binder; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.core.env.Environment; | ||
|
|
||
| @AutoConfiguration(after = CamelAutoConfiguration.class) | ||
| @ConditionalOnBean(CamelAutoConfiguration.class) | ||
| @EnableConfigurationProperties(AiObservabilityConfigurationProperties.class) | ||
| public class AiObservabilityAutoConfiguration { | ||
|
|
||
| @Bean | ||
| CamelContextConfiguration aiObservabilityCamelContextConfiguration(Environment environment) { | ||
| boolean enabled = resolveEnabled(environment); | ||
| return new CamelContextConfiguration() { | ||
| @Override | ||
| public void beforeApplicationStart(CamelContext camelContext) { | ||
| applyEnabledProperty(camelContext, enabled); | ||
| } | ||
|
|
||
| @Override | ||
| public void afterApplicationStart(CamelContext camelContext) { | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| static boolean resolveEnabled(Environment environment) { | ||
| Boolean canonical = environment.getProperty(GenAiObservabilityProperties.ENABLED, Boolean.class); | ||
| if (canonical != null) { | ||
| return canonical; | ||
| } | ||
| return Binder.get(environment) | ||
| .bind("camel.aiobservability", Bindable.of(AiObservabilityConfigurationProperties.class)) | ||
| .map(AiObservabilityConfigurationProperties::isEnabled) | ||
| .orElse(true); | ||
| } | ||
|
|
||
| static void applyEnabledProperty(CamelContext camelContext, boolean enabled) { | ||
| PropertiesComponent pc = (PropertiesComponent) camelContext.getPropertiesComponent(); | ||
| Properties local = pc.getLocalProperties(); | ||
| if (local == null) { | ||
| local = new Properties(); | ||
| pc.setLocalProperties(local); | ||
| } | ||
| local.setProperty(GenAiObservabilityProperties.ENABLED, Boolean.toString(enabled)); | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
...ava/org/apache/camel/ai/observability/starter/AiObservabilityConfigurationProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.camel.ai.observability.starter; | ||
|
|
||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
|
||
| @ConfigurationProperties(prefix = "camel.aiobservability") | ||
| public class AiObservabilityConfigurationProperties { | ||
|
|
||
| /** | ||
| * Enables GenAI observability for Camel AI producers (OpenTelemetry spans and Micrometer metrics when backends are | ||
| * present). | ||
| */ | ||
| private boolean enabled = true; | ||
|
|
||
| public boolean isEnabled() { | ||
| return enabled; | ||
| } | ||
|
|
||
| public void setEnabled(boolean enabled) { | ||
| this.enabled = enabled; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.