This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 201e8bb328b CAMEL-27133: camel-ai-observability-starter - bring the 
implementation and expose the new options
201e8bb328b is described below

commit 201e8bb328b3e07a4f093a78b1da5528bf526cb0
Author: croway <[email protected]>
AuthorDate: Tue Nov 17 22:37:04 2026 +0100

    CAMEL-27133: camel-ai-observability-starter - bring the implementation and 
expose the new options
    
    - The starter depended on camel-ai-observability-api only, so adding it 
recorded no GenAI span or
      metric. It now brings camel-ai-observability.
    - New options from CAMEL-27131: camel.aiobservability.level, 
content-max-length and
      defer-to-framework, handed to Camel as override properties under the 
camel.aiObservability.* keys.
    
    GenAI observability stays opt-in: camel-observability-services-starter does 
not include this starter,
    as camel-observability-services does not include camel-ai-observability. 
The starter page says so.
---
 .../catalog/others/ai-observability.json           |  4 +-
 .../camel-ai-observability-starter/pom.xml         |  3 +-
 .../src/main/doc/intro.adoc                        | 15 ++++-
 .../src/main/docs/ai-observability.json            | 21 +++++++
 .../starter/AiObservabilityAutoConfiguration.java  | 54 +++++++++++------
 .../AiObservabilityConfigurationProperties.java    | 46 ++++++++++++++
 ...iObservabilityAutoConfigurationOptionsTest.java | 70 ++++++++++++++++++++++
 .../AiObservabilityAutoConfigurationUnitTest.java  | 63 ++++++++++++++++---
 .../ROOT/pages/starters/ai-observability.adoc      | 20 +++++--
 9 files changed, 261 insertions(+), 35 deletions(-)

diff --git 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others/ai-observability.json
 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others/ai-observability.json
index 1577e20e00d..0e171f1b0e8 100644
--- 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others/ai-observability.json
+++ 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/others/ai-observability.json
@@ -3,10 +3,10 @@
     "kind": "other",
     "name": "ai-observability",
     "title": "AI Observability",
-    "description": "Spring Boot auto-configuration for Camel GenAI 
observability",
+    "description": "GenAI observability support for Camel AI components 
(OpenTelemetry and Micrometer)",
     "deprecated": false,
     "firstVersion": "4.23.0",
-    "label": "monitoring,ai",
+    "label": "ai",
     "supportLevel": "Preview",
     "groupId": "org.apache.camel.springboot",
     "artifactId": "camel-ai-observability-starter",
diff --git a/components-starter/camel-ai-observability-starter/pom.xml 
b/components-starter/camel-ai-observability-starter/pom.xml
index de71c542867..5a0cb1c7592 100644
--- a/components-starter/camel-ai-observability-starter/pom.xml
+++ b/components-starter/camel-ai-observability-starter/pom.xml
@@ -35,8 +35,9 @@
       <version>${spring-boot-version}</version>
     </dependency>
     <dependency>
+      <!-- the implementation that the AI producers load reflectively (it 
brings camel-ai-observability-api) -->
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-ai-observability-api</artifactId>
+      <artifactId>camel-ai-observability</artifactId>
       <version>${camel-version}</version>
     </dependency>
     <!-- Testing dependencies -->
diff --git 
a/components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc 
b/components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc
index 771af681c73..a1c14dd23d0 100644
--- a/components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc
+++ b/components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc
@@ -1,13 +1,22 @@
 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.
+Add this starter to opt in to GenAI observability for Camel AI producers. It 
brings `camel-ai-observability`, so the AI
+producers emit OpenTelemetry spans and Micrometer metrics once a tracing or 
metrics backend is on the classpath as
+well, for example `camel-opentelemetry2-starter`. 
`camel-observability-services-starter` does not include it: add this
+starter as well when the application uses it.
 
-Configure the global toggle in `application.properties`:
+Configure it in `application.properties`:
 
 [source,properties]
 ----
 # Disable GenAI observability for all AI producers (default is true)
 camel.aiobservability.enabled=false
+# How much is recorded: basic (default), detailed or full; full records 
prompts and completions
+camel.aiobservability.level=detailed
+# Maximum length of every text recorded at level full (default 8192)
+camel.aiobservability.content-max-length=4096
+# Do not record a model or tool call that the AI framework already traces, 
such as Spring AI (default true)
+camel.aiobservability.defer-to-framework=true
 ----
 
-Relaxed binding also accepts `camel.aiObservability.enabled` and 
`camel.ai-observability.enabled`. The property is handed to the Camel 
`PropertiesComponent` as the override property `camel.aiObservability.enabled`, 
matching Camel Main and JBang, so the AI producers see it on every thread.
+Relaxed binding also accepts `camel.aiObservability.*` and 
`camel.ai-observability.*`. The options are handed to the Camel 
`PropertiesComponent` as override properties named 
`camel.aiObservability.enabled`, `camel.aiObservability.level`, 
`camel.aiObservability.contentMaxLength` and 
`camel.aiObservability.deferToFramework`, matching Camel Main and JBang.
diff --git 
a/components-starter/camel-ai-observability-starter/src/main/docs/ai-observability.json
 
b/components-starter/camel-ai-observability-starter/src/main/docs/ai-observability.json
index f4cb64e616a..ef8ff144fb1 100644
--- 
a/components-starter/camel-ai-observability-starter/src/main/docs/ai-observability.json
+++ 
b/components-starter/camel-ai-observability-starter/src/main/docs/ai-observability.json
@@ -7,12 +7,33 @@
     }
   ],
   "properties": [
+    {
+      "name": "camel.aiobservability.content-max-length",
+      "type": "java.lang.Integer",
+      "description": "The maximum length of every text (message, tool argument 
or result) recorded at level full. Longer texts are cut.",
+      "sourceType": 
"org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties",
+      "defaultValue": 8192
+    },
+    {
+      "name": "camel.aiobservability.defer-to-framework",
+      "type": "java.lang.Boolean",
+      "description": "When the AI framework behind a component already traces 
its model calls and tool calls (Spring AI with an ObservationRegistry, 
quarkus-langchain4j, a LangChain4j model with an observation listener), Camel 
does not record its own span and metrics for them, so that they are counted 
once.",
+      "sourceType": 
"org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties",
+      "defaultValue": true
+    },
     {
       "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
+    },
+    {
+      "name": "camel.aiobservability.level",
+      "type": "java.lang.String",
+      "description": "How much GenAI telemetry is recorded: basic, detailed or 
full. basic records one span per LLM call with model, token usage and finish 
reason. detailed adds the structure of agent runs (an agent span with one span 
per LLM call and per tool call), request parameters, cached tokens and the 
conversation id. full adds prompts, completions and tool arguments and results, 
which may hold personal or confidential data. Metrics are not affected.",
+      "sourceType": 
"org.apache.camel.ai.observability.starter.AiObservabilityConfigurationProperties",
+      "defaultValue": "basic"
     }
   ],
   "hints": [],
diff --git 
a/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfiguration.java
 
b/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfiguration.java
index 090075197e5..60ae4a0560d 100644
--- 
a/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfiguration.java
+++ 
b/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfiguration.java
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.ai.observability.starter;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 import org.apache.camel.CamelContext;
-import 
org.apache.camel.component.ai.observability.GenAiObservabilityProperties;
+import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
 import org.apache.camel.spring.boot.CamelContextConfiguration;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -28,6 +31,11 @@ import 
org.springframework.boot.context.properties.bind.Binder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.core.env.Environment;
 
+import static 
org.apache.camel.component.ai.observability.GenAiObservabilityProperties.CONTENT_MAX_LENGTH;
+import static 
org.apache.camel.component.ai.observability.GenAiObservabilityProperties.DEFER_TO_FRAMEWORK;
+import static 
org.apache.camel.component.ai.observability.GenAiObservabilityProperties.ENABLED;
+import static 
org.apache.camel.component.ai.observability.GenAiObservabilityProperties.LEVEL;
+
 @AutoConfiguration(after = CamelAutoConfiguration.class)
 @ConditionalOnBean(CamelAutoConfiguration.class)
 @EnableConfigurationProperties(AiObservabilityConfigurationProperties.class)
@@ -35,11 +43,11 @@ public class AiObservabilityAutoConfiguration {
 
     @Bean
     CamelContextConfiguration 
aiObservabilityCamelContextConfiguration(Environment environment) {
-        boolean enabled = resolveEnabled(environment);
+        Map<String, String> properties = resolveProperties(environment);
         return new CamelContextConfiguration() {
             @Override
             public void beforeApplicationStart(CamelContext camelContext) {
-                applyEnabledProperty(camelContext, enabled);
+                applyProperties(camelContext, properties);
             }
 
             @Override
@@ -48,24 +56,36 @@ public class AiObservabilityAutoConfiguration {
         };
     }
 
-    static boolean resolveEnabled(Environment environment) {
-        Boolean canonical = 
environment.getProperty(GenAiObservabilityProperties.ENABLED, Boolean.class);
-        if (canonical != null) {
-            return canonical;
-        }
-        return Binder.get(environment)
+    /**
+     * Resolves every option under the key the AI producers read. A property 
set under that key
+     * ({@code camel.aiObservability.level}) wins, as in Camel Main; otherwise 
the relaxed binding of
+     * {@code camel.aiobservability.*} gives the value, or its default.
+     */
+    static Map<String, String> resolveProperties(Environment environment) {
+        AiObservabilityConfigurationProperties bound = Binder.get(environment)
                 .bind("camel.aiobservability", 
Bindable.of(AiObservabilityConfigurationProperties.class))
-                .map(AiObservabilityConfigurationProperties::isEnabled)
-                .orElse(true);
+                .orElseGet(AiObservabilityConfigurationProperties::new);
+        Map<String, String> properties = new LinkedHashMap<>();
+        properties.put(ENABLED, 
String.valueOf(environment.getProperty(ENABLED, Boolean.class, 
bound.isEnabled())));
+        properties.put(LEVEL, environment.getProperty(LEVEL, 
bound.getLevel()));
+        properties.put(CONTENT_MAX_LENGTH, String.valueOf(
+                environment.getProperty(CONTENT_MAX_LENGTH, Integer.class, 
bound.getContentMaxLength())));
+        properties.put(DEFER_TO_FRAMEWORK,
+                String.valueOf(environment.getProperty(DEFER_TO_FRAMEWORK, 
Boolean.class, bound.isDeferToFramework())));
+        return properties;
+    }
+
+    static boolean resolveEnabled(Environment environment) {
+        return 
Boolean.parseBoolean(resolveProperties(environment).get(ENABLED));
     }
 
     /**
-     * Hands the option to the Camel PropertiesComponent as an override 
property, matching Camel Main and JBang. The AI
-     * producers read it on the threads that route the exchanges; the local 
properties of the PropertiesComponent belong
-     * to the thread that sets them, so they would only be seen at startup.
+     * Hands the options to the Camel PropertiesComponent as override 
properties, matching Camel Main and JBang. The AI
+     * producers read them on the threads that route the exchanges; the local 
properties of the PropertiesComponent
+     * belong to the thread that sets them, so they would only be seen at 
startup.
      */
-    static void applyEnabledProperty(CamelContext camelContext, boolean 
enabled) {
-        
camelContext.getPropertiesComponent().addOverrideProperty(GenAiObservabilityProperties.ENABLED,
-                Boolean.toString(enabled));
+    static void applyProperties(CamelContext camelContext, Map<String, String> 
properties) {
+        PropertiesComponent pc = camelContext.getPropertiesComponent();
+        properties.forEach(pc::addOverrideProperty);
     }
 }
diff --git 
a/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityConfigurationProperties.java
 
b/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityConfigurationProperties.java
index 9b99844f6e2..9f6f261ec09 100644
--- 
a/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityConfigurationProperties.java
+++ 
b/components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/AiObservabilityConfigurationProperties.java
@@ -27,6 +27,28 @@ public class AiObservabilityConfigurationProperties {
      */
     private boolean enabled = true;
 
+    /**
+     * How much GenAI telemetry is recorded: basic, detailed or full. basic 
records one span per LLM call with model,
+     * token usage and finish reason. detailed adds the structure of agent 
runs (an agent span with one span per LLM
+     * call and per tool call), request parameters, cached tokens and the 
conversation id. full adds prompts,
+     * completions and tool arguments and results, which may hold personal or 
confidential data. Metrics are not
+     * affected.
+     */
+    private String level = "basic";
+
+    /**
+     * The maximum length of every text (message, tool argument or result) 
recorded at level full. Longer texts are
+     * cut.
+     */
+    private int contentMaxLength = 8192;
+
+    /**
+     * When the AI framework behind a component already traces its model calls 
and tool calls (Spring AI with an
+     * ObservationRegistry, quarkus-langchain4j, a LangChain4j model with an 
observation listener), Camel does not
+     * record its own span and metrics for them, so that they are counted once.
+     */
+    private boolean deferToFramework = true;
+
     public boolean isEnabled() {
         return enabled;
     }
@@ -34,4 +56,28 @@ public class AiObservabilityConfigurationProperties {
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
     }
+
+    public String getLevel() {
+        return level;
+    }
+
+    public void setLevel(String level) {
+        this.level = level;
+    }
+
+    public int getContentMaxLength() {
+        return contentMaxLength;
+    }
+
+    public void setContentMaxLength(int contentMaxLength) {
+        this.contentMaxLength = contentMaxLength;
+    }
+
+    public boolean isDeferToFramework() {
+        return deferToFramework;
+    }
+
+    public void setDeferToFramework(boolean deferToFramework) {
+        this.deferToFramework = deferToFramework;
+    }
 }
diff --git 
a/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationOptionsTest.java
 
b/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationOptionsTest.java
new file mode 100644
index 00000000000..d4c78886573
--- /dev/null
+++ 
b/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationOptionsTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.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.test.spring.junit6.CamelSpringBootTest;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@DirtiesContext
+@CamelSpringBootTest
+@EnableAutoConfiguration
+@SpringBootTest(
+        classes = {
+                
AiObservabilityAutoConfigurationOptionsTest.TestConfiguration.class,
+                AiObservabilityAutoConfiguration.class,
+                CamelAutoConfiguration.class
+        },
+        properties = {
+                "camel.aiobservability.level=full",
+                "camel.ai-observability.content-max-length=100",
+                "camel.aiObservability.deferToFramework=false" })
+class AiObservabilityAutoConfigurationOptionsTest {
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Autowired
+    AiObservabilityConfigurationProperties configurationProperties;
+
+    @Test
+    void shouldBindOptionsAndHandThemToCamel() {
+        assertThat(configurationProperties.getLevel()).isEqualTo("full");
+        
assertThat(configurationProperties.getContentMaxLength()).isEqualTo(100);
+
+        PropertiesComponent pc = (PropertiesComponent) 
camelContext.getPropertiesComponent();
+        assertThat(pc.getOverrideProperties())
+                .containsEntry(GenAiObservabilityProperties.LEVEL, "full")
+                
.containsEntry(GenAiObservabilityProperties.CONTENT_MAX_LENGTH, "100")
+                
.containsEntry(GenAiObservabilityProperties.DEFER_TO_FRAMEWORK, "false");
+        
assertThat(camelContext.resolvePropertyPlaceholders("{{camel.aiObservability.level}}")).isEqualTo("full");
+    }
+
+    @Configuration
+    static class TestConfiguration {
+    }
+}
diff --git 
a/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationUnitTest.java
 
b/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationUnitTest.java
index 7ca6e36c85e..31ba91d8505 100644
--- 
a/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationUnitTest.java
+++ 
b/components-starter/camel-ai-observability-starter/src/test/java/org/apache/camel/ai/observability/starter/AiObservabilityAutoConfigurationUnitTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.ai.observability.starter;
 
+import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 
@@ -25,6 +27,7 @@ import 
org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.jupiter.api.Test;
 import org.springframework.mock.env.MockEnvironment;
+import org.springframework.util.ClassUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -56,7 +59,8 @@ class AiObservabilityAutoConfigurationUnitTest {
     @Test
     void shouldApplyDisabledPropertyAsOverrideProperty() throws Exception {
         try (DefaultCamelContext camelContext = new DefaultCamelContext()) {
-            
AiObservabilityAutoConfiguration.applyEnabledProperty(camelContext, false);
+            AiObservabilityAutoConfiguration.applyProperties(camelContext,
+                    Map.of(GenAiObservabilityProperties.ENABLED, "false"));
 
             PropertiesComponent pc = (PropertiesComponent) 
camelContext.getPropertiesComponent();
             assertThat(pc.getOverrideProperties())
@@ -68,7 +72,8 @@ class AiObservabilityAutoConfigurationUnitTest {
     @Test
     void shouldApplyEnabledPropertyAsOverrideProperty() throws Exception {
         try (DefaultCamelContext camelContext = new DefaultCamelContext()) {
-            
AiObservabilityAutoConfiguration.applyEnabledProperty(camelContext, true);
+            AiObservabilityAutoConfiguration.applyProperties(camelContext,
+                    Map.of(GenAiObservabilityProperties.ENABLED, "true"));
 
             PropertiesComponent pc = (PropertiesComponent) 
camelContext.getPropertiesComponent();
             assertThat(pc.getOverrideProperties())
@@ -78,14 +83,56 @@ class AiObservabilityAutoConfigurationUnitTest {
     }
 
     @Test
-    void shouldMakeTheOptionVisibleToOtherThreads() throws Exception {
+    void shouldResolveDefaultsOfAllOptions() {
+        MockEnvironment environment = new MockEnvironment();
+
+        
assertThat(AiObservabilityAutoConfiguration.resolveProperties(environment))
+                .containsEntry(GenAiObservabilityProperties.ENABLED, "true")
+                .containsEntry(GenAiObservabilityProperties.LEVEL, "basic")
+                
.containsEntry(GenAiObservabilityProperties.CONTENT_MAX_LENGTH, "8192")
+                
.containsEntry(GenAiObservabilityProperties.DEFER_TO_FRAMEWORK, "true");
+    }
+
+    @Test
+    void shouldResolveOptionsFromRelaxedAndCanonicalKeys() {
+        MockEnvironment environment = new MockEnvironment();
+        environment.setProperty("camel.aiobservability.level", "detailed");
+        environment.setProperty("camel.ai-observability.content-max-length", 
"100");
+        
environment.setProperty(GenAiObservabilityProperties.DEFER_TO_FRAMEWORK, 
"false");
+
+        
assertThat(AiObservabilityAutoConfiguration.resolveProperties(environment))
+                .containsEntry(GenAiObservabilityProperties.LEVEL, "detailed")
+                
.containsEntry(GenAiObservabilityProperties.CONTENT_MAX_LENGTH, "100")
+                
.containsEntry(GenAiObservabilityProperties.DEFER_TO_FRAMEWORK, "false");
+    }
+
+    @Test
+    void shouldPreferCanonicalKeyOverRelaxedBinding() {
+        MockEnvironment environment = new MockEnvironment();
+        environment.setProperty("camel.ai-observability.level", "detailed");
+        environment.setProperty(GenAiObservabilityProperties.LEVEL, "full");
+
+        
assertThat(AiObservabilityAutoConfiguration.resolveProperties(environment))
+                .containsEntry(GenAiObservabilityProperties.LEVEL, "full");
+    }
+
+    @Test
+    void shouldShipTheImplementationTheProducersLoad() {
+        // GenAiObservability loads it reflectively; without it every AI 
producer records nothing
+        
assertThat(ClassUtils.isPresent("org.apache.camel.component.ai.observability.GenAiObservabilityImpl",
+                getClass().getClassLoader())).isTrue();
+    }
+
+    @Test
+    void shouldMakeOptionsVisibleToOtherThreads() throws Exception {
         try (DefaultCamelContext camelContext = new DefaultCamelContext()) {
-            
AiObservabilityAutoConfiguration.applyEnabledProperty(camelContext, false);
+            AiObservabilityAutoConfiguration.applyProperties(camelContext,
+                    Map.of(GenAiObservabilityProperties.LEVEL, "detailed"));
 
-            // the AI producers read the option on the threads that route the 
exchanges, not on the startup thread
-            CompletableFuture<Boolean> enabled
-                    = CompletableFuture.supplyAsync(() -> 
GenAiObservability.isEnabled(camelContext));
-            assertThat(enabled.get(10, TimeUnit.SECONDS)).isFalse();
+            // the AI producers run on the threads that route the exchanges, 
not on the startup thread
+            CompletableFuture<Optional<String>> level = 
CompletableFuture.supplyAsync(
+                    () -> 
camelContext.getPropertiesComponent().resolveProperty(GenAiObservabilityProperties.LEVEL));
+            assertThat(level.get(10, TimeUnit.SECONDS)).contains("detailed");
         }
     }
 }
diff --git a/docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc 
b/docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc
index 956efcd66c8..2c6f0e7a472 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/ai-observability.adoc
@@ -5,17 +5,26 @@
 
 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.
+Add this starter to opt in to GenAI observability for Camel AI producers. It 
brings `camel-ai-observability`, so the AI
+producers emit OpenTelemetry spans and Micrometer metrics once a tracing or 
metrics backend is on the classpath as
+well, for example `camel-opentelemetry2-starter`. 
`camel-observability-services-starter` does not include it: add this
+starter as well when the application uses it.
 
-Configure the global toggle in `application.properties`:
+Configure it in `application.properties`:
 
 [source,properties]
 ----
 # Disable GenAI observability for all AI producers (default is true)
 camel.aiobservability.enabled=false
+# How much is recorded: basic (default), detailed or full; full records 
prompts and completions
+camel.aiobservability.level=detailed
+# Maximum length of every text recorded at level full (default 8192)
+camel.aiobservability.content-max-length=4096
+# Do not record a model or tool call that the AI framework already traces, 
such as Spring AI (default true)
+camel.aiobservability.defer-to-framework=true
 ----
 
-Relaxed binding also accepts `camel.aiObservability.enabled` and 
`camel.ai-observability.enabled`. The property is handed to the Camel 
`PropertiesComponent` as the override property `camel.aiObservability.enabled`, 
matching Camel Main and JBang, so the AI producers see it on every thread.
+Relaxed binding also accepts `camel.aiObservability.*` and 
`camel.ai-observability.*`. The options are handed to the Camel 
`PropertiesComponent` as override properties named 
`camel.aiObservability.enabled`, `camel.aiObservability.level`, 
`camel.aiObservability.contentMaxLength` and 
`camel.aiObservability.deferToFramework`, matching Camel Main and JBang.
 
 == Maven coordinates
 
@@ -29,10 +38,13 @@ Relaxed binding also accepts 
`camel.aiObservability.enabled` and `camel.ai-obser
 
 == Spring Boot Auto-Configuration
 
-The starter supports 1 options, which are listed below.
+The starter supports 4 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| camel.aiobservability.content-max-length | The maximum length of every text 
(message, tool argument or result) recorded at level full. Longer texts are 
cut. | 8192 | Integer
+| camel.aiobservability.defer-to-framework | When the AI framework behind a 
component already traces its model calls and tool calls (Spring AI with an 
ObservationRegistry, quarkus-langchain4j, a LangChain4j model with an 
observation listener), Camel does not record its own span and metrics for them, 
so that they are counted once. | true | Boolean
 | camel.aiobservability.enabled | Enables GenAI observability for Camel AI 
producers (OpenTelemetry spans and Micrometer metrics when backends are 
present). | true | Boolean
+| camel.aiobservability.level | How much GenAI telemetry is recorded: basic, 
detailed or full. basic records one span per LLM call with model, token usage 
and finish reason. detailed adds the structure of agent runs (an agent span 
with one span per LLM call and per tool call), request parameters, cached 
tokens and the conversation id. full adds prompts, completions and tool 
arguments and results, which may hold personal or confidential data. Metrics 
are not affected. | basic | String
 |===

Reply via email to