Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ai-observability
aws-xray
cli-connector
cli-debug
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"other": {
"kind": "other",
"name": "ai-observability",
"title": "AI Observability",
Comment thread
atiaomar1978-hub marked this conversation as resolved.
"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"
}
}
62 changes: 62 additions & 0 deletions components-starter/camel-ai-observability-starter/pom.xml
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>
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.
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": []
}
}
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));
}
}
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;
}
}
Loading
Loading