Observing Spring AI Applications with OpenTelemetry and Dash0
Blog post from Dash0
Observability in agentic applications, particularly when incorporating large language models (LLMs), is crucial due to their non-deterministic nature, as demonstrated through the Spring Merch Storeāa Spring Boot 4 application where users engage with an AI agent to navigate a merchandise catalog. The application integrates Spring AI and employs OpenTelemetry for comprehensive observability, capturing traces, metrics, and logs seamlessly via a single dependency, spring-boot-starter-opentelemetry, which simplifies the configuration process compared to earlier versions. By leveraging OpenTelemetry's GenAI semantic conventions, developers gain insights into LLM token usage, tool calls, and conversation flows without custom instrumentation, while the integration with Dash0 enhances data visibility. The application also highlights advanced configurations like logging prompt and completion text, and ensuring trace context continuity across asynchronous operations using Project Reactor, which enriches the debugging process and refines user interactions with the AI.