Spring AI
Learn how to export Spring AI traces to Openlayer
Spring AI is a Spring-based framework that helps you build AI applications. It comes with built-in OpenTelemetry instrumentation, making it easy to export trace data.
This guide shows how to export Spring AI traces to Openlayer for observability and evaluation.
Configuration
The integration works by sending trace data to Openlayer’s OpenTelemetry endpoint.
The full code used in this guide is available here.
To set it up, you need to:
Add dependencies
Make sure your project includes the following dependencies:
- Spring Boot Actuator
- Micrometer tracing with OpenTelemetry support
- OTLP exporter
For Maven projects, add the required dependencies to your pom.xml. (Gradle users can use the equivalent coordinates.)
Configure Tracing in `application.yml`
With the dependencies in place, Spring Boot will auto-configure OpenTelemetry tracing.
You just need to:
- Set the OTLP endpoint (pointing to Openlayer)
- Enable tracing for Spring AI
Example configuration:
Point to Openlayer's OpenTelemetry endpoint
Finally, point your application to Openlayer’s OpenTelemetry endpoint via the following environment variables:
Run LLMs and workflows as usual
Once instrumentation is set up, you can run your Spring application and LLM calls as usual. Trace data will be automatically captured and exported to Openlayer, where you can begin testing and analyzing it.