davsclaus commented on code in PR #1918: URL: https://github.com/apache/camel-spring-boot/pull/1918#discussion_r3889940192
########## components-starter/camel-ai-observability-starter/src/main/java/org/apache/camel/ai/observability/starter/CamelAiObservability.java: ########## @@ -0,0 +1,34 @@ +/* + * 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.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.context.annotation.Import; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@Import(AiObservabilityAutoConfiguration.class) +public @interface CamelAiObservability { Review Comment: This marker annotation looks like leftover from an earlier design iteration. `AiObservabilityAutoConfiguration` is already registered in `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports`, so it activates automatically the moment the starter jar is on the classpath — which is exactly the opt-in mechanism described in the PR description ("Users opt in by adding the starter dependency"). This `@Import`-based annotation is redundant on top of that, and no test exercises it. Recommend deleting this class (and the corresponding blurb in `intro.adoc`) unless there's a use case I'm missing where auto-configuration is deliberately excluded and re-added via this annotation. ########## components-starter/camel-ai-observability-starter/src/main/doc/intro.adoc: ########## @@ -0,0 +1,15 @@ +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. + +Use the `@CamelAiObservability` annotation on your Spring Boot main class or configuration to enable explicitly. Review Comment: This line contradicts the simpler "just add the dependency" story stated a few lines above and in the PR description — `AiObservabilityAutoConfiguration` already auto-activates via `AutoConfiguration.imports` without needing `@CamelAiObservability`. If the annotation in `CamelAiObservability.java` gets removed (see other comment), this line should go too. ########## core/camel-spring-boot/src/main/docs/spring-boot.adoc: ########## @@ -180,6 +180,31 @@ public class MyRouter extends RouteBuilder { } ---- +=== GenAI observability + +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 the `camel-ai-observability-starter` dependency to opt in to first-class +Spring Boot configuration for the global toggle: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-ai-observability-starter</artifactId> +</dependency> +---- + +[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. See the Camel xref:next@components:others:ai-observability.adoc[AI Observability] documentation for span Review Comment: The `next@` version prefix has no precedent anywhere else in this file — the sibling xref a few lines below (`xref:components:others:test-spring-junit6.adoc[...]`) uses no version qualifier. Unless this is intentionally pinning to an unreleased "next" version of the camel docs component, this looks like it should match the existing convention. ```suggestion JBang. See the Camel xref:components:others:ai-observability.adoc[AI Observability] documentation for span ``` -- 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]
